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 a68a3a1 commit 4dfb642Copy full SHA for 4dfb642
src/timer/delay.rs
@@ -110,7 +110,10 @@ pub type DelayMs<TIM> = Delay<TIM, 1_000>;
110
impl<TIM: Instance, const FREQ: u32> Delay<TIM, FREQ> {
111
/// Sleep for given time
112
pub fn delay(&mut self, time: TimerDurationU32<FREQ>) {
113
- let mut ticks = time.ticks().max(1) - 1;
+ let mut ticks = time.ticks();
114
+ if ticks > 1 {
115
+ ticks -= 1;
116
+ }
117
while ticks != 0 {
118
let reload = ticks.min(TIM::max_auto_reload());
119
0 commit comments