1
0
Fork 0

libasync: add mod delay

This commit is contained in:
Astro 2020-04-25 01:25:12 +02:00
parent 88a2a2bc71
commit 3b4be6a414
1 changed files with 7 additions and 0 deletions

7
libasync/src/delay.rs Normal file
View File

@ -0,0 +1,7 @@
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;
}