mirror of
https://github.com/embassy-rs/embassy.git
synced 2025-09-28 04:40:39 +00:00
nrf/uart: add split_by_ref.
This commit is contained in:
parent
111306ac0c
commit
c2e429205d
@ -242,6 +242,14 @@ impl<'d, T: Instance> Uarte<'d, T> {
|
||||
(self.tx, self.rx)
|
||||
}
|
||||
|
||||
/// Split the UART in reader and writer parts, by reference.
|
||||
///
|
||||
/// The returned halves borrow from `self`, so you can drop them and go back to using
|
||||
/// the "un-split" `self`. This allows temporarily splitting the UART.
|
||||
pub fn split_by_ref(&mut self) -> (&mut UarteTx<'d, T>, &mut UarteRx<'d, T>) {
|
||||
(&mut self.tx, &mut self.rx)
|
||||
}
|
||||
|
||||
/// Split the Uarte into the transmitter and receiver with idle support parts.
|
||||
///
|
||||
/// This is useful to concurrently transmit and receive from independent tasks.
|
||||
|
Loading…
x
Reference in New Issue
Block a user