pub struct Tx { /* 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 Tx
impl Tx
Sourcepub unsafe fn steal(base_addr: usize) -> Self
pub unsafe fn steal(base_addr: usize) -> Self
Steal the TX 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 a TX handle inside an interrupt handler without having to use a critical_section::Mutex if the user can guarantee that the TX 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 write_fifo(&mut self, data: u8) -> Result<(), Infallible>
pub fn write_fifo(&mut self, data: u8) -> Result<(), Infallible>
Write into the UART Lite.
Returns nb::Error::WouldBlock if the TX FIFO is full.
Sourcepub fn reset_fifo(&mut self)
pub fn reset_fifo(&mut self)
Reset the TX FIFO.
Sourcepub fn write_fifo_unchecked(&mut self, data: u8)
pub fn write_fifo_unchecked(&mut self, data: u8)
Write into the FIFO without checking the FIFO fill status.
This can be useful to completely fill the FIFO if it is known to be empty.
Sourcepub fn fifo_empty(&self) -> bool
pub fn fifo_empty(&self) -> bool
Is the TX FIFO empty?
Sourcepub fn fill_fifo(&mut self, buf: &[u8]) -> usize
pub fn fill_fifo(&mut self, buf: &[u8]) -> usize
Fills the FIFO with user provided data until the user data is consumed or the FIFO is full.
Returns the amount of written data, which might be smaller than the buffer size.
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 recorded RX errors.