diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-04-14 16:39:08 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-04-14 17:04:40 +0200 |
| commit | d336a4b38a3e5cef1337f39c657beab76b60640e (patch) | |
| tree | 8bfc5ec581dff0b0f9f6b72c999318cfea9cfecd | |
| parent | f292647066d2b693c1529faf409bbde060c26e12 (diff) | |
Remove Pin from Delay trait
| -rw-r--r-- | embassy-traits/src/delay.rs | 5 | ||||
| -rw-r--r-- | embassy/src/executor/timer.rs | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/embassy-traits/src/delay.rs b/embassy-traits/src/delay.rs index 1e763350b..31239d319 100644 --- a/embassy-traits/src/delay.rs +++ b/embassy-traits/src/delay.rs | |||
| @@ -1,12 +1,11 @@ | |||
| 1 | use core::future::Future; | 1 | use core::future::Future; |
| 2 | use core::pin::Pin; | ||
| 3 | 2 | ||
| 4 | pub trait Delay { | 3 | pub trait Delay { |
| 5 | type DelayFuture<'a>: Future<Output = ()> + 'a; | 4 | type DelayFuture<'a>: Future<Output = ()> + 'a; |
| 6 | 5 | ||
| 7 | /// Future that completes after now + millis | 6 | /// Future that completes after now + millis |
| 8 | fn delay_ms<'a>(self: Pin<&'a mut Self>, millis: u64) -> Self::DelayFuture<'a>; | 7 | fn delay_ms<'a>(&'a mut self, millis: u64) -> Self::DelayFuture<'a>; |
| 9 | 8 | ||
| 10 | /// Future that completes after now + micros | 9 | /// Future that completes after now + micros |
| 11 | fn delay_us<'a>(self: Pin<&'a mut Self>, micros: u64) -> Self::DelayFuture<'a>; | 10 | fn delay_us<'a>(&'a mut self, micros: u64) -> Self::DelayFuture<'a>; |
| 12 | } | 11 | } |
diff --git a/embassy/src/executor/timer.rs b/embassy/src/executor/timer.rs index 8297564a0..d66c7cae5 100644 --- a/embassy/src/executor/timer.rs +++ b/embassy/src/executor/timer.rs | |||
| @@ -23,10 +23,10 @@ impl Delay { | |||
| 23 | impl crate::traits::delay::Delay for Delay { | 23 | impl crate::traits::delay::Delay for Delay { |
| 24 | type DelayFuture<'a> = impl Future<Output = ()> + 'a; | 24 | type DelayFuture<'a> = impl Future<Output = ()> + 'a; |
| 25 | 25 | ||
| 26 | fn delay_ms<'a>(self: Pin<&'a mut Self>, millis: u64) -> Self::DelayFuture<'a> { | 26 | fn delay_ms<'a>(&'a mut self, millis: u64) -> Self::DelayFuture<'a> { |
| 27 | Timer::after(Duration::from_millis(millis)) | 27 | Timer::after(Duration::from_millis(millis)) |
| 28 | } | 28 | } |
| 29 | fn delay_us<'a>(self: Pin<&'a mut Self>, micros: u64) -> Self::DelayFuture<'a> { | 29 | fn delay_us<'a>(&'a mut self, micros: u64) -> Self::DelayFuture<'a> { |
| 30 | Timer::after(Duration::from_micros(micros)) | 30 | Timer::after(Duration::from_micros(micros)) |
| 31 | } | 31 | } |
| 32 | } | 32 | } |
