diff options
| author | Gabriel Smith <[email protected]> | 2022-11-27 17:59:01 -0500 |
|---|---|---|
| committer | Gabriel Smith <[email protected]> | 2022-11-27 17:59:01 -0500 |
| commit | aedcc472c9fa133f73fcf3a6139d178c81159452 (patch) | |
| tree | d7503c53a918194003f6ee2af576d2af72a729f2 /embassy-time/src/delay.rs | |
| parent | 4d84b5469ece6e7ad1597b6da41972a0ea391672 (diff) | |
time: Fix nighly feature compilation after upgrade to embedded-hal-async
0.2.0-alpha.0
Diffstat (limited to 'embassy-time/src/delay.rs')
| -rw-r--r-- | embassy-time/src/delay.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/embassy-time/src/delay.rs b/embassy-time/src/delay.rs index ff6b6869a..0ca176abd 100644 --- a/embassy-time/src/delay.rs +++ b/embassy-time/src/delay.rs | |||
| @@ -33,26 +33,18 @@ mod eh1 { | |||
| 33 | 33 | ||
| 34 | #[cfg(all(feature = "unstable-traits", feature = "nightly"))] | 34 | #[cfg(all(feature = "unstable-traits", feature = "nightly"))] |
| 35 | mod eha { | 35 | mod eha { |
| 36 | use core::future::Future; | ||
| 37 | |||
| 38 | use futures_util::FutureExt; | ||
| 39 | |||
| 40 | use super::*; | 36 | use super::*; |
| 41 | use crate::Timer; | 37 | use crate::Timer; |
| 42 | 38 | ||
| 43 | impl embedded_hal_async::delay::DelayUs for Delay { | 39 | impl embedded_hal_async::delay::DelayUs for Delay { |
| 44 | type Error = core::convert::Infallible; | 40 | type Error = core::convert::Infallible; |
| 45 | 41 | ||
| 46 | type DelayUsFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 42 | async fn delay_us(&mut self, micros: u32) -> Result<(), Self::Error> { |
| 47 | 43 | Ok(Timer::after(Duration::from_micros(micros as _)).await) | |
| 48 | fn delay_us(&mut self, micros: u32) -> Self::DelayUsFuture<'_> { | ||
| 49 | Timer::after(Duration::from_micros(micros as _)).map(Ok) | ||
| 50 | } | 44 | } |
| 51 | 45 | ||
| 52 | type DelayMsFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; | 46 | async fn delay_ms(&mut self, millis: u32) -> Result<(), Self::Error> { |
| 53 | 47 | Ok(Timer::after(Duration::from_millis(millis as _)).await) | |
| 54 | fn delay_ms(&mut self, millis: u32) -> Self::DelayMsFuture<'_> { | ||
| 55 | Timer::after(Duration::from_millis(millis as _)).map(Ok) | ||
| 56 | } | 48 | } |
| 57 | } | 49 | } |
| 58 | } | 50 | } |
