aboutsummaryrefslogtreecommitdiff
path: root/embassy-time/src/timer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-time/src/timer.rs')
-rw-r--r--embassy-time/src/timer.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs
index ad5026e62..8996aefbc 100644
--- a/embassy-time/src/timer.rs
+++ b/embassy-time/src/timer.rs
@@ -133,7 +133,14 @@ impl Ticker {
133 Self { expires_at, duration } 133 Self { expires_at, duration }
134 } 134 }
135 135
136 /// Waits for the next tick 136 /// Resets the ticker back to its original state.
137 ///
138 /// This causes the ticker to go back to zero, even if the current tick isn't over yet.
139 pub fn reset(&mut self) {
140 self.expires_at = Instant::now() + self.duration;
141 }
142
143 /// Waits for the next tick.
137 pub fn next(&mut self) -> impl Future<Output = ()> + '_ { 144 pub fn next(&mut self) -> impl Future<Output = ()> + '_ {
138 poll_fn(|cx| { 145 poll_fn(|cx| {
139 if self.expires_at <= Instant::now() { 146 if self.expires_at <= Instant::now() {