Skip to content

Commit

Permalink
generic: Improve e-h 1.0 Delay impl
Browse files Browse the repository at this point in the history
This is a follow-up to commit 403cf3b / PR #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)
  • Loading branch information
rursprung authored Feb 13, 2024
1 parent b2be3f9 commit 998f4df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion avr-hal-generic/src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl<SPEED> DelayNs for Delay<SPEED>
fn delay_ns(&mut self, ns: u32) {
// quick-win to get an initial implementation.
// note that the trait does not guarantee nanosecond-accuracy.
delay_v0::DelayUs::<u32>::delay_us(self, ns.saturating_add(999) / 1000)
delay_v0::DelayUs::<u32>::delay_us(self, ns.div_ceil(1000))
}

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

0 comments on commit 998f4df

Please sign in to comment.