diff options
| -rw-r--r-- | embassy-nrf/src/uarte.rs | 8 |
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. |
