From 3b4be6a4147cf35d26062f802b2f339fcfda10da Mon Sep 17 00:00:00 2001 From: Astro Date: Sat, 25 Apr 2020 01:25:12 +0200 Subject: [PATCH] libasync: add mod delay --- libasync/src/delay.rs | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 libasync/src/delay.rs diff --git a/libasync/src/delay.rs b/libasync/src/delay.rs new file mode 100644 index 0000000..c87595c --- /dev/null +++ b/libasync/src/delay.rs @@ -0,0 +1,7 @@ +use embedded_hal::timer::CountDown; +use crate::block_async; + +pub async fn delay, C>(timer: &mut T, count: C) { + timer.start(count); + let _ = block_async!(timer.wait()).await; +}