diff options
Diffstat (limited to 'embassy-nrf/src/timer.rs')
| -rw-r--r-- | embassy-nrf/src/timer.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs index b6a77bd2e..5d6afe49b 100644 --- a/embassy-nrf/src/timer.rs +++ b/embassy-nrf/src/timer.rs | |||
| @@ -218,6 +218,15 @@ impl<'d, T: Instance> Timer<'d, T> { | |||
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | impl<T: Instance> Timer<'static, T> { | ||
| 222 | /// Persist the timer's configuration for the rest of the program's lifetime. This method | ||
| 223 | /// should be preferred over [`core::mem::forget()`] because the `'static` bound prevents | ||
| 224 | /// accidental reuse of the underlying peripheral. | ||
| 225 | pub fn persist(self) { | ||
| 226 | core::mem::forget(self); | ||
| 227 | } | ||
| 228 | } | ||
| 229 | |||
| 221 | impl<'d, T: Instance> Drop for Timer<'d, T> { | 230 | impl<'d, T: Instance> Drop for Timer<'d, T> { |
| 222 | fn drop(&mut self) { | 231 | fn drop(&mut self) { |
| 223 | self.stop(); | 232 | self.stop(); |
