stm32/rtc: use psc to compute instants

This commit is contained in:
xoviat
2023-08-27 16:06:33 -05:00
parent 88146eb53e
commit 9f928010a8
2 changed files with 19 additions and 38 deletions

View File

@ -110,7 +110,7 @@ impl super::Rtc {
trace!("rtc: start wakeup alarm for {} ms", duration.as_millis());
critical_section::with(|cs| assert!(self.stop_time.borrow(cs).replace(Some(RtcInstant::now())).is_none()))
critical_section::with(|cs| assert!(self.stop_time.borrow(cs).replace(Some(self.instant())).is_none()))
}
#[cfg(feature = "low-power")]
@ -132,7 +132,7 @@ impl super::Rtc {
critical_section::with(|cs| {
if let Some(stop_time) = self.stop_time.borrow(cs).take() {
Some(RtcInstant::now() - stop_time)
Some(self.instant() - stop_time)
} else {
None
}