pub struct Uarte<'d, T: Instance> { /* private fields */ }
Expand description
UARTE driver.
Implementations§
Source§impl<'d, T: Instance> Uarte<'d, T>
impl<'d, T: Instance> Uarte<'d, T>
Sourcepub fn new(
uarte: impl Peripheral<P = T> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
rxd: impl Peripheral<P = impl GpioPin> + 'd,
txd: impl Peripheral<P = impl GpioPin> + 'd,
config: Config,
) -> Self
pub fn new( uarte: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, rxd: impl Peripheral<P = impl GpioPin> + 'd, txd: impl Peripheral<P = impl GpioPin> + 'd, config: Config, ) -> Self
Create a new UARTE without hardware flow control
Sourcepub fn new_with_rtscts(
uarte: impl Peripheral<P = T> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
rxd: impl Peripheral<P = impl GpioPin> + 'd,
txd: impl Peripheral<P = impl GpioPin> + 'd,
cts: impl Peripheral<P = impl GpioPin> + 'd,
rts: impl Peripheral<P = impl GpioPin> + 'd,
config: Config,
) -> Self
pub fn new_with_rtscts( uarte: impl Peripheral<P = T> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, rxd: impl Peripheral<P = impl GpioPin> + 'd, txd: impl Peripheral<P = impl GpioPin> + 'd, cts: impl Peripheral<P = impl GpioPin> + 'd, rts: impl Peripheral<P = impl GpioPin> + 'd, config: Config, ) -> Self
Create a new UARTE with hardware flow control (RTS/CTS)
Sourcepub fn split(self) -> (UarteTx<'d, T>, UarteRx<'d, T>)
pub fn split(self) -> (UarteTx<'d, T>, UarteRx<'d, T>)
Split the Uarte into the transmitter and receiver parts.
This is useful to concurrently transmit and receive from independent tasks.
Sourcepub fn split_by_ref(&mut self) -> (&mut UarteTx<'d, T>, &mut UarteRx<'d, T>)
pub fn split_by_ref(&mut self) -> (&mut UarteTx<'d, T>, &mut UarteRx<'d, T>)
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.
Sourcepub fn split_with_idle<U: TimerInstance>(
self,
timer: impl Peripheral<P = U> + 'd,
ppi_ch1: impl Peripheral<P = impl ConfigurableChannel + 'd> + 'd,
ppi_ch2: impl Peripheral<P = impl ConfigurableChannel + 'd> + 'd,
) -> (UarteTx<'d, T>, UarteRxWithIdle<'d, T, U>)
pub fn split_with_idle<U: TimerInstance>( self, timer: impl Peripheral<P = U> + 'd, ppi_ch1: impl Peripheral<P = impl ConfigurableChannel + 'd> + 'd, ppi_ch2: impl Peripheral<P = impl ConfigurableChannel + 'd> + 'd, ) -> (UarteTx<'d, T>, UarteRxWithIdle<'d, T, U>)
Split the Uarte into the transmitter and receiver with idle support parts.
This is useful to concurrently transmit and receive from independent tasks.
Sourcepub fn event_endtx(&self) -> Event<'_>
pub fn event_endtx(&self) -> Event<'_>
Return the endtx event for use with PPI
Sourcepub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
pub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
Read bytes until the buffer is filled.
Sourcepub async fn write(&mut self, buffer: &[u8]) -> Result<(), Error>
pub async fn write(&mut self, buffer: &[u8]) -> Result<(), Error>
Write all bytes in the buffer.
Sourcepub async fn write_from_ram(&mut self, buffer: &[u8]) -> Result<(), Error>
pub async fn write_from_ram(&mut self, buffer: &[u8]) -> Result<(), Error>
Same as write
but will fail instead of copying data into RAM. Consult the module level documentation to learn more.
Sourcepub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
Read bytes until the buffer is filled.
Sourcepub fn blocking_write(&mut self, buffer: &[u8]) -> Result<(), Error>
pub fn blocking_write(&mut self, buffer: &[u8]) -> Result<(), Error>
Write all bytes in the buffer.
Sourcepub fn blocking_write_from_ram(&mut self, buffer: &[u8]) -> Result<(), Error>
pub fn blocking_write_from_ram(&mut self, buffer: &[u8]) -> Result<(), Error>
Same as blocking_write
but will fail instead of copying data into RAM. Consult the module level documentation to learn more.