diff options
| -rw-r--r-- | embassy-nrf/src/ppi/mod.rs | 15 |
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..76757a248 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 fn trigger(&mut self) { | ||
| 142 | unsafe { self.0.as_ptr().write_volatile(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 fn is_triggered(&self) -> bool { | ||
| 183 | unsafe { self.0.as_ptr().read_volatile() == 1 } | ||
| 184 | } | ||
| 185 | |||
| 186 | /// Clear the current register's triggered state, reverting it to 0. | ||
| 187 | pub fn clear(&mut self) { | ||
| 188 | unsafe { self.0.as_ptr().write_volatile(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 { |
