diff options
Diffstat (limited to 'firmware/drivers/rtc/rtc_m41st84w.c')
-rw-r--r-- | firmware/drivers/rtc/rtc_m41st84w.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/firmware/drivers/rtc/rtc_m41st84w.c b/firmware/drivers/rtc/rtc_m41st84w.c index 4cfa155bfb..621e650f68 100644 --- a/firmware/drivers/rtc/rtc_m41st84w.c +++ b/firmware/drivers/rtc/rtc_m41st84w.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "rtc.h" | 23 | #include "rtc.h" |
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include <stdbool.h> | 26 | #include "timefuncs.h" |
27 | 27 | ||
28 | #define RTC_ADR 0xd0 | 28 | #define RTC_ADR 0xd0 |
29 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) | 29 | #define RTC_DEV_WRITE (RTC_ADR | 0x00) |
@@ -257,14 +257,12 @@ int rtc_read_datetime(struct tm *tm) | |||
257 | tm->tm_sec = BCD2DEC(buf[0] & 0x7f); | 257 | tm->tm_sec = BCD2DEC(buf[0] & 0x7f); |
258 | tm->tm_min = BCD2DEC(buf[1] & 0x7f); | 258 | tm->tm_min = BCD2DEC(buf[1] & 0x7f); |
259 | tm->tm_hour = BCD2DEC(buf[2] & 0x3f); | 259 | tm->tm_hour = BCD2DEC(buf[2] & 0x3f); |
260 | tm->tm_wday = BCD2DEC(buf[3] & 0x7); | ||
261 | tm->tm_mday = BCD2DEC(buf[4] & 0x3f); | 260 | tm->tm_mday = BCD2DEC(buf[4] & 0x3f); |
262 | tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; | 261 | tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; |
263 | tm->tm_year = BCD2DEC(buf[6]) + 100; | 262 | tm->tm_year = BCD2DEC(buf[6]) + 100; |
263 | tm->tm_yday = 0; /* Not implemented for now */ | ||
264 | 264 | ||
265 | /* Adjust weekday */ | 265 | set_day_of_week(tm); |
266 | if (tm->tm_wday == 7) | ||
267 | tm->tm_wday = 0; | ||
268 | 266 | ||
269 | return rc; | 267 | return rc; |
270 | } | 268 | } |