pub struct LpuartTx<'a, M: Mode> { /* private fields */ }Expand description
Lpuart TX driver.
Implementations§
Source§impl<'a> LpuartTx<'a, Blocking>
impl<'a> LpuartTx<'a, Blocking>
Sourcepub fn new_blocking<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
config: Config,
) -> Result<Self, Error>
pub fn new_blocking<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, config: Config, ) -> Result<Self, Error>
Create a new blocking LPUART transmitter instance.
Any external pin will be placed into Disabled state upon Drop.
Sourcepub fn new_blocking_with_cts<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
cts_pin: Peri<'a, impl CtsPin<T>>,
config: Config,
) -> Result<Self, Error>
pub fn new_blocking_with_cts<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, cts_pin: Peri<'a, impl CtsPin<T>>, config: Config, ) -> Result<Self, Error>
Create a new blocking LPUART transmitter instance with CTS flow control.
Any external pin will be placed into Disabled state upon Drop.
Sourcepub fn blocking_write(&mut self, buf: &[u8]) -> Result<(), Error>
pub fn blocking_write(&mut self, buf: &[u8]) -> Result<(), Error>
Write data to LPUART TX blocking execution until all data is sent.
pub fn write_str_blocking(&mut self, buf: &str)
Sourcepub fn write(&mut self, buf: &[u8]) -> Result<(), Error>
pub fn write(&mut self, buf: &[u8]) -> Result<(), Error>
Write data to LPUART TX without blocking.
Sourcepub fn blocking_flush(&mut self) -> Result<(), Error>
pub fn blocking_flush(&mut self) -> Result<(), Error>
Flush LPUART TX blocking execution until all data has been transmitted.
Source§impl<'a> LpuartTx<'a, Buffered>
impl<'a> LpuartTx<'a, Buffered>
Sourcepub fn new<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
_irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a,
tx_buffer: &'a mut [u8],
config: Config,
) -> Result<Self, Error>
pub fn new<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, _irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a, tx_buffer: &'a mut [u8], config: Config, ) -> Result<Self, Error>
Create a new TX-only LPUART.
Any external pin will be placed into Disabled state upon Drop.
§SAFETY
You must NOT call core::mem::forget on LpuartTx if tx_buffer is not 'static.
This will potentially send “garbage” data via the UART.
Sourcepub fn new_with_cts<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
cts_pin: Peri<'a, impl CtsPin<T>>,
_irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a,
tx_buffer: &'a mut [u8],
config: Config,
) -> Result<Self, Error>
pub fn new_with_cts<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, cts_pin: Peri<'a, impl CtsPin<T>>, _irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a, tx_buffer: &'a mut [u8], config: Config, ) -> Result<Self, Error>
Create a new TX-only buffered LPUART with CTS flow control.
Any external pin will be placed into Disabled state upon Drop.
§SAFETY
You must NOT call core::mem::forget on LpuartTx if tx_buffer is not 'static.
This will potentially send “garbage” data via the UART.
Source§impl<'a> LpuartTx<'a, Dma<'a>>
impl<'a> LpuartTx<'a, Dma<'a>>
Sourcepub fn new_async_with_dma<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
tx_dma_ch: Peri<'a, impl Channel>,
config: Config,
) -> Result<Self, Error>
pub fn new_async_with_dma<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, tx_dma_ch: Peri<'a, impl Channel>, config: Config, ) -> Result<Self, Error>
Create a new LPUART TX driver with DMA support.
Any external pin will be placed into Disabled state upon Drop.
Sourcepub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
pub async fn write(&mut self, buf: &[u8]) -> Result<usize, Error>
Write data using DMA.
This configures the DMA channel for a memory-to-peripheral transfer and waits for completion asynchronously. Large buffers are automatically split into chunks that fit within the DMA transfer limit.
The DMA request source is automatically derived from the LPUART instance type.
§Safety
If the returned future is dropped before completion (e.g., due to a timeout), the DMA transfer is automatically aborted to prevent use-after-free.
§Arguments
buf- Data buffer to transmit
Sourcepub fn blocking_write(&mut self, buf: &[u8]) -> Result<(), Error>
pub fn blocking_write(&mut self, buf: &[u8]) -> Result<(), Error>
Blocking write (fallback when DMA is not needed)
Sourcepub fn blocking_flush(&mut self) -> Result<(), Error>
pub fn blocking_flush(&mut self) -> Result<(), Error>
Flush TX blocking