pub struct LpuartRx<'a, M: Mode> { /* private fields */ }Expand description
Lpuart Rx driver.
Implementations§
Source§impl<'a> LpuartRx<'a, Blocking>
impl<'a> LpuartRx<'a, Blocking>
Sourcepub fn new_blocking<T: Instance>(
_inner: Peri<'a, T>,
rx_pin: Peri<'a, impl RxPin<T>>,
config: Config,
) -> Result<Self, Error>
pub fn new_blocking<T: Instance>( _inner: Peri<'a, T>, rx_pin: Peri<'a, impl RxPin<T>>, config: Config, ) -> Result<Self, Error>
Create a new blocking LPUART Receiver instance.
Any external pin will be placed into Disabled state upon Drop.
Sourcepub fn new_blocking_with_rts<T: Instance>(
_inner: Peri<'a, T>,
rx_pin: Peri<'a, impl RxPin<T>>,
rts_pin: Peri<'a, impl RtsPin<T>>,
config: Config,
) -> Result<Self, Error>
pub fn new_blocking_with_rts<T: Instance>( _inner: Peri<'a, T>, rx_pin: Peri<'a, impl RxPin<T>>, rts_pin: Peri<'a, impl RtsPin<T>>, config: Config, ) -> Result<Self, Error>
Create a new blocking LPUART Receiver instance with RTS flow control.
Any external pin will be placed into Disabled state upon Drop.
Source§impl<'a> LpuartRx<'a, Buffered>
impl<'a> LpuartRx<'a, Buffered>
Sourcepub fn new<T: Instance>(
_inner: Peri<'a, T>,
rx_pin: Peri<'a, impl RxPin<T>>,
_irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a,
rx_buffer: &'a mut [u8],
config: Config,
) -> Result<Self, Error>
pub fn new<T: Instance>( _inner: Peri<'a, T>, rx_pin: Peri<'a, impl RxPin<T>>, _irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a, rx_buffer: &'a mut [u8], config: Config, ) -> Result<Self, Error>
Create a new RX-only buffered LPUART.
Any external pin will be placed into Disabled state upon Drop.
§SAFETY
You must NOT call core::mem::forget on LpuartRx if rx_buffer is not 'static.
This will cause memory corruption.
Sourcepub fn new_with_rts<T: Instance>(
_inner: Peri<'a, T>,
rx_pin: Peri<'a, impl RxPin<T>>,
rts_pin: Peri<'a, impl RtsPin<T>>,
_irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a,
rx_buffer: &'a mut [u8],
config: Config,
) -> Result<Self, Error>
pub fn new_with_rts<T: Instance>( _inner: Peri<'a, T>, rx_pin: Peri<'a, impl RxPin<T>>, rts_pin: Peri<'a, impl RtsPin<T>>, _irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a, rx_buffer: &'a mut [u8], config: Config, ) -> Result<Self, Error>
Create a new RX-only buffered LPUART with RTS flow control.
Any external pin will be placed into Disabled state upon Drop.
§SAFETY
You must NOT call core::mem::forget on LpuartRx if rx_buffer is not 'static.
This will cause memory corruption.
Source§impl<'a> LpuartRx<'a, Dma<'a>>
impl<'a> LpuartRx<'a, Dma<'a>>
Sourcepub fn new_async_with_dma<T: Instance>(
_inner: Peri<'a, T>,
rx_pin: Peri<'a, impl RxPin<T>>,
rx_dma_ch: Peri<'a, impl Channel>,
config: Config,
) -> Result<Self, Error>
pub fn new_async_with_dma<T: Instance>( _inner: Peri<'a, T>, rx_pin: Peri<'a, impl RxPin<T>>, rx_dma_ch: Peri<'a, impl Channel>, config: Config, ) -> Result<Self, Error>
Create a new LPUART RX driver with DMA support.
Any external pin will be placed into Disabled state upon Drop.
Sourcepub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
pub async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Read data using DMA.
This configures the DMA channel for a peripheral-to-memory 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- Buffer to receive data into
Sourcepub fn blocking_read(&mut self, buf: &mut [u8]) -> Result<(), Error>
pub fn blocking_read(&mut self, buf: &mut [u8]) -> Result<(), Error>
Blocking read (fallback when DMA is not needed)
pub fn into_ring_dma_rx<'buf: 'a>( &mut self, buf: &'buf mut [u8], ) -> RingBufferedLpuartRx<'_, 'buf>
Trait Implementations§
Source§impl Read for LpuartRx<'_, Blocking>
impl Read for LpuartRx<'_, Blocking>
Source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl Read for LpuartRx<'_, Buffered>
impl Read for LpuartRx<'_, Buffered>
Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read moreSource§impl<'a> Read for LpuartRx<'a, Dma<'a>>
impl<'a> Read for LpuartRx<'a, Dma<'a>>
Source§async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
Source§async fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
async fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
buf. Read more