aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/ppi/ppi.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2025-03-26 16:01:37 +0100
committerDario Nieuwenhuis <[email protected]>2025-03-27 15:18:06 +0100
commitd41eeeae79388f219bf6a84e2f7bde9f6b532516 (patch)
tree678b6fc732216e529dc38e6f65b72a309917ac32 /embassy-nrf/src/ppi/ppi.rs
parent9edf5b7f049f95742b60b041e4443967d8a6b708 (diff)
Remove Peripheral trait, rename PeripheralRef->Peri.
Diffstat (limited to 'embassy-nrf/src/ppi/ppi.rs')
-rw-r--r--embassy-nrf/src/ppi/ppi.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/embassy-nrf/src/ppi/ppi.rs b/embassy-nrf/src/ppi/ppi.rs
index a1beb9dcd..e04dacbc0 100644
--- a/embassy-nrf/src/ppi/ppi.rs
+++ b/embassy-nrf/src/ppi/ppi.rs
@@ -1,7 +1,5 @@
1use embassy_hal_internal::into_ref;
2
3use super::{Channel, ConfigurableChannel, Event, Ppi, Task}; 1use super::{Channel, ConfigurableChannel, Event, Ppi, Task};
4use crate::{pac, Peripheral}; 2use crate::{pac, Peri};
5 3
6impl<'d> Task<'d> { 4impl<'d> Task<'d> {
7 fn reg_val(&self) -> u32 { 5 fn reg_val(&self) -> u32 {
@@ -21,9 +19,7 @@ pub(crate) fn regs() -> pac::ppi::Ppi {
21#[cfg(not(feature = "_nrf51"))] // Not for nrf51 because of the fork task 19#[cfg(not(feature = "_nrf51"))] // Not for nrf51 because of the fork task
22impl<'d, C: super::StaticChannel> Ppi<'d, C, 0, 1> { 20impl<'d, C: super::StaticChannel> Ppi<'d, C, 0, 1> {
23 /// Configure PPI channel to trigger `task`. 21 /// Configure PPI channel to trigger `task`.
24 pub fn new_zero_to_one(ch: impl Peripheral<P = C> + 'd, task: Task) -> Self { 22 pub fn new_zero_to_one(ch: Peri<'d, C>, task: Task) -> Self {
25 into_ref!(ch);
26
27 let r = regs(); 23 let r = regs();
28 let n = ch.number(); 24 let n = ch.number();
29 r.fork(n).tep().write_value(task.reg_val()); 25 r.fork(n).tep().write_value(task.reg_val());
@@ -34,9 +30,7 @@ impl<'d, C: super::StaticChannel> Ppi<'d, C, 0, 1> {
34 30
35impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 1> { 31impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 1> {
36 /// Configure PPI channel to trigger `task` on `event`. 32 /// Configure PPI channel to trigger `task` on `event`.
37 pub fn new_one_to_one(ch: impl Peripheral<P = C> + 'd, event: Event<'d>, task: Task<'d>) -> Self { 33 pub fn new_one_to_one(ch: Peri<'d, C>, event: Event<'d>, task: Task<'d>) -> Self {
38 into_ref!(ch);
39
40 let r = regs(); 34 let r = regs();
41 let n = ch.number(); 35 let n = ch.number();
42 r.ch(n).eep().write_value(event.reg_val()); 36 r.ch(n).eep().write_value(event.reg_val());
@@ -49,9 +43,7 @@ impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 1> {
49#[cfg(not(feature = "_nrf51"))] // Not for nrf51 because of the fork task 43#[cfg(not(feature = "_nrf51"))] // Not for nrf51 because of the fork task
50impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 2> { 44impl<'d, C: ConfigurableChannel> Ppi<'d, C, 1, 2> {
51 /// Configure PPI channel to trigger both `task1` and `task2` on `event`. 45 /// Configure PPI channel to trigger both `task1` and `task2` on `event`.
52 pub fn new_one_to_two(ch: impl Peripheral<P = C> + 'd, event: Event<'d>, task1: Task<'d>, task2: Task<'d>) -> Self { 46 pub fn new_one_to_two(ch: Peri<'d, C>, event: Event<'d>, task1: Task<'d>, task2: Task<'d>) -> Self {
53 into_ref!(ch);
54
55 let r = regs(); 47 let r = regs();
56 let n = ch.number(); 48 let n = ch.number();
57 r.ch(n).eep().write_value(event.reg_val()); 49 r.ch(n).eep().write_value(event.reg_val());