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.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs
index 5690ff0d8..066609ec6 100644
--- a/embassy-nrf/src/timer.rs
+++ b/embassy-nrf/src/timer.rs
@@ -15,6 +15,11 @@ use crate::pac;
15use crate::ppi::Event; 15use crate::ppi::Event;
16use crate::ppi::Task; 16use crate::ppi::Task;
17 17
18#[cfg(not(feature = "nrf9160"))]
19pub(crate) use pac::timer0;
20#[cfg(feature = "nrf9160")]
21pub(crate) use pac::timer0_ns as timer0;
22
18pub(crate) mod sealed { 23pub(crate) mod sealed {
19 24
20 use super::*; 25 use super::*;
@@ -22,7 +27,7 @@ pub(crate) mod sealed {
22 pub trait Instance { 27 pub trait Instance {
23 /// The number of CC registers this instance has. 28 /// The number of CC registers this instance has.
24 const CCS: usize; 29 const CCS: usize;
25 fn regs() -> &'static pac::timer0::RegisterBlock; 30 fn regs() -> &'static timer0::RegisterBlock;
26 /// Storage for the waker for CC register `n`. 31 /// Storage for the waker for CC register `n`.
27 fn waker(n: usize) -> &'static AtomicWaker; 32 fn waker(n: usize) -> &'static AtomicWaker;
28 } 33 }
@@ -40,8 +45,8 @@ macro_rules! impl_timer {
40 ($type:ident, $pac_type:ident, $irq:ident, $ccs:literal) => { 45 ($type:ident, $pac_type:ident, $irq:ident, $ccs:literal) => {
41 impl crate::timer::sealed::Instance for peripherals::$type { 46 impl crate::timer::sealed::Instance for peripherals::$type {
42 const CCS: usize = $ccs; 47 const CCS: usize = $ccs;
43 fn regs() -> &'static pac::timer0::RegisterBlock { 48 fn regs() -> &'static crate::timer::timer0::RegisterBlock {
44 unsafe { &*(pac::$pac_type::ptr() as *const pac::timer0::RegisterBlock) } 49 unsafe { &*(pac::$pac_type::ptr() as *const crate::timer::timer0::RegisterBlock) }
45 } 50 }
46 fn waker(n: usize) -> &'static ::embassy::waitqueue::AtomicWaker { 51 fn waker(n: usize) -> &'static ::embassy::waitqueue::AtomicWaker {
47 use ::embassy::waitqueue::AtomicWaker; 52 use ::embassy::waitqueue::AtomicWaker;