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
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