aboutsummaryrefslogtreecommitdiff
path: root/embassy-time
diff options
context:
space:
mode:
authorGabriel Smith <[email protected]>2022-11-27 17:59:01 -0500
committerGabriel Smith <[email protected]>2022-11-27 17:59:01 -0500
commitaedcc472c9fa133f73fcf3a6139d178c81159452 (patch)
treed7503c53a918194003f6ee2af576d2af72a729f2 /embassy-time
parent4d84b5469ece6e7ad1597b6da41972a0ea391672 (diff)
time: Fix nighly feature compilation after upgrade to embedded-hal-async
0.2.0-alpha.0
Diffstat (limited to 'embassy-time')
-rw-r--r--embassy-time/src/delay.rs16
-rw-r--r--embassy-time/src/lib.rs3
2 files changed, 6 insertions, 13 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"))]
35mod eha { 35mod 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}
diff --git a/embassy-time/src/lib.rs b/embassy-time/src/lib.rs
index 586aa28de..8b0aebe19 100644
--- a/embassy-time/src/lib.rs
+++ b/embassy-time/src/lib.rs
@@ -1,5 +1,6 @@
1#![cfg_attr(not(any(feature = "std", feature = "wasm", test)), no_std)] 1#![cfg_attr(not(any(feature = "std", feature = "wasm", test)), no_std)]
2#![cfg_attr(feature = "nightly", feature(type_alias_impl_trait))] 2#![cfg_attr(feature = "nightly", feature(async_fn_in_trait))]
3#![cfg_attr(feature = "nightly", allow(incomplete_features))]
3#![doc = include_str!("../README.md")] 4#![doc = include_str!("../README.md")]
4#![allow(clippy::new_without_default)] 5#![allow(clippy::new_without_default)]
5#![warn(missing_docs)] 6#![warn(missing_docs)]