pub struct SynopsysUart<'a> { /* private fields */ }Expand description
Driver for a Synopsys DesignWare DW_apb UART.
Implementations§
Source§impl<'a> SynopsysUart<'a>
impl<'a> SynopsysUart<'a>
Sourcepub const fn new(registers: UniqueMmioPointer<'a, Registers>) -> Self
pub const fn new(registers: UniqueMmioPointer<'a, Registers>) -> Self
Creates a new instance of the UART driver.
Sourcepub fn configure(&mut self, baud_rate: u32, serial_clock: u32)
pub fn configure(&mut self, baud_rate: u32, serial_clock: u32)
Configures the UART with the given baud rate, 8 data bits, no parity, and 1 stop bit.
Also enables the transmit and receive FIFOs.
This first waits until the UART is not busy, so may block.
Sourcepub fn is_tx_fifo_full(&self) -> bool
pub fn is_tx_fifo_full(&self) -> bool
Returns whether the TX FIFO is currently full.
If this returns true, write_word will block.
Sourcepub fn write_word(&mut self, byte: u8)
pub fn write_word(&mut self, byte: u8)
Writes a single byte to the UART.
This blocks until there is room in the transmit FIFO to write the byte, but doesn’t wait for the byte to be transmitted.
Sourcepub fn is_rx_fifo_empty(&self) -> bool
pub fn is_rx_fifo_empty(&self) -> bool
Returns true if the RX FIFO is currently empty.
If this returns true then read_word will return None.
Trait Implementations§
Source§impl ErrorType for SynopsysUart<'_>
impl ErrorType for SynopsysUart<'_>
Source§impl Read for SynopsysUart<'_>
impl Read for SynopsysUart<'_>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
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>>
Read the exact number of bytes required to fill
buf. Read moreSource§impl ReadReady for SynopsysUart<'_>
impl ReadReady for SynopsysUart<'_>
Source§impl Write for SynopsysUart<'_>
impl Write for SynopsysUart<'_>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Flush this output stream, blocking until all intermediately buffered contents reach their destination.
Source§impl Write for SynopsysUart<'_>
impl Write for SynopsysUart<'_>
Source§impl WriteReady for SynopsysUart<'_>
impl WriteReady for SynopsysUart<'_>
impl Sync for SynopsysUart<'_>
Auto Trait Implementations§
impl<'a> Freeze for SynopsysUart<'a>
impl<'a> RefUnwindSafe for SynopsysUart<'a>
impl<'a> Send for SynopsysUart<'a>
impl<'a> Unpin for SynopsysUart<'a>
impl<'a> UnwindSafe for SynopsysUart<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more