aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2024-02-21 21:48:48 +0100
committerDario Nieuwenhuis <[email protected]>2024-02-21 21:48:48 +0100
commitc2e429205d2834f255e065475cefd123448d156a (patch)
tree45043d8562bd788eb7c82c731e92aecdbdcf1edf
parent111306ac0c93b2a7f12545067d23466f6f976742 (diff)
nrf/uart: add split_by_ref.
-rw-r--r--embassy-nrf/src/uarte.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/embassy-nrf/src/uarte.rs b/embassy-nrf/src/uarte.rs
index 9e5b85dea..90820acab 100644
--- a/embassy-nrf/src/uarte.rs
+++ b/embassy-nrf/src/uarte.rs
@@ -242,6 +242,14 @@ impl<'d, T: Instance> Uarte<'d, T> {
242 (self.tx, self.rx) 242 (self.tx, self.rx)
243 } 243 }
244 244
245 /// Split the UART in reader and writer parts, by reference.
246 ///
247 /// The returned halves borrow from `self`, so you can drop them and go back to using
248 /// the "un-split" `self`. This allows temporarily splitting the UART.
249 pub fn split_by_ref(&mut self) -> (&mut UarteTx<'d, T>, &mut UarteRx<'d, T>) {
250 (&mut self.tx, &mut self.rx)
251 }
252
245 /// Split the Uarte into the transmitter and receiver with idle support parts. 253 /// Split the Uarte into the transmitter and receiver with idle support parts.
246 /// 254 ///
247 /// This is useful to concurrently transmit and receive from independent tasks. 255 /// This is useful to concurrently transmit and receive from independent tasks.