aboutsummaryrefslogtreecommitdiff
path: root/embassy-nrf/src/ppi
diff options
context:
space:
mode:
authorCameron <[email protected]>2023-06-29 17:11:36 +0200
committerCameron <[email protected]>2023-06-29 17:11:36 +0200
commit2aa2b843ce6b96aacd72e52fe29b550e7ebc55b3 (patch)
tree54438942c8b1beaded6cf614f6b1e1e74197fa62 /embassy-nrf/src/ppi
parentfa2cda81db03f66c803c4ae931e1603973750548 (diff)
feature(1355): Add trigger to task, triggered + clear to Event
Diffstat (limited to 'embassy-nrf/src/ppi')
-rw-r--r--embassy-nrf/src/ppi/mod.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/embassy-nrf/src/ppi/mod.rs b/embassy-nrf/src/ppi/mod.rs
index 7c18da6ee..ba95849e8 100644
--- a/embassy-nrf/src/ppi/mod.rs
+++ b/embassy-nrf/src/ppi/mod.rs
@@ -137,6 +137,11 @@ impl Task {
137 Self(ptr) 137 Self(ptr)
138 } 138 }
139 139
140 // Triggers this task.
141 pub unsafe fn trigger(&mut self) {
142 self.0.write(|w| unsafe { w.bits(1) });
143 }
144
140 pub(crate) fn from_reg<T>(reg: &T) -> Self { 145 pub(crate) fn from_reg<T>(reg: &T) -> Self {
141 Self(unsafe { NonNull::new_unchecked(reg as *const _ as *mut _) }) 146 Self(unsafe { NonNull::new_unchecked(reg as *const _ as *mut _) })
142 } 147 }
@@ -173,6 +178,16 @@ impl Event {
173 Self(unsafe { NonNull::new_unchecked(reg as *const _ as *mut _) }) 178 Self(unsafe { NonNull::new_unchecked(reg as *const _ as *mut _) })
174 } 179 }
175 180
181 // Describes whether this Event is currently in a triggered state.
182 pub unsafe fn is_triggered(&self) -> bool {
183 self.0.read().bits() == 1
184 }
185
186 // Clear the current register's triggered state, reverting it to 0.
187 pub unsafe fn clear(&mut self) {
188 self.0.write(|w| unsafe { w.bits(0) });
189 }
190
176 /// Address of publish register for this event. 191 /// Address of publish register for this event.
177 #[cfg(feature = "_dppi")] 192 #[cfg(feature = "_dppi")]
178 pub fn publish_reg(&self) -> *mut u32 { 193 pub fn publish_reg(&self) -> *mut u32 {