Skip to content

Commit 1c8dec5

Browse files
committed
set a long reload in clear_compare_flag()
In extend=true, the reload interrupt is not disabled (for overflow detection), the previous `set_compare()` may have been called with a short interval, then, if the queue is empty, the reload interrupt would fire at very short interval.
1 parent 23be86d commit 1c8dec5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,11 @@ impl<const TIMER_HZ: u32> Monotonic for DwtSystick<TIMER_HZ> {
126126

127127
#[inline(always)]
128128
fn clear_compare_flag(&mut self) {
129-
// NOOP with SysTick interrupt
129+
// Set a long reload in case `set_compare()` is not called again.
130+
#[cfg(feature = "extend")]
131+
self.systick.set_reload(0xff_ffff);
132+
#[cfg(feature = "extend")]
133+
self.systick.clear_current();
130134
}
131135

132136
#[cfg(feature = "extend")]

0 commit comments

Comments
 (0)