Skip to content

Commit 82ee741

Browse files
committed
fix now for SysCounter
1 parent e1b045b commit 82ee741

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/timer/counter.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@ impl<const FREQ: u32> SysCounter<FREQ> {
261261
}
262262

263263
pub fn now(&self) -> TimerInstantU32<FREQ> {
264-
TimerInstantU32::from_ticks(SYST::get_current() / (self.clk.raw() / FREQ))
264+
TimerInstantU32::from_ticks(
265+
(SYST::get_current() - SYST::get_reload()) / (self.clk.raw() / FREQ),
266+
)
265267
}
266268

267269
pub fn start(&mut self, timeout: TimerDurationU32<FREQ>) -> Result<(), Error> {

0 commit comments

Comments
 (0)