aboutsummaryrefslogtreecommitdiff
path: root/embassy-time/src
diff options
context:
space:
mode:
author823984418 <[email protected]>2025-08-17 22:18:04 +0800
committer823984418 <[email protected]>2025-08-17 22:18:04 +0800
commit011c382b7785485b632d567d941ff670797a0d74 (patch)
treead07efa22ad021234178206b2abc3271cd4428c9 /embassy-time/src
parentbfe4395b3b9792bb79363e2f32a9ab7bf69bb78d (diff)
modify async fn to return impl Future
Diffstat (limited to 'embassy-time/src')
-rw-r--r--embassy-time/src/delay.rs14
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 @@
1use core::future::Future;
2
1use super::{Duration, Instant}; 3use super::{Duration, Instant};
2use crate::Timer; 4use crate::Timer;
3 5
@@ -32,16 +34,16 @@ impl embedded_hal_1::delay::DelayNs for Delay {
32} 34}
33 35
34impl embedded_hal_async::delay::DelayNs for Delay { 36impl 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