Skip to content
Snippets Groups Projects
Commit 5fafd04b authored by Jana Dönszelmann's avatar Jana Dönszelmann :sparkling_heart:
Browse files

Merge branch 'wait_for_tick_fix' into 'main'

Fix loops running quicker than timer

See merge request !7
parents a658fff7 7b6abcf4
Branches
No related tags found
1 merge request!7Fix loops running quicker than timer
Pipeline #819839 passed
......@@ -181,6 +181,18 @@ unsafe fn RTC0() {
/// Wait for the next interrupt configured by `set_interrupt_frequency`.
pub fn wait_for_next_tick() {
if RTC.modify(|rtc| {
if rtc.is_event_triggered(RtcInterrupt::Compare0) {
// the compare register has already triggered
TIMER_FLAG.store(false, Ordering::SeqCst);
true
} else {
false
}
}) {
return;
}
while !TIMER_FLAG.load(Ordering::SeqCst) {
cortex_m::asm::wfi();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment