pub struct Uart<'d, 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> Uart<'d, Blocking>
impl<'d> Uart<'d, Blocking>
Sourcepub fn new_blocking<T: Instance>(
peri: Peri<'d, T>,
rx: Peri<'d, impl RxPin<T>>,
tx: Peri<'d, impl TxPin<T>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_blocking<T: Instance>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T>>, tx: Peri<'d, impl TxPin<T>>, config: Config, ) -> Result<Self, ConfigError>
Create a new blocking bidirectional UART.
Sourcepub fn new_blocking_with_rtscts<T: Instance>(
peri: Peri<'d, T>,
rx: Peri<'d, impl RxPin<T>>,
tx: Peri<'d, impl TxPin<T>>,
rts: Peri<'d, impl RtsPin<T>>,
cts: Peri<'d, impl CtsPin<T>>,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_blocking_with_rtscts<T: Instance>( peri: Peri<'d, T>, rx: Peri<'d, impl RxPin<T>>, tx: Peri<'d, impl TxPin<T>>, rts: Peri<'d, impl RtsPin<T>>, cts: Peri<'d, impl CtsPin<T>>, config: Config, ) -> Result<Self, ConfigError>
Create a new bidirectional UART with request-to-send and clear-to-send pins
Source§impl<'d, M: Mode> Uart<'d, M>
impl<'d, M: Mode> Uart<'d, M>
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
Sourcepub fn split(self) -> (UartTx<'d, M>, UartRx<'d, M>)
pub fn split(self) -> (UartTx<'d, M>, UartRx<'d, M>)
Split the Uart into a transmitter and receiver, which is particularly useful when having two tasks correlating to transmitting and receiving.
Sourcepub fn split_ref(&mut self) -> (&mut UartTx<'d, M>, &mut UartRx<'d, M>)
pub fn split_ref(&mut self) -> (&mut UartTx<'d, M>, &mut UartRx<'d, M>)
Split the Uart into a transmitter and receiver by mutable reference, which is particularly useful when having two tasks correlating to transmitting and receiving.
Sourcepub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
Reconfigure the driver
Sourcepub fn send_break(&self)
pub fn send_break(&self)
Send break character
Sourcepub fn set_baudrate(&self, baudrate: u32) -> Result<(), ConfigError>
pub fn set_baudrate(&self, baudrate: u32) -> Result<(), ConfigError>
Set baudrate
Trait Implementations§
Source§impl<'d, M: Mode> SetConfig for Uart<'d, M>
impl<'d, M: Mode> SetConfig for Uart<'d, M>
Source§type ConfigError = ConfigError
type ConfigError = ConfigError
set_config
fails.