pub struct Uart<'d, T: Instance, M: Mode> { /* private fields */ }Expand description
Bidirectional UART Driver, which acts as a combination of UartTx and UartRx.
§Notes on [embedded_io::Read]
embedded_io::Read requires guarantees that the base UartRx cannot provide.
See UartRx for more details, and see [BufferedUart] and RingBufferedUartRx
as alternatives that do provide the necessary guarantees for embedded_io::Read.
Implementations§
Source§impl<'d, T: Instance, M: Mode> Uart<'d, T, M>
impl<'d, T: Instance, M: Mode> Uart<'d, T, M>
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
Sourcepub fn blocking_write(&mut self, buffer: &[u8]) -> Result<(), Error>
pub fn blocking_write(&mut self, buffer: &[u8]) -> Result<(), Error>
Perform a blocking write
Sourcepub fn blocking_flush(&mut self) -> Result<(), Error>
pub fn blocking_flush(&mut self) -> Result<(), Error>
Block until transmission complete
Sourcepub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
Perform a blocking read into buffer
Source§impl<'d, T: Instance> Uart<'d, T, Async>
impl<'d, T: Instance> Uart<'d, T, Async>
Sourcepub fn new<const REMAP: u8>(
peri: Peri<'d, T>,
rx: Peri<'d, impl RxPin<T, REMAP>>,
tx: Peri<'d, impl TxPin<T, REMAP>>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
tx_dma: Peri<'d, impl TxDma<T>>,
rx_dma: Peri<'d, impl RxDma<T>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, tx: Peri<'d, impl TxPin<T, REMAP>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, tx_dma: Peri<'d, impl TxDma<T>>, rx_dma: Peri<'d, impl RxDma<T>>, config: Config, ) -> Result<Self, ConfigError>
Create a new bidirectional UARTUart
Sourcepub fn new_with_rtscts<const REMAP: u8>(
peri: Peri<'d, T>,
rx: Peri<'d, impl RxPin<T, REMAP>>,
tx: Peri<'d, impl TxPin<T, REMAP>>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
rts: Peri<'d, impl RtsPin<T, REMAP>>,
cts: Peri<'d, impl CtsPin<T, REMAP>>,
tx_dma: Peri<'d, impl TxDma<T>>,
rx_dma: Peri<'d, impl RxDma<T>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_with_rtscts<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, tx: Peri<'d, impl TxPin<T, REMAP>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, rts: Peri<'d, impl RtsPin<T, REMAP>>, cts: Peri<'d, impl CtsPin<T, REMAP>>, tx_dma: Peri<'d, impl TxDma<T>>, rx_dma: Peri<'d, impl RxDma<T>>, config: Config, ) -> Result<Self, ConfigError>
Create a new bidirectional UART with request-to-send and clear-to-send pins
Source§impl<'d, T: Instance> Uart<'d, T, Blocking>
impl<'d, T: Instance> Uart<'d, T, Blocking>
Sourcepub fn new_blocking<const REMAP: u8>(
peri: Peri<'d, T>,
rx: Peri<'d, impl RxPin<T, REMAP>>,
tx: Peri<'d, impl TxPin<T, REMAP>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_blocking<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, tx: Peri<'d, impl TxPin<T, REMAP>>, config: Config, ) -> Result<Self, ConfigError>
Create a new blocking bidirectional UART.
Sourcepub fn new_blocking_with_rtscts<const REMAP: u8>(
peri: Peri<'d, T>,
rx: Peri<'d, impl RxPin<T, REMAP>>,
tx: Peri<'d, impl TxPin<T, REMAP>>,
rts: Peri<'d, impl RtsPin<T, REMAP>>,
cts: Peri<'d, impl CtsPin<T, REMAP>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_blocking_with_rtscts<const REMAP: u8>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T, REMAP>>, tx: Peri<'d, impl TxPin<T, REMAP>>, rts: Peri<'d, impl RtsPin<T, REMAP>>, cts: Peri<'d, impl CtsPin<T, REMAP>>, config: Config, ) -> Result<Self, ConfigError>
Create a new bidirectional UART with request-to-send and clear-to-send pins