aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-time/src/timer.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs
index 574d715da..3444d3e24 100644
--- a/embassy-time/src/timer.rs
+++ b/embassy-time/src/timer.rs
@@ -184,6 +184,16 @@ impl Ticker {
184 self.expires_at = Instant::now() + self.duration; 184 self.expires_at = Instant::now() + self.duration;
185 } 185 }
186 186
187 /// Reset the ticker to fire for the next time on the deadline.
188 pub fn reset_at(&mut self, deadline: Instant) {
189 self.expires_at = deadline;
190 }
191
192 /// Resets the ticker, after the specified duration has passed.
193 pub fn reset_after(&mut self, after: Duration) {
194 self.expires_at = Instant::now() + after;
195 }
196
187 /// Waits for the next tick. 197 /// Waits for the next tick.
188 pub fn next(&mut self) -> impl Future<Output = ()> + '_ { 198 pub fn next(&mut self) -> impl Future<Output = ()> + '_ {
189 poll_fn(|cx| { 199 poll_fn(|cx| {