modify async fn to return impl Future

This commit is contained in:
823984418 2025-08-17 22:18:04 +08:00
parent bfe4395b3b
commit 011c382b77

View File

@ -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<Output = ()> {
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<Output = ()> {
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<Output = ()> {
Timer::after_millis(ms as _)
}
}