pub struct UartTx<'d, M: Mode> { /* private fields */ }
Expand description
Tx-only UART Driver.
Can be obtained from Uart::split
, or can be constructed independently,
if you do not need the receiving half of the driver.
Implementations§
Source§impl<'d> UartTx<'d, Async>
impl<'d> UartTx<'d, Async>
Sourcepub fn new<T: Instance>(
peri: impl Peripheral<P = T> + 'd,
tx: impl Peripheral<P = impl TxPin<T>> + 'd,
tx_dma: impl Peripheral<P = impl TxDma<T>> + 'd,
config: Config,
) -> Result<Self, ConfigError>
pub fn new<T: Instance>( peri: impl Peripheral<P = T> + 'd, tx: impl Peripheral<P = impl TxPin<T>> + 'd, tx_dma: impl Peripheral<P = impl TxDma<T>> + 'd, config: Config, ) -> Result<Self, ConfigError>
Useful if you only want Uart Tx. It saves 1 pin and consumes a little less power.
Sourcepub fn new_with_cts<T: Instance>(
peri: impl Peripheral<P = T> + 'd,
tx: impl Peripheral<P = impl TxPin<T>> + 'd,
cts: impl Peripheral<P = impl CtsPin<T>> + 'd,
tx_dma: impl Peripheral<P = impl TxDma<T>> + 'd,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_with_cts<T: Instance>( peri: impl Peripheral<P = T> + 'd, tx: impl Peripheral<P = impl TxPin<T>> + 'd, cts: impl Peripheral<P = impl CtsPin<T>> + 'd, tx_dma: impl Peripheral<P = impl TxDma<T>> + 'd, config: Config, ) -> Result<Self, ConfigError>
Create a new tx-only UART with a clear-to-send pin
Source§impl<'d> UartTx<'d, Blocking>
impl<'d> UartTx<'d, Blocking>
Sourcepub fn new_blocking<T: Instance>(
peri: impl Peripheral<P = T> + 'd,
tx: impl Peripheral<P = impl TxPin<T>> + 'd,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_blocking<T: Instance>( peri: impl Peripheral<P = T> + 'd, tx: impl Peripheral<P = impl TxPin<T>> + 'd, config: Config, ) -> Result<Self, ConfigError>
Create a new blocking tx-only UART with no hardware flow control.
Useful if you only want Uart Tx. It saves 1 pin and consumes a little less power.
Sourcepub fn new_blocking_with_cts<T: Instance>(
peri: impl Peripheral<P = T> + 'd,
tx: impl Peripheral<P = impl TxPin<T>> + 'd,
cts: impl Peripheral<P = impl CtsPin<T>> + 'd,
config: Config,
) -> Result<Self, ConfigError>
pub fn new_blocking_with_cts<T: Instance>( peri: impl Peripheral<P = T> + 'd, tx: impl Peripheral<P = impl TxPin<T>> + 'd, cts: impl Peripheral<P = impl CtsPin<T>> + 'd, config: Config, ) -> Result<Self, ConfigError>
Create a new blocking tx-only UART with a clear-to-send pin
Source§impl<'d, M: Mode> UartTx<'d, M>
impl<'d, M: Mode> UartTx<'d, M>
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 blocking_write(&mut self, buffer: &[u8]) -> Result<(), Error>
pub fn blocking_write(&mut self, buffer: &[u8]) -> Result<(), Error>
Perform a blocking UART write
Sourcepub fn blocking_flush(&mut self) -> Result<(), Error>
pub fn blocking_flush(&mut self) -> Result<(), Error>
Block until transmission complete
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 UartTx<'d, M>
impl<'d, M: Mode> SetConfig for UartTx<'d, M>
Source§type ConfigError = ConfigError
type ConfigError = ConfigError
The error type that can occur if
set_config
fails.Source§fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
Set the configuration of the driver.
Source§impl Write for UartTx<'_, Async>
impl Write for UartTx<'_, Async>
Source§async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
async fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Source§impl<M: Mode> Write for UartTx<'_, M>
impl<M: Mode> Write for UartTx<'_, M>
Source§fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
fn write(&mut self, buf: &[u8]) -> Result<usize, Self::Error>
Write a buffer into this writer, returning how many bytes were written. Read more
Source§fn flush(&mut self) -> Result<(), Self::Error>
fn flush(&mut self) -> Result<(), Self::Error>
Flush this output stream, blocking until all intermediately buffered contents reach their destination.
Auto Trait Implementations§
impl<'d, M> Freeze for UartTx<'d, M>
impl<'d, M> !RefUnwindSafe for UartTx<'d, M>
impl<'d, M> Send for UartTx<'d, M>where
M: Send,
impl<'d, M> Sync for UartTx<'d, M>where
M: Sync,
impl<'d, M> Unpin for UartTx<'d, M>where
M: Unpin,
impl<'d, M> !UnwindSafe for UartTx<'d, M>
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