From 58b849c451ac1281c14bfc535ab7f411a0b736e0 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Wed, 25 Jan 2017 19:32:15 -0500 Subject: 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 --- firmware/drivers/rtc/rtc_m41st84w.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'firmware/drivers/rtc/rtc_m41st84w.c') 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 @@ #include "rtc.h" #include "kernel.h" #include "system.h" -#include +#include "timefuncs.h" #define RTC_ADR 0xd0 #define RTC_DEV_WRITE (RTC_ADR | 0x00) @@ -257,14 +257,12 @@ int rtc_read_datetime(struct tm *tm) tm->tm_sec = BCD2DEC(buf[0] & 0x7f); tm->tm_min = BCD2DEC(buf[1] & 0x7f); tm->tm_hour = BCD2DEC(buf[2] & 0x3f); - tm->tm_wday = BCD2DEC(buf[3] & 0x7); tm->tm_mday = BCD2DEC(buf[4] & 0x3f); tm->tm_mon = BCD2DEC(buf[5] & 0x1f) - 1; tm->tm_year = BCD2DEC(buf[6]) + 100; + tm->tm_yday = 0; /* Not implemented for now */ - /* Adjust weekday */ - if (tm->tm_wday == 7) - tm->tm_wday = 0; + set_day_of_week(tm); return rc; } -- cgit v1.2.3