diff options
| author | Dario Nieuwenhuis <[email protected]> | 2025-03-26 16:01:37 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2025-03-27 15:18:06 +0100 |
| commit | d41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch) | |
| tree | 678b6fc732216e529dc38e6f65b72a309917ac32 /embassy-nrf/src/ppi/dppi.rs | |
| parent | 9edf5b7f049f95742b60b041e4443967d8a6b708 (diff) | |
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-nrf/src/ppi/dppi.rs')
| -rw-r--r-- | embassy-nrf/src/ppi/dppi.rs | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/embassy-nrf/src/ppi/dppi.rs b/embassy-nrf/src/ppi/dppi.rs index 3c7b96df7..686f66987 100644 --- a/embassy-nrf/src/ppi/dppi.rs +++ b/embassy-nrf/src/ppi/dppi.rs | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | use embassy_hal_internal::into_ref; | ||
| 2 | |||
| 3 | use super::{Channel, ConfigurableChannel, Event, Ppi, Task}; | 1 | use super::{Channel, ConfigurableChannel, Event, Ppi, Task}; |
| 4 | use crate::{pac, Peripheral}; | 2 | use crate::{pac, Peri}; |
| 5 | 3 | ||
| 6 | const DPPI_ENABLE_BIT: u32 = 0x8000_0000; | 4 | const DPPI_ENABLE_BIT: u32 = 0x8000_0000; |
| 7 | const DPPI_CHANNEL_MASK: u32 = 0x0000_00FF; | 5 | const DPPI_CHANNEL_MASK: u32 = 0x0000_00FF; |
| @@ -12,14 +10,14 @@ pub(crate) fn regs() -> pac::dppic::Dppic { | |||
| 12 | 10 | ||
| 13 | impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 1> { | 11 | impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 1> { |
| 14 | /// Configure PPI channel to trigger `task` on `event`. | 12 | /// Configure PPI channel to trigger `task` on `event`. |
| 15 | pub fn new_one_to_one(ch: impl Peripheral<P = C> + 'd, event: Event<'d>, task: Task<'d>) -> Self { | 13 | pub fn new_one_to_one(ch: Peri<'d, C>, event: Event<'d>, task: Task<'d>) -> Self { |
| 16 | Ppi::new_many_to_many(ch, [event], [task]) | 14 | Ppi::new_many_to_many(ch, [event], [task]) |
| 17 | } | 15 | } |
| 18 | } | 16 | } |
| 19 | 17 | ||
| 20 | impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 2> { | 18 | impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 2> { |
| 21 | /// Configure PPI channel to trigger both `task1` and `task2` on `event`. | 19 | /// Configure PPI channel to trigger both `task1` and `task2` on `event`. |
| 22 | pub fn new_one_to_two(ch: impl Peripheral<P = C> + 'd, event: Event<'d>, task1: Task<'d>, task2: Task<'d>) -> Self { | 20 | pub fn new_one_to_two(ch: Peri<'d, C>, event: Event<'d>, task1: Task<'d>, task2: Task<'d>) -> Self { |
| 23 | Ppi::new_many_to_many(ch, [event], [task1, task2]) | 21 | Ppi::new_many_to_many(ch, [event], [task1, task2]) |
| 24 | } | 22 | } |
| 25 | } | 23 | } |
| @@ -28,13 +26,7 @@ impl<'d, C: ConfigurableChannel, const EVENT_COUNT: usize, const TASK_COUNT: usi | |||
| 28 | Ppi<'d, C, EVENT_COUNT, TASK_COUNT> | 26 | Ppi<'d, C, EVENT_COUNT, TASK_COUNT> |
| 29 | { | 27 | { |
| 30 | /// Configure a DPPI channel to trigger all `tasks` when any of the `events` fires. | 28 | /// Configure a DPPI channel to trigger all `tasks` when any of the `events` fires. |
| 31 | pub fn new_many_to_many( | 29 | pub fn new_many_to_many(ch: Peri<'d, C>, events: [Event<'d>; EVENT_COUNT], tasks: [Task<'d>; TASK_COUNT]) -> Self { |
| 32 | ch: impl Peripheral<P = C> + 'd, | ||
| 33 | events: [Event<'d>; EVENT_COUNT], | ||
| 34 | tasks: [Task<'d>; TASK_COUNT], | ||
| 35 | ) -> Self { | ||
| 36 | into_ref!(ch); | ||
| 37 | |||
| 38 | let val = DPPI_ENABLE_BIT | (ch.number() as u32 & DPPI_CHANNEL_MASK); | 30 | let val = DPPI_ENABLE_BIT | (ch.number() as u32 & DPPI_CHANNEL_MASK); |
| 39 | for task in tasks { | 31 | for task in tasks { |
| 40 | if unsafe { task.subscribe_reg().read_volatile() } != 0 { | 32 | if unsafe { task.subscribe_reg().read_volatile() } != 0 { |
