diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2017-01-25 19:32:15 -0500 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2017-01-26 23:07:49 -0500 |
commit | 58b849c451ac1281c14bfc535ab7f411a0b736e0 (patch) | |
tree | 035026a62581900f72fa0d90bd694a8a92372c00 /firmware/drivers/rtc/rtc_rx5x348ab.c | |
parent | 783c77531c35e62dd754c510c4f2beefe6df4a9d (diff) | |
download | rockbox-58b849c451ac1281c14bfc535ab7f411a0b736e0.tar.gz rockbox-58b849c451ac1281c14bfc535ab7f411a0b736e0.zip |
Move intrinsic RTC implmentation differences to driver files
Some drivers set tm_wday just fine and do not need it coerced to
be correct. Others set tm_yday, so don't overwrite what the driver
sets; just zero it inside if it can't fill the field. Move calls
to set_day_of_week() to the sorts of drivers that presumably
required the hammer (FS#11814) in get_time() where the weekday
isn't locked to the date.
Change-Id: Idd0ded6bfc9d9f48fcc1a6074068164c42fcf24a
Diffstat (limited to 'firmware/drivers/rtc/rtc_rx5x348ab.c')
-rw-r--r-- | firmware/drivers/rtc/rtc_rx5x348ab.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/firmware/drivers/rtc/rtc_rx5x348ab.c b/firmware/drivers/rtc/rtc_rx5x348ab.c index f31ab5623e..6d7b78b281 100644 --- a/firmware/drivers/rtc/rtc_rx5x348ab.c +++ b/firmware/drivers/rtc/rtc_rx5x348ab.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "spi.h" | 23 | #include "spi.h" |
24 | #include "rtc.h" | 24 | #include "rtc.h" |
25 | #include "timefuncs.h" | ||
25 | 26 | ||
26 | /* Choose one of: */ | 27 | /* Choose one of: */ |
27 | #define ADDR_READ 0x04 | 28 | #define ADDR_READ 0x04 |
@@ -48,10 +49,12 @@ int rtc_read_datetime(struct tm *tm) | |||
48 | tm->tm_sec = buf[0]; | 49 | tm->tm_sec = buf[0]; |
49 | tm->tm_min = buf[1]; | 50 | tm->tm_min = buf[1]; |
50 | tm->tm_hour = buf[2]; | 51 | tm->tm_hour = buf[2]; |
51 | tm->tm_wday = buf[3]; | ||
52 | tm->tm_mday = buf[4]; | 52 | tm->tm_mday = buf[4]; |
53 | tm->tm_mon = buf[5] - 1; | 53 | tm->tm_mon = buf[5] - 1; |
54 | tm->tm_year = buf[6] + 100; | 54 | tm->tm_year = buf[6] + 100; |
55 | tm->tm_yday = 0; /* Not implemented for now */ | ||
56 | |||
57 | set_day_of_week(tm); | ||
55 | 58 | ||
56 | return 1; | 59 | return 1; |
57 | } | 60 | } |