diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index f74b5cb2..416830a7 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs @@ -3,7 +3,7 @@ use core::pin::Pin; use core::task::{Context, Poll, Waker}; use futures_util::future::{select, Either}; -use futures_util::{pin_mut, Stream}; +use futures_util::{pin_mut, Stream, StreamExt}; use crate::{Duration, Instant}; @@ -132,6 +132,11 @@ impl Ticker { let expires_at = Instant::now() + duration; Self { expires_at, duration } } + + /// Waits for the next tick + pub async fn next(&mut self) { + ::next(self).await; + } } impl Unpin for Ticker {}