zc706/libasync/src/delay.rs

8 lines
204 B
Rust
Raw Normal View History

2020-04-25 07:25:12 +08:00
use embedded_hal::timer::CountDown;
use crate::block_async;
pub async fn delay<T: CountDown<Time=C>, C>(timer: &mut T, count: C) {
timer.start(count);
let _ = block_async!(timer.wait()).await;
}