Skip to content

Commit

Permalink
Fix compilation with MSRV
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed Dec 19, 2023
1 parent d1289bb commit 130c9eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rp2040-hal/src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ impl eh1_0_alpha::delay::DelayNs for Timer {
// For now, just use microsecond delay, internally. Of course, this
// might cause a much longer delay than necessary. So a more advanced
// implementation would be desirable for sub-microsecond delays.
let us = ns.div_ceil(1000);
let us = ns / 1000 + if ns % 1000 == 0 { 0 } else { 1 };
// With rustc 1.73, this can be replaced by:
// let us = ns.div_ceil(1000);
self.delay_us_internal(us)
}

Expand Down

0 comments on commit 130c9eb

Please sign in to comment.