From a1bcfb469e8081e75dd2edd706a7701b354f4fe7 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 27 Apr 2021 00:40:29 +0800 Subject: [PATCH] add another call to make sure the RTC is initialized correctly --- services/rtc/src/main.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/services/rtc/src/main.rs b/services/rtc/src/main.rs index 779d653a4..16bf770dd 100644 --- a/services/rtc/src/main.rs +++ b/services/rtc/src/main.rs @@ -402,6 +402,9 @@ mod implementation { pub fn clear_wakeup_alarm(&mut self) { self.wakeup_alarm_enabled = false; + // make sure battery switchover is enabled, otherwise we won't keep time when power goes off + self.blocking_i2c_write2([ABRTCMC_CONTROL3, (Control3::BATT_STD_BL_EN).bits()]); + let mut config = Config::CLKOUT_DISABLE.bits(); if self.rtc_alarm_enabled { config |= (Config::TIMER_A_COUNTDWN | Config::TIMERA_SECONDS_INT_PULSED).bits();