Uart

Struct Uart 

Source
pub struct Uart { /* private fields */ }
Expand description

UART driver structure.

Implementations§

Source§

impl Uart

Source

pub fn new_with_interrupt<UartPeriph: UartInstance, Tx: TxPin, Rx: RxPin>( uart: UartPeriph, tx_pin: Tx, rx_pin: Rx, sys_clk: Hertz, config: Config, irq_cfg: InterruptConfig, ) -> Result<Self, UartIdMissmatchError>

Calls Self::new with the interrupt configuration to some valid value.

Source

pub fn new_without_interrupt<UartPeriph: UartInstance, Tx: TxPin, Rx: RxPin>( uart: UartPeriph, tx_pin: Tx, rx_pin: Rx, sys_clk: Hertz, config: Config, ) -> Result<Self, UartIdMissmatchError>

Calls Self::new with the interrupt configuration to None.

Source

pub fn new<UartPeriph: UartInstance, Tx: TxPin, Rx: RxPin>( uart: UartPeriph, tx_pin: Tx, rx_pin: Rx, sys_clk: Hertz, config: Config, opt_irq_cfg: Option<InterruptConfig>, ) -> Result<Self, UartIdMissmatchError>

Create a new UART peripheral driver with an interrupt configuration.

§Arguments
  • syscfg: The system configuration register block
  • sys_clk: The system clock frequency
  • uart: The concrete UART peripheral instance.
  • pins: UART TX and RX pin tuple.
  • config: UART specific configuration parameters like baudrate.
  • irq_cfg: Optional interrupt configuration. This should be a valid value if the plan is to use TX or RX functionality relying on interrupts. If only the blocking API without any interrupt support is used, this can be None.
Source

pub fn peripheral_id(&self) -> u32

Source

pub fn enable_rx(&mut self)

Source

pub fn disable_rx(&mut self)

Source

pub fn enable_tx(&mut self)

Source

pub fn disable_tx(&mut self)

Source

pub fn clear_rx_fifo(&mut self)

This also clears status conditons for the RX FIFO.

Source

pub fn clear_tx_fifo(&mut self)

This also clears status conditons for the TX FIFO.

Source

pub fn listen(&mut self, event: Event)

Source

pub fn unlisten(&mut self, event: Event)

Source

pub fn poll_rx_errors(&self) -> Option<UartErrors>

Poll receiver errors.

Source

pub fn split(self) -> (Tx, Rx)

Trait Implementations§

Source§

impl ErrorType for Uart

Source§

type Error = Infallible

Error type of all the IO operations on this type.
Source§

impl ErrorType for Uart

Source§

type Error = Infallible

Error type
Source§

impl Read for Uart

Source§

fn read(&mut self) -> Result<u8, Self::Error>

Reads a single word from the serial interface
Source§

impl Write for Uart

Source§

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

Writes a single word to the serial interface.
Source§

fn flush(&mut self) -> Result<(), Self::Error>

Ensures that none of the previously written words are still buffered.

Auto Trait Implementations§

§

impl Freeze for Uart

§

impl RefUnwindSafe for Uart

§

impl Send for Uart

§

impl !Sync for Uart

§

impl Unpin for Uart

§

impl UnwindSafe for Uart

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.