diff --git a/hal/Cargo.toml b/hal/Cargo.toml index 91fb55f5863..69bcbb82578 100644 --- a/hal/Cargo.toml +++ b/hal/Cargo.toml @@ -43,7 +43,7 @@ nb = "1.0" num-traits = {version = "0.2.14", default-features = false} opaque-debug = "0.3.0" paste = "1.0.11" -portable-atomic = {version = "1.5.0", optional = true, default-features = false} +portable-atomic = {version = "1.5.0", optional = true, default-features = false, features = ["critical-section"]} rand_core = "0.6" seq-macro = "0.3" typenum = "1.12.0" diff --git a/hal/src/async_hal/timer.rs b/hal/src/async_hal/timer.rs index d67d50f598b..99873f65be1 100644 --- a/hal/src/async_hal/timer.rs +++ b/hal/src/async_hal/timer.rs @@ -7,7 +7,7 @@ use core::{ use cortex_m::interrupt::InterruptNumber; use cortex_m_interrupt::NvicInterruptRegistration; use embassy_sync::waitqueue::AtomicWaker; -use fugit::{MicrosDurationU32, MillisDurationU32, NanosDurationU32}; +use fugit::NanosDurationU32; use portable_atomic::AtomicBool; #[cfg(feature = "thumbv6")] @@ -164,24 +164,13 @@ where } } -mod impl_ehal { - use super::*; - use embedded_hal_async::delay::DelayUs; - - impl DelayUs for TimerFuture - where - T: AsyncCount16, - I: InterruptNumber, - { - async fn delay_ms(&mut self, ms: u32) { - self.delay(MillisDurationU32::from_ticks(ms).convert()) - .await; - } - - async fn delay_us(&mut self, us: u32) { - self.delay(MicrosDurationU32::from_ticks(us).convert()) - .await; - } +impl embedded_hal_async::delay::DelayNs for TimerFuture +where + T: AsyncCount16, + I: InterruptNumber, +{ + async fn delay_ns(&mut self, ns: u32) { + self.delay(NanosDurationU32::from_ticks(ns).convert()).await; } }