UartPeriph

Trait UartPeriph 

Source
pub trait UartPeriph {
    // Required methods
    fn write(&mut self, word: u16) -> Result<(), Error>;
    fn write_with(&mut self, f: impl FnOnce() -> Option<u16>) -> Option<bool>;
    fn is_tx_complete(&self) -> bool;
    fn read(&mut self) -> Result<u16, Error>;
    fn set_interrupt(&mut self, event: Event, enable: bool);
    fn is_interrupt_enable(&mut self, event: Event) -> bool;
    fn is_interrupted(&mut self, event: Event) -> bool;
    fn clear_err_flag(&self);
}

Required Methods§

Source

fn write(&mut self, word: u16) -> Result<(), Error>

Source

fn write_with(&mut self, f: impl FnOnce() -> Option<u16>) -> Option<bool>

§Returns
  • None: need to wait
  • Some(true): Wrote a data
  • Some(false): No new data
Source

fn is_tx_complete(&self) -> bool

Transfer is empty and completed

Source

fn read(&mut self) -> Result<u16, Error>

Source

fn set_interrupt(&mut self, event: Event, enable: bool)

Source

fn is_interrupt_enable(&mut self, event: Event) -> bool

Source

fn is_interrupted(&mut self, event: Event) -> bool

Read and clean the flag

Source

fn clear_err_flag(&self)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§