nrf/uart: add split_by_ref.
This commit is contained in:
parent
111306ac0c
commit
c2e429205d
1 changed files with 8 additions and 0 deletions
|
@ -242,6 +242,14 @@ impl<'d, T: Instance> Uarte<'d, T> {
|
||||||
(self.tx, self.rx)
|
(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.
|
/// Split the Uarte into the transmitter and receiver with idle support parts.
|
||||||
///
|
///
|
||||||
/// This is useful to concurrently transmit and receive from independent tasks.
|
/// This is useful to concurrently transmit and receive from independent tasks.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue