diff options
Diffstat (limited to 'embassy-nrf/src/timer.rs')
| -rw-r--r-- | embassy-nrf/src/timer.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs index 588654f96..c8c36dfae 100644 --- a/embassy-nrf/src/timer.rs +++ b/embassy-nrf/src/timer.rs | |||
| @@ -3,16 +3,14 @@ | |||
| 3 | use core::marker::PhantomData; | 3 | use core::marker::PhantomData; |
| 4 | use core::task::Poll; | 4 | use core::task::Poll; |
| 5 | 5 | ||
| 6 | use crate::interrupt::Interrupt; | ||
| 7 | use crate::interrupt::InterruptExt; | ||
| 8 | use crate::Unborrow; | ||
| 9 | use embassy::waitqueue::AtomicWaker; | 6 | use embassy::waitqueue::AtomicWaker; |
| 10 | use embassy_hal_common::drop::OnDrop; | 7 | use embassy_hal_common::drop::OnDrop; |
| 11 | use embassy_hal_common::unborrow; | 8 | use embassy_hal_common::unborrow; |
| 12 | use futures::future::poll_fn; | 9 | use futures::future::poll_fn; |
| 13 | 10 | ||
| 14 | use crate::pac; | 11 | use crate::interrupt::{Interrupt, InterruptExt}; |
| 15 | use crate::ppi::{Event, Task}; | 12 | use crate::ppi::{Event, Task}; |
| 13 | use crate::{pac, Unborrow}; | ||
| 16 | 14 | ||
| 17 | pub(crate) mod sealed { | 15 | pub(crate) mod sealed { |
| 18 | 16 | ||
| @@ -131,9 +129,7 @@ impl<'d, T: Instance, I: TimerType> Timer<'d, T, I> { | |||
| 131 | fn new_irqless(_timer: impl Unborrow<Target = T> + 'd) -> Self { | 129 | fn new_irqless(_timer: impl Unborrow<Target = T> + 'd) -> Self { |
| 132 | let regs = T::regs(); | 130 | let regs = T::regs(); |
| 133 | 131 | ||
| 134 | let mut this = Self { | 132 | let mut this = Self { phantom: PhantomData }; |
| 135 | phantom: PhantomData, | ||
| 136 | }; | ||
| 137 | 133 | ||
| 138 | // Stop the timer before doing anything else, | 134 | // Stop the timer before doing anything else, |
| 139 | // since changing BITMODE while running can cause 'unpredictable behaviour' according to the specification. | 135 | // since changing BITMODE while running can cause 'unpredictable behaviour' according to the specification. |
| @@ -233,11 +229,7 @@ impl<'d, T: Instance, I: TimerType> Timer<'d, T, I> { | |||
| 233 | /// Panics if `n` >= the number of CC registers this timer has (4 for a normal timer, 6 for an extended timer). | 229 | /// Panics if `n` >= the number of CC registers this timer has (4 for a normal timer, 6 for an extended timer). |
| 234 | pub fn cc(&mut self, n: usize) -> Cc<T, I> { | 230 | pub fn cc(&mut self, n: usize) -> Cc<T, I> { |
| 235 | if n >= T::CCS { | 231 | if n >= T::CCS { |
| 236 | panic!( | 232 | panic!("Cannot get CC register {} of timer with {} CC registers.", n, T::CCS); |
| 237 | "Cannot get CC register {} of timer with {} CC registers.", | ||
| 238 | n, | ||
| 239 | T::CCS | ||
| 240 | ); | ||
| 241 | } | 233 | } |
| 242 | Cc { | 234 | Cc { |
| 243 | n, | 235 | n, |
