We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 42ebfe5 commit 5b485aeCopy full SHA for 5b485ae
rtic-monotonics/src/stm32.rs
@@ -238,8 +238,8 @@ macro_rules! make_timer {
238
$timer.cr1().modify(|r| r.set_cen(false));
239
240
assert!((tim_clock_hz % timer_hz) == 0, "Unable to find suitable timer prescaler value!");
241
- let psc = tim_clock_hz / timer_hz - 1;
242
- $timer.psc().write(|r| r.set_psc(psc as u16));
+ let psc = u16::try_from(tim_clock_hz / timer_hz - 1).expect("Clock prescaler overflowed!");
+ $timer.psc().write(|r| r.set_psc(psc));
243
244
// Enable full-period interrupt.
245
$timer.dier().modify(|r| r.set_uie(true));
0 commit comments