Skip to content

Commit

Permalink
add embedded-hal-async impl to stm32
Browse files Browse the repository at this point in the history
  • Loading branch information
andresv authored and korken89 committed Sep 6, 2023
1 parent 7dcc59d commit 54aec9b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions rtic-monotonics/src/stm32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,19 @@ macro_rules! make_timer {
}
}

#[cfg(feature = "embedded-hal-async")]
impl embedded_hal_async::delay::DelayUs for $mono_name {
#[inline]
async fn delay_us(&mut self, us: u32) {
Self::delay((us as u64).micros()).await;
}

#[inline]
async fn delay_ms(&mut self, ms: u32) {
Self::delay((ms as u64).millis()).await;
}
}

impl Monotonic for $mono_name {
type Instant = fugit::TimerInstantU64<TIMER_HZ>;
type Duration = fugit::TimerDurationU64<TIMER_HZ>;
Expand Down

0 comments on commit 54aec9b

Please sign in to comment.