Skip to content

Commit 21a4163

Browse files
committed
improve e-h 1.0 Delay impl
this is a follow-up to commit 403cf3b / PR Rahix#492, based on a review comment by @jannic on cortex-m (see PR [cortex-m#504]). [cortex-m#504]: rust-embedded/cortex-m#504 (comment)
1 parent b2be3f9 commit 21a4163

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

avr-hal-generic/src/delay.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ impl<SPEED> DelayNs for Delay<SPEED>
301301
fn delay_ns(&mut self, ns: u32) {
302302
// quick-win to get an initial implementation.
303303
// note that the trait does not guarantee nanosecond-accuracy.
304-
delay_v0::DelayUs::<u32>::delay_us(self, ns.saturating_add(999) / 1000)
304+
delay_v0::DelayUs::<u32>::delay_us(self, ns.div_ceil(1000))
305305
}
306306

307307
fn delay_us(&mut self, us: u32) {

0 commit comments

Comments
 (0)