aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/timer.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-nrf/src/timer.rs')
-rw-r--r--embassy-nrf/src/timer.rs16
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 @@
3use core::marker::PhantomData; 3use core::marker::PhantomData;
4use core::task::Poll; 4use core::task::Poll;
5 5
6use crate::interrupt::Interrupt;
7use crate::interrupt::InterruptExt;
8use crate::Unborrow;
9use embassy::waitqueue::AtomicWaker; 6use embassy::waitqueue::AtomicWaker;
10use embassy_hal_common::drop::OnDrop; 7use embassy_hal_common::drop::OnDrop;
11use embassy_hal_common::unborrow; 8use embassy_hal_common::unborrow;
12use futures::future::poll_fn; 9use futures::future::poll_fn;
13 10
14use crate::pac; 11use crate::interrupt::{Interrupt, InterruptExt};
15use crate::ppi::{Event, Task}; 12use crate::ppi::{Event, Task};
13use crate::{pac, Unborrow};
16 14
17pub(crate) mod sealed { 15pub(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,