pub struct UartRx<'d, T: Instance, M: Mode> { /* private fields */ }Expand description
Rx-only UART Driver.
Implementations§
Source§impl<'d, T: Instance> UartRx<'d, T, Async>
impl<'d, T: Instance> UartRx<'d, T, Async>
Sourcepub fn into_ring_buffered(
self,
dma_buf: &'d mut [u8],
) -> RingBufferedUartRx<'d, T>
pub fn into_ring_buffered( self, dma_buf: &'d mut [u8], ) -> RingBufferedUartRx<'d, T>
Turn the UartRx into a buffered UART which can continuously receive in the background
without the possibility of losing bytes. The dma_buf is a buffer registered to the
DMA controller, and must be large enough to prevent overflows.
Source§impl<'d, T: Instance, M: Mode> UartRx<'d, T, M>
impl<'d, T: Instance, M: Mode> UartRx<'d, T, M>
Sourcepub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
Reconfigure the driver
Sourcepub fn nb_read(&mut self) -> Result<u8, Error<Error>>
pub fn nb_read(&mut self) -> Result<u8, Error<Error>>
Read a single u8 if there is one available, otherwise return WouldBlock
Sourcepub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
Perform a blocking read into buffer
Source§impl<'d, T: Instance> UartRx<'d, T, Async>
impl<'d, T: Instance> UartRx<'d, T, Async>
Sourcepub fn new<const REMAP: u8>(
peri: Peri<'d, T>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
rx: Peri<'d, impl RxPin<T, REMAP>>,
rx_dma: Peri<'d, impl RxDma<T>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new<const REMAP: u8>( peri: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, rx: Peri<'d, impl RxPin<T, REMAP>>, rx_dma: Peri<'d, impl RxDma<T>>, config: Config, ) -> Result<Self, ConfigError>
Create a new rx-only UART with no hardware flow control.
Useful if you only want Uart Rx. It saves 1 pin and consumes a little less power.
Sourcepub fn new_with_rts<const REMAP: u8>(
peri: Peri<'d, T>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
rx: Peri<'d, impl RxPin<T, REMAP>>,
rts: Peri<'d, impl RtsPin<T, REMAP>>,
rx_dma: Peri<'d, impl RxDma<T>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_with_rts<const REMAP: u8>( peri: Peri<'d, T>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, rx: Peri<'d, impl RxPin<T, REMAP>>, rts: Peri<'d, impl RtsPin<T, REMAP>>, rx_dma: Peri<'d, impl RxDma<T>>, config: Config, ) -> Result<Self, ConfigError>
Create a new rx-only UART with a request-to-send pin
Sourcepub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
pub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
Initiate an asynchronous UART read
Sourcepub async fn read_until_idle(
&mut self,
buffer: &mut [u8],
) -> Result<usize, Error>
pub async fn read_until_idle( &mut self, buffer: &mut [u8], ) -> Result<usize, Error>
Initiate an asynchronous read with idle line detection enabled
Source§impl<'d, T: Instance> UartRx<'d, T, Blocking>
impl<'d, T: Instance> UartRx<'d, T, Blocking>
Sourcepub fn new_blocking<const REMAP: u8>(
peri: Peri<'d, T>,
rx: Peri<'d, impl RxPin<T, REMAP>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_blocking<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, config: Config, ) -> Result<Self, ConfigError>
Create a new rx-only UART with no hardware flow control.
Useful if you only want Uart Rx. It saves 1 pin and consumes a little less power.
Sourcepub fn new_blocking_with_rts<const REMAP: u8>(
peri: Peri<'d, T>,
rx: Peri<'d, impl RxPin<T, REMAP>>,
rts: Peri<'d, impl RtsPin<T, REMAP>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_blocking_with_rts<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, rts: Peri<'d, impl RtsPin<T, REMAP>>, config: Config, ) -> Result<Self, ConfigError>
Create a new rx-only UART with a request-to-send pin