Struct embassy_nrf::uarte::Uarte
source · 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_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.