aboutsummaryrefslogtreecommitdiff
path: root/embassy-time/src/timer.rs
diff options
context:
space:
mode:
authorTyler <[email protected]>2023-09-29 20:02:24 -0600
committerGitHub <[email protected]>2023-09-29 20:02:24 -0600
commit2f9b59c5cf21f1e2761a9ccefdfd86f0edea829c (patch)
tree8964744b4fb753cf98f6f413464106c4d2a72976 /embassy-time/src/timer.rs
parentce91fb2bfc846570ef543a09396c428d70675245 (diff)
parent95b3d9eb3b3657de3d7bc9c04f8fb83eae901640 (diff)
Merge branch 'main' into issue-1974-add-sai-driver
Diffstat (limited to 'embassy-time/src/timer.rs')
-rw-r--r--embassy-time/src/timer.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs
index ad5026e62..07ddf473f 100644
--- a/embassy-time/src/timer.rs
+++ b/embassy-time/src/timer.rs
@@ -133,7 +133,13 @@ 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 /// This causes the ticker to go back to zero, even if the current tick isn't over yet.
138 pub fn reset(&mut self) {
139 self.expires_at = Instant::now() + self.duration;
140 }
141
142 /// Waits for the next tick.
137 pub fn next(&mut self) -> impl Future<Output = ()> + '_ { 143 pub fn next(&mut self) -> impl Future<Output = ()> + '_ {
138 poll_fn(|cx| { 144 poll_fn(|cx| {
139 if self.expires_at <= Instant::now() { 145 if self.expires_at <= Instant::now() {