aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/ppi/mod.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-10-28 03:07:06 +0200
committerDario Nieuwenhuis <[email protected]>2021-10-28 03:36:25 +0200
commit663141b4e456bbfacaaff8decdba6840c76a136b (patch)
tree8d151a795b008ab0791a6faa5dbd36e5b83522b5 /embassy-nrf/src/ppi/mod.rs
parentc995a97f2032d329c2955c79054b7e466b0b423b (diff)
nrf: add initial nrf5340 support
Diffstat (limited to 'embassy-nrf/src/ppi/mod.rs')
-rw-r--r--embassy-nrf/src/ppi/mod.rs20
1 files changed, 1 insertions, 19 deletions
diff --git a/embassy-nrf/src/ppi/mod.rs b/embassy-nrf/src/ppi/mod.rs
index 96f867d18..aeccb154b 100644
--- a/embassy-nrf/src/ppi/mod.rs
+++ b/embassy-nrf/src/ppi/mod.rs
@@ -15,7 +15,7 @@
15//! many tasks and events, but any single task or event can only be coupled with one channel. 15//! many tasks and events, but any single task or event can only be coupled with one channel.
16//! 16//!
17 17
18use crate::{pac, peripherals}; 18use crate::peripherals;
19use core::marker::PhantomData; 19use core::marker::PhantomData;
20use core::ptr::NonNull; 20use core::ptr::NonNull;
21use embassy::util::Unborrow; 21use embassy::util::Unborrow;
@@ -35,24 +35,6 @@ pub struct Ppi<'d, C: Channel, const EVENT_COUNT: usize, const TASK_COUNT: usize
35 phantom: PhantomData<&'d mut C>, 35 phantom: PhantomData<&'d mut C>,
36} 36}
37 37
38impl<'d, C: Channel + 'd, const EVENT_COUNT: usize, const TASK_COUNT: usize>
39 Ppi<'d, C, EVENT_COUNT, TASK_COUNT>
40{
41 /// Enables the channel.
42 pub fn enable(&mut self) {
43 let r = unsafe { &*pac::PPI::ptr() };
44 r.chenset
45 .write(|w| unsafe { w.bits(1 << self.ch.number()) });
46 }
47
48 /// Disables the channel.
49 pub fn disable(&mut self) {
50 let r = unsafe { &*pac::PPI::ptr() };
51 r.chenclr
52 .write(|w| unsafe { w.bits(1 << self.ch.number()) });
53 }
54}
55
56const REGISTER_DPPI_CONFIG_OFFSET: usize = 0x80 / core::mem::size_of::<u32>(); 38const REGISTER_DPPI_CONFIG_OFFSET: usize = 0x80 / core::mem::size_of::<u32>();
57 39
58/// Represents a task that a peripheral can do. 40/// Represents a task that a peripheral can do.