pub struct Uart { /* private fields */ }Expand description
UART driver structure.
Implementations§
Source§impl Uart
impl Uart
Sourcepub 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>
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.
Sourcepub 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>
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>
Sourcepub 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>
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 blocksys_clk: The system clock frequencyuart: 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.
pub fn peripheral_id(&self) -> u32
pub fn enable_rx(&mut self)
pub fn disable_rx(&mut self)
pub fn enable_tx(&mut self)
pub fn disable_tx(&mut self)
Sourcepub fn clear_rx_fifo(&mut self)
pub fn clear_rx_fifo(&mut self)
This also clears status conditons for the RX FIFO.
Sourcepub fn clear_tx_fifo(&mut self)
pub fn clear_tx_fifo(&mut self)
This also clears status conditons for the TX FIFO.
pub fn listen(&mut self, event: Event)
pub fn unlisten(&mut self, event: Event)
Sourcepub fn poll_rx_errors(&self) -> Option<UartErrors>
pub fn poll_rx_errors(&self) -> Option<UartErrors>
Poll receiver errors.
pub fn split(self) -> (Tx, Rx)
Trait Implementations§
Source§impl ErrorType for Uart
impl ErrorType for Uart
Source§type Error = Infallible
type Error = Infallible
Error type of all the IO operations on this type.
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> 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