Struct embassy_stm32::usart::UartTx
source · pub struct UartTx<'d, T: BasicInstance, TxDma = NoDma> { /* private fields */ }
Expand description
Tx-only UART Driver
Implementations§
source§impl<'d, T: BasicInstance, TxDma> UartTx<'d, T, TxDma>
impl<'d, T: BasicInstance, TxDma> UartTx<'d, T, TxDma>
sourcepub fn new(
peri: impl Peripheral<P = T> + 'd,
tx: impl Peripheral<P = impl TxPin<T>> + 'd,
tx_dma: impl Peripheral<P = TxDma> + 'd,
config: Config
) -> Result<Self, ConfigError>
pub fn new( peri: impl Peripheral<P = T> + 'd, tx: impl Peripheral<P = impl TxPin<T>> + 'd, tx_dma: impl Peripheral<P = TxDma> + '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(
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 = TxDma> + 'd,
config: Config
) -> Result<Self, ConfigError>
pub fn new_with_cts( 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 = TxDma> + 'd, config: Config ) -> Result<Self, ConfigError>
Create a new tx-only UART with a clear-to-send pin
sourcepub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
pub fn set_config(&mut self, config: &Config) -> Result<(), ConfigError>
Reconfigure the driver
sourcepub async fn write(&mut self, buffer: &[u8]) -> Result<(), Error>where
TxDma: TxDma<T>,
pub async fn write(&mut self, buffer: &[u8]) -> Result<(), Error>where
TxDma: TxDma<T>,
Initiate an asynchronous UART write
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
Trait Implementations§
source§impl<'d, T: BasicInstance, TxDma> Drop for UartTx<'d, T, TxDma>
impl<'d, T: BasicInstance, TxDma> Drop for UartTx<'d, T, TxDma>
source§impl<T, TxDma> ErrorType for UartTx<'_, T, TxDma>where
T: BasicInstance,
impl<T, TxDma> ErrorType for UartTx<'_, T, TxDma>where
T: BasicInstance,
source§impl<'d, T: BasicInstance, TxDma> ErrorType for UartTx<'d, T, TxDma>
impl<'d, T: BasicInstance, TxDma> ErrorType for UartTx<'d, T, TxDma>
source§impl<'d, T: BasicInstance, TxDma> SetConfig for UartTx<'d, T, TxDma>
impl<'d, T: BasicInstance, TxDma> SetConfig for UartTx<'d, T, TxDma>
§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<T, TxDma> Write for UartTx<'_, T, TxDma>where
T: BasicInstance,
TxDma: TxDma<T>,
impl<T, TxDma> Write for UartTx<'_, T, TxDma>where
T: BasicInstance,
TxDma: TxDma<T>,
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<T, TxDma> Write for UartTx<'_, T, TxDma>where
T: BasicInstance,
TxDma: TxDma<T>,
impl<T, TxDma> Write for UartTx<'_, T, TxDma>where
T: BasicInstance,
TxDma: TxDma<T>,
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.
source§impl<'d, T: BasicInstance, TxDma> Write for UartTx<'d, T, TxDma>
impl<'d, T: BasicInstance, TxDma> Write for UartTx<'d, T, TxDma>
Auto Trait Implementations§
impl<'d, T, TxDma> RefUnwindSafe for UartTx<'d, T, TxDma>where
T: RefUnwindSafe,
TxDma: RefUnwindSafe,
impl<'d, T, TxDma> Send for UartTx<'d, T, TxDma>where
TxDma: Send,
impl<'d, T, TxDma> Sync for UartTx<'d, T, TxDma>
impl<'d, T, TxDma> Unpin for UartTx<'d, T, TxDma>where
TxDma: Unpin,
impl<'d, T, TxDma = NoDma> !UnwindSafe for UartTx<'d, T, TxDma>
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