diff options
| -rw-r--r-- | embassy-time/src/timer.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/embassy-time/src/timer.rs b/embassy-time/src/timer.rs index 3444d3e24..fe0e93951 100644 --- a/embassy-time/src/timer.rs +++ b/embassy-time/src/timer.rs | |||
| @@ -185,13 +185,15 @@ impl Ticker { | |||
| 185 | } | 185 | } |
| 186 | 186 | ||
| 187 | /// Reset the ticker to fire for the next time on the deadline. | 187 | /// Reset the ticker to fire for the next time on the deadline. |
| 188 | /// If the deadline is in the past, the ticker will fire instantly. | ||
| 188 | pub fn reset_at(&mut self, deadline: Instant) { | 189 | pub fn reset_at(&mut self, deadline: Instant) { |
| 189 | self.expires_at = deadline; | 190 | self.expires_at = deadline; |
| 190 | } | 191 | } |
| 191 | 192 | ||
| 192 | /// Resets the ticker, after the specified duration has passed. | 193 | /// Resets the ticker, after the specified duration has passed. |
| 194 | /// If the specified duration is zero, the next tick will be after the duration of the ticker. | ||
| 193 | pub fn reset_after(&mut self, after: Duration) { | 195 | pub fn reset_after(&mut self, after: Duration) { |
| 194 | self.expires_at = Instant::now() + after; | 196 | self.expires_at = Instant::now() + after + self.duration; |
| 195 | } | 197 | } |
| 196 | 198 | ||
| 197 | /// Waits for the next tick. | 199 | /// Waits for the next tick. |
