pub struct Uart<'a> { /* private fields */ }Expand description
PL011 UART implementation
Implementations§
Source§impl<'a> Uart<'a>
impl<'a> Uart<'a>
Sourcepub fn new(regs: UniqueMmioPointer<'a, PL011Registers>) -> Self
pub fn new(regs: UniqueMmioPointer<'a, PL011Registers>) -> Self
Creates new UART instance.
Sourcepub fn enable(
&mut self,
config: LineConfig,
baud_rate: u32,
sysclk: u32,
) -> Result<(), Error>
pub fn enable( &mut self, config: LineConfig, baud_rate: u32, sysclk: u32, ) -> Result<(), Error>
Configure and enable UART
Sourcepub fn is_rx_fifo_empty(&self) -> bool
pub fn is_rx_fifo_empty(&self) -> bool
Check if receive FIFO is empty
Sourcepub fn is_rx_fifo_full(&self) -> bool
pub fn is_rx_fifo_full(&self) -> bool
Check if receive FIFO is full
Sourcepub fn is_tx_fifo_empty(&self) -> bool
pub fn is_tx_fifo_empty(&self) -> bool
Check if transmit FIFO is empty
Sourcepub fn is_tx_fifo_full(&self) -> bool
pub fn is_tx_fifo_full(&self) -> bool
Check if transmit FIFO is full
Sourcepub fn read_word(&mut self) -> Result<Option<u8>, Error>
pub fn read_word(&mut self) -> Result<Option<u8>, Error>
Non-blocking read of a single byte from the UART.
Returns Ok(None) if no data is available to read.
Sourcepub fn write_word(&mut self, word: u8)
pub fn write_word(&mut self, word: u8)
Non-blocking write of a single byte to the UART
Sourcepub fn read_identification(&self) -> Identification
pub fn read_identification(&self) -> Identification
Read UART peripheral identification structure
Sourcepub fn set_interrupt_fifo_levels(
&mut self,
rx_level: FifoLevel,
tx_level: FifoLevel,
)
pub fn set_interrupt_fifo_levels( &mut self, rx_level: FifoLevel, tx_level: FifoLevel, )
Sets trigger levels for RX and TX interrupts. The interrupts are generated when the fill level progresses through the trigger level.
Sourcepub fn raw_interrupt_status(&self) -> Interrupts
pub fn raw_interrupt_status(&self) -> Interrupts
Reads the raw interrupt status register.
Sourcepub fn masked_interrupt_status(&self) -> Interrupts
pub fn masked_interrupt_status(&self) -> Interrupts
Reads the masked interrupt status register.
Sourcepub fn interrupt_masks(&self) -> Interrupts
pub fn interrupt_masks(&self) -> Interrupts
Returns the current set of interrupt masks.
Sourcepub fn set_interrupt_masks(&mut self, masks: Interrupts)
pub fn set_interrupt_masks(&mut self, masks: Interrupts)
Sets the interrupt masks.
Sourcepub fn clear_interrupts(&mut self, interrupts: Interrupts)
pub fn clear_interrupts(&mut self, interrupts: Interrupts)
Clears the given set of interrupts.
Trait Implementations§
Source§impl Read for Uart<'_>
impl Read for Uart<'_>
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 Write for Uart<'_>
impl Write for Uart<'_>
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 Uart<'_>
impl Write for Uart<'_>
Source§impl WriteReady for Uart<'_>
impl WriteReady for Uart<'_>
impl Sync for Uart<'_>
Auto Trait Implementations§
impl<'a> Freeze for Uart<'a>
impl<'a> RefUnwindSafe for Uart<'a>
impl<'a> Send for Uart<'a>
impl<'a> Unpin for Uart<'a>
impl<'a> UnwindSafe for Uart<'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