pub struct Rx { /* private fields */ }Expand description
AXI UARTLITE TX driver.
Can be created by super::AxiUartlite::splitting a regular AXI UARTLITE structure or by Self::stealing it unsafely.
Implementations§
Source§impl Rx
impl Rx
Sourcepub const unsafe fn steal(base_addr: usize) -> Self
pub const unsafe fn steal(base_addr: usize) -> Self
Steal the RX part of the UART Lite.
You should only use this if you can not use the regular super::AxiUartlite constructor and the super::AxiUartlite::split method.
This function assumes that the setup of the UART was already done. It can be used to create an RX handle inside an interrupt handler without having to use a critical_section::Mutex if the user can guarantee that the RX handle will only be used by the interrupt handler or only interrupt specific API will be used.
§Safety
The same safey rules specified in super::AxiUartlite apply.
Sourcepub fn read_fifo(&mut self) -> Result<u8, Infallible>
pub fn read_fifo(&mut self) -> Result<u8, Infallible>
Read the RX FIFO.
This functions offers a nb::Result based API and returns nb::Error::WouldBlock if there is nothing to read.
Sourcepub fn read_fifo_unchecked(&mut self) -> u8
pub fn read_fifo_unchecked(&mut self) -> u8
Read from the FIFO without checking the FIFO fill status.
Sourcepub fn read_whole_fifo(&mut self, buf: &mut [u8; 16]) -> usize
pub fn read_whole_fifo(&mut self, buf: &mut [u8; 16]) -> usize
This simply reads all available bytes in the RX FIFO.
It returns the number of read bytes.
Sourcepub fn on_interrupt_rx(&mut self, buf: &mut [u8; 16]) -> usize
pub fn on_interrupt_rx(&mut self, buf: &mut [u8; 16]) -> usize
Can be called in the interrupt handler for the UART Lite to handle RX reception.
Simply calls Rx::read_whole_fifo.
Sourcepub fn read_and_clear_last_error(&mut self) -> Option<RxErrors>
pub fn read_and_clear_last_error(&mut self) -> Option<RxErrors>
Read and clear the last RX errors.
Returns None if no errors have occured.
Trait Implementations§
Source§impl ErrorType for Rx
impl ErrorType for Rx
Source§type Error = Infallible
type Error = Infallible
Source§impl Read for Rx
impl Read for Rx
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read more