Skip to content

Commit

Permalink
extend ticks calculation in timer start from u32 to u64
Browse files Browse the repository at this point in the history
  • Loading branch information
apatrushev committed Sep 4, 2023
1 parent dac158e commit 7228f08
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ where
let timeout: Self::Time = timeout.into();
let clock = TIM::clock(&self.clocks);

let ticks = clock.integer().saturating_mul(timeout.integer()) * *timeout.scaling_factor();
let ticks = (clock.integer() as u64).saturating_mul(timeout.integer() as u64) * *timeout.scaling_factor();

let psc: u32 = (ticks.saturating_sub(1)) / (1 << 16);
let psc = ticks.saturating_sub(1) / (1 << 16);
self.tim.set_psc(crate::unwrap!(u16::try_from(psc).ok()));

let mut arr = ticks / psc.saturating_add(1);
Expand Down

0 comments on commit 7228f08

Please sign in to comment.