Skip to content

Commit

Permalink
Merge pull request #3592 from bugadani/fix
Browse files Browse the repository at this point in the history
stm32: Fix low-power time driver
  • Loading branch information
Dirbaio authored Dec 1, 2024
2 parents 1a1d5c4 + efee037 commit 67579dd
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions embassy-stm32/src/time_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,11 +410,14 @@ impl RtcDriver {
regs_gp16().cnt().write(|w| w.set_cnt(cnt as u16));

// Now, recompute all alarms
for i in 0..ALARM_COUNT {
for i in 0..self.alarm_count.load(Ordering::Relaxed) as usize {
let alarm_handle = unsafe { AlarmHandle::new(i as u8) };
let alarm = self.get_alarm(cs, alarm_handle);

self.set_alarm(alarm_handle, alarm.timestamp.get());
if !self.set_alarm(alarm_handle, alarm.timestamp.get()) {
// If the alarm timestamp has passed, we need to trigger it
self.trigger_alarm(i, cs);
}
}
}

Expand Down

0 comments on commit 67579dd

Please sign in to comment.