diff options
Diffstat (limited to 'embassy-time/src/delay.rs')
| -rw-r--r-- | embassy-time/src/delay.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/embassy-time/src/delay.rs b/embassy-time/src/delay.rs index 67345f726..11b54b098 100644 --- a/embassy-time/src/delay.rs +++ b/embassy-time/src/delay.rs | |||
| @@ -1,3 +1,5 @@ | |||
| 1 | use core::future::Future; | ||
| 2 | |||
| 1 | use super::{Duration, Instant}; | 3 | use super::{Duration, Instant}; |
| 2 | use crate::Timer; | 4 | use crate::Timer; |
| 3 | 5 | ||
| @@ -32,16 +34,16 @@ impl embedded_hal_1::delay::DelayNs for Delay { | |||
| 32 | } | 34 | } |
| 33 | 35 | ||
| 34 | impl embedded_hal_async::delay::DelayNs for Delay { | 36 | impl embedded_hal_async::delay::DelayNs for Delay { |
| 35 | async fn delay_ns(&mut self, ns: u32) { | 37 | fn delay_ns(&mut self, ns: u32) -> impl Future<Output = ()> { |
| 36 | Timer::after_nanos(ns as _).await | 38 | Timer::after_nanos(ns as _) |
| 37 | } | 39 | } |
| 38 | 40 | ||
| 39 | async fn delay_us(&mut self, us: u32) { | 41 | fn delay_us(&mut self, us: u32) -> impl Future<Output = ()> { |
| 40 | Timer::after_micros(us as _).await | 42 | Timer::after_micros(us as _) |
| 41 | } | 43 | } |
| 42 | 44 | ||
| 43 | async fn delay_ms(&mut self, ms: u32) { | 45 | fn delay_ms(&mut self, ms: u32) -> impl Future<Output = ()> { |
| 44 | Timer::after_millis(ms as _).await | 46 | Timer::after_millis(ms as _) |
| 45 | } | 47 | } |
| 46 | } | 48 | } |
| 47 | 49 | ||
