aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhuntc <[email protected]>2022-01-10 19:14:02 +1100
committerhuntc <[email protected]>2022-01-10 19:14:02 +1100
commitc54303be755d021f8a5a6b89c3032cfe834c6bc7 (patch)
tree264630a9e03e9a00083171cfe3124549a785bbd6
parent82e5edb94064b51af433b4c3e89a7cf4b6eaa826 (diff)
Makes the uarte endtx event available
This commit allows event_endtx to be used outside of the Uarte itself. As a consequence, PPI can be used to drive tasks given the end of transmission on the Uarte. This is particularly useful for situations like RS485 where a GPIO must be set to high when transmitting then cleared when done. A non-ppi approach can cause a delay in the clearing of this GPIO as other Embassy tasks might become scheduled.
-rw-r--r--embassy-nrf/src/uarte.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index 131d07465..38480ecca 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -151,6 +151,12 @@ impl<'d, T: Instance> Uarte<'d, T> {
151 (self.tx, self.rx) 151 (self.tx, self.rx)
152 } 152 }
153 153
154 /// Return the endtx event for use with PPI
155 pub fn event_endtx(&self) -> Event {
156 let r = T::regs();
157 Event::from_reg(&r.events_endtx)
158 }
159
154 fn on_interrupt(_: *mut ()) { 160 fn on_interrupt(_: *mut ()) {
155 let r = T::regs(); 161 let r = T::regs();
156 let s = T::state(); 162 let s = T::state();