diff options
| author | Frostie314159 <[email protected]> | 2023-12-11 16:11:57 +0100 |
|---|---|---|
| committer | Frostie314159 <[email protected]> | 2023-12-11 16:11:57 +0100 |
| commit | 8707462ec23807782796fbac4295bc5bce9ff136 (patch) | |
| tree | 402f89544c225ef554451ebb047eaceb463d764a /embassy-time/src | |
| parent | 663fa2addd30463328f6186e14f98680b4a35c9b (diff) | |
Adjusted documentation and reset_after behaviour.
Diffstat (limited to 'embassy-time/src')
| -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. |
