From a2ec8f983c799dea0a6f57ba97431ded54fc6197 Mon Sep 17 00:00:00 2001 From: Nils Fitinghoff Date: Thu, 14 Sep 2023 16:47:52 +0200 Subject: rtic-monotonics: Implement blocking DelayUs from embedded-hal 1 --- rtic-monotonics/src/rp2040.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'rtic-monotonics/src/rp2040.rs') diff --git a/rtic-monotonics/src/rp2040.rs b/rtic-monotonics/src/rp2040.rs index 61bd1ff..43e6770 100644 --- a/rtic-monotonics/src/rp2040.rs +++ b/rtic-monotonics/src/rp2040.rs @@ -162,6 +162,13 @@ impl embedded_hal_async::delay::DelayUs for Timer { } } +impl embedded_hal::delay::DelayUs for Timer { + fn delay_us(&mut self, us: u32) { + let done = Self::now() + u64::from(us).micros(); + while Self::now() < done {} + } +} + /// Register the Timer interrupt for the monotonic. #[macro_export] macro_rules! create_rp2040_monotonic_token { -- cgit v1.2.3