diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-04-05 00:20:22 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2024-04-05 00:48:46 +0200 |
| commit | ab85eb4b60cd49ebcd43d2305f42327685f5e5a6 (patch) | |
| tree | 3c385a5703edcd1e791ec1934d3232dc4084ab2b /embassy-nrf/src/timer.rs | |
| parent | 0e1208947e89ea60bd1b5c85e4deb79efb94d89a (diff) | |
nrf: remove mod sealed.
Diffstat (limited to 'embassy-nrf/src/timer.rs')
| -rw-r--r-- | embassy-nrf/src/timer.rs | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/embassy-nrf/src/timer.rs b/embassy-nrf/src/timer.rs index 2970ad3f2..ac5328ded 100644 --- a/embassy-nrf/src/timer.rs +++ b/embassy-nrf/src/timer.rs | |||
| @@ -11,30 +11,25 @@ use embassy_hal_internal::{into_ref, PeripheralRef}; | |||
| 11 | use crate::ppi::{Event, Task}; | 11 | use crate::ppi::{Event, Task}; |
| 12 | use crate::{pac, Peripheral}; | 12 | use crate::{pac, Peripheral}; |
| 13 | 13 | ||
| 14 | pub(crate) mod sealed { | 14 | pub(crate) trait SealedInstance { |
| 15 | 15 | /// The number of CC registers this instance has. | |
| 16 | use super::*; | 16 | const CCS: usize; |
| 17 | 17 | fn regs() -> &'static pac::timer0::RegisterBlock; | |
| 18 | pub trait Instance { | ||
| 19 | /// The number of CC registers this instance has. | ||
| 20 | const CCS: usize; | ||
| 21 | fn regs() -> &'static pac::timer0::RegisterBlock; | ||
| 22 | } | ||
| 23 | pub trait ExtendedInstance {} | ||
| 24 | } | 18 | } |
| 25 | 19 | ||
| 26 | /// Basic Timer instance. | 20 | /// Basic Timer instance. |
| 27 | pub trait Instance: Peripheral<P = Self> + sealed::Instance + 'static + Send { | 21 | #[allow(private_bounds)] |
| 22 | pub trait Instance: Peripheral<P = Self> + SealedInstance + 'static + Send { | ||
| 28 | /// Interrupt for this peripheral. | 23 | /// Interrupt for this peripheral. |
| 29 | type Interrupt: crate::interrupt::typelevel::Interrupt; | 24 | type Interrupt: crate::interrupt::typelevel::Interrupt; |
| 30 | } | 25 | } |
| 31 | 26 | ||
| 32 | /// Extended timer instance. | 27 | /// Extended timer instance. |
| 33 | pub trait ExtendedInstance: Instance + sealed::ExtendedInstance {} | 28 | pub trait ExtendedInstance: Instance {} |
| 34 | 29 | ||
| 35 | macro_rules! impl_timer { | 30 | macro_rules! impl_timer { |
| 36 | ($type:ident, $pac_type:ident, $irq:ident, $ccs:literal) => { | 31 | ($type:ident, $pac_type:ident, $irq:ident, $ccs:literal) => { |
| 37 | impl crate::timer::sealed::Instance for peripherals::$type { | 32 | impl crate::timer::SealedInstance for peripherals::$type { |
| 38 | const CCS: usize = $ccs; | 33 | const CCS: usize = $ccs; |
| 39 | fn regs() -> &'static pac::timer0::RegisterBlock { | 34 | fn regs() -> &'static pac::timer0::RegisterBlock { |
| 40 | unsafe { &*(pac::$pac_type::ptr() as *const pac::timer0::RegisterBlock) } | 35 | unsafe { &*(pac::$pac_type::ptr() as *const pac::timer0::RegisterBlock) } |
| @@ -49,7 +44,6 @@ macro_rules! impl_timer { | |||
| 49 | }; | 44 | }; |
| 50 | ($type:ident, $pac_type:ident, $irq:ident, extended) => { | 45 | ($type:ident, $pac_type:ident, $irq:ident, extended) => { |
| 51 | impl_timer!($type, $pac_type, $irq, 6); | 46 | impl_timer!($type, $pac_type, $irq, 6); |
| 52 | impl crate::timer::sealed::ExtendedInstance for peripherals::$type {} | ||
| 53 | impl crate::timer::ExtendedInstance for peripherals::$type {} | 47 | impl crate::timer::ExtendedInstance for peripherals::$type {} |
| 54 | }; | 48 | }; |
| 55 | } | 49 | } |
