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.
2 parents ec9534f + ce75aa5 commit 30f950cCopy full SHA for 30f950c
src/timer/pwm.rs
@@ -56,7 +56,7 @@ macro_rules! pwm {
56
rcc.rb.$apbXrstr.modify(|_, w| w.$timXrst().clear_bit());
57
let ratio = rcc.clocks.apb_tim_clk / freq.into();
58
let psc = (ratio - 1) / 0xffff;
59
- let arr = ratio / (psc + 1);
+ let arr = ratio / (psc + 1) - 1;
60
tim.psc.write(|w| unsafe { w.psc().bits(psc as u16) });
61
tim.arr.write(|w| unsafe { w.$arr().bits(arr as u16) });
62
$(
0 commit comments