Skip to content

Commit

Permalink
remove inline on delay_us, and made u32 conversion syntax consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
David-OConnor committed Jun 12, 2021
1 parent d13ebd2 commit 7329f57
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ impl Delay {
}

/// Delay using the Cortex-M systick for a certain duration, in µs.
#[inline]
pub fn delay_us(&mut self, us: u32) {
let ticks = (us as u64) * (self.ahb_frequency as u64) / 1_000_000;

Expand Down Expand Up @@ -88,14 +87,14 @@ impl DelayMs<i32> for Delay {
impl DelayMs<u16> for Delay {
#[inline(always)]
fn delay_ms(&mut self, ms: u16) {
Delay::delay_ms(self, u32::from(ms));
Delay::delay_ms(self, ms as u32);
}
}

impl DelayMs<u8> for Delay {
#[inline(always)]
fn delay_ms(&mut self, ms: u8) {
Delay::delay_ms(self, u32::from(ms));
Delay::delay_ms(self, ms as u32);
}
}

Expand All @@ -118,13 +117,13 @@ impl DelayUs<i32> for Delay {
impl DelayUs<u16> for Delay {
#[inline(always)]
fn delay_us(&mut self, us: u16) {
Delay::delay_us(self, u32::from(us))
Delay::delay_us(self, us as u32)
}
}

impl DelayUs<u8> for Delay {
#[inline(always)]
fn delay_us(&mut self, us: u8) {
Delay::delay_us(self, u32::from(us))
Delay::delay_us(self, us as u32)
}
}

0 comments on commit 7329f57

Please sign in to comment.