diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-04-11 23:00:34 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2023-04-11 23:09:02 +0200 |
| commit | 8fd8ef9ca7f9b5e43ba983f506274ff05665f99b (patch) | |
| tree | 4175d39778e80e2324064936500e336b24e22536 | |
| parent | 9a677ab618aa7a7612cd079b77d3240bdb02fdac (diff) | |
nrf/timer: make `cc()` borrows less strict.
| -rw-r--r-- | embassy-nrf/src/timer.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs index 48b4f1b55..e9d2132c1 100644 --- a/embassy-nrf/src/timer.rs +++ b/embassy-nrf/src/timer.rs | |||
| @@ -213,13 +213,13 @@ impl<'d, T: Instance> Timer<'d, T> { | |||
| 213 | /// | 213 | /// |
| 214 | /// # Panics | 214 | /// # Panics |
| 215 | /// Panics if `n` >= the number of CC registers this timer has (4 for a normal timer, 6 for an extended timer). | 215 | /// Panics if `n` >= the number of CC registers this timer has (4 for a normal timer, 6 for an extended timer). |
| 216 | pub fn cc(&mut self, n: usize) -> Cc<T> { | 216 | pub fn cc(&self, n: usize) -> Cc<'d, T> { |
| 217 | if n >= T::CCS { | 217 | if n >= T::CCS { |
| 218 | panic!("Cannot get CC register {} of timer with {} CC registers.", n, T::CCS); | 218 | panic!("Cannot get CC register {} of timer with {} CC registers.", n, T::CCS); |
| 219 | } | 219 | } |
| 220 | Cc { | 220 | Cc { |
| 221 | n, | 221 | n, |
| 222 | _p: self._p.reborrow(), | 222 | _p: unsafe { self._p.clone_unchecked() }, |
| 223 | } | 223 | } |
| 224 | } | 224 | } |
| 225 | } | 225 | } |
