From 011c382b7785485b632d567d941ff670797a0d74 Mon Sep 17 00:00:00 2001 From: 823984418 <823984418@qq.com> Date: Sun, 17 Aug 2025 22:18:04 +0800 Subject: [PATCH] modify async fn to return impl Future --- embassy-time/src/delay.rs | 14 ++++++++------ 1 file 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 @@ +use core::future::Future; + use super::{Duration, Instant}; use crate::Timer; @@ -32,16 +34,16 @@ impl embedded_hal_1::delay::DelayNs for Delay { } impl embedded_hal_async::delay::DelayNs for Delay { - async fn delay_ns(&mut self, ns: u32) { - Timer::after_nanos(ns as _).await + fn delay_ns(&mut self, ns: u32) -> impl Future { + Timer::after_nanos(ns as _) } - async fn delay_us(&mut self, us: u32) { - Timer::after_micros(us as _).await + fn delay_us(&mut self, us: u32) -> impl Future { + Timer::after_micros(us as _) } - async fn delay_ms(&mut self, ms: u32) { - Timer::after_millis(ms as _).await + fn delay_ms(&mut self, ms: u32) -> impl Future { + Timer::after_millis(ms as _) } }