diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/rtc/rtc_mc13783.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/firmware/drivers/rtc/rtc_mc13783.c b/firmware/drivers/rtc/rtc_mc13783.c index a1f78f738d..aedf5f6fa5 100644 --- a/firmware/drivers/rtc/rtc_mc13783.c +++ b/firmware/drivers/rtc/rtc_mc13783.c | |||
@@ -69,6 +69,7 @@ static const unsigned char rtc_registers[RTC_NUM_REGS_RD] = | |||
69 | 69 | ||
70 | /* was it an alarm that triggered power on ? */ | 70 | /* was it an alarm that triggered power on ? */ |
71 | static bool alarm_start = false; | 71 | static bool alarm_start = false; |
72 | static unsigned long rtc_is_dirty = 1; /* force a read right away */ | ||
72 | 73 | ||
73 | static const unsigned short month_table[13] = | 74 | static const unsigned short month_table[13] = |
74 | { | 75 | { |
@@ -96,6 +97,16 @@ static bool read_time_and_day(uint32_t regs[RTC_NUM_REGS_RD]) | |||
96 | return true; | 97 | return true; |
97 | } | 98 | } |
98 | 99 | ||
100 | void MC13783_EVENT_CB_1HZ(void) | ||
101 | { | ||
102 | rtc_is_dirty = 1; | ||
103 | } | ||
104 | |||
105 | bool rtc_mc13783_dirty(void) | ||
106 | { | ||
107 | return bitclr32(&rtc_is_dirty, 1); | ||
108 | } | ||
109 | |||
99 | /** Public APIs **/ | 110 | /** Public APIs **/ |
100 | void rtc_init(void) | 111 | void rtc_init(void) |
101 | { | 112 | { |
@@ -105,6 +116,8 @@ void rtc_init(void) | |||
105 | alarm_start = true; | 116 | alarm_start = true; |
106 | mc13783_write(MC13783_INTERRUPT_STATUS1, MC13783_TODAI); | 117 | mc13783_write(MC13783_INTERRUPT_STATUS1, MC13783_TODAI); |
107 | } | 118 | } |
119 | |||
120 | mc13783_enable_event(MC13783_INT_ID_1HZ, true); | ||
108 | } | 121 | } |
109 | 122 | ||
110 | int rtc_read_datetime(struct tm *tm) | 123 | int rtc_read_datetime(struct tm *tm) |