pub struct Lpuart<'a, M: Mode> { /* private fields */ }Expand description
Lpuart driver.
Implementations§
Source§impl<'a> Lpuart<'a, Blocking>
impl<'a> Lpuart<'a, Blocking>
Sourcepub fn new_blocking<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
rx_pin: Peri<'a, impl RxPin<T>>,
config: Config,
) -> Result<Self, Error>
pub fn new_blocking<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, rx_pin: Peri<'a, impl RxPin<T>>, config: Config, ) -> Result<Self, Error>
Create a new blocking LPUART instance with RX/TX pins.
Any external pin will be placed into Disabled state upon Drop.
Sourcepub fn new_blocking_with_rtscts<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
rx_pin: Peri<'a, impl RxPin<T>>,
cts_pin: Peri<'a, impl CtsPin<T>>,
rts_pin: Peri<'a, impl RtsPin<T>>,
config: Config,
) -> Result<Self, Error>
pub fn new_blocking_with_rtscts<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, rx_pin: Peri<'a, impl RxPin<T>>, cts_pin: Peri<'a, impl CtsPin<T>>, rts_pin: Peri<'a, impl RtsPin<T>>, config: Config, ) -> Result<Self, Error>
Create a new blocking LPUART instance with RX, TX and RTS/CTS flow control pins.
Any external pin will be placed into Disabled state upon Drop.
Sourcepub fn blocking_read(&mut self, buf: &mut [u8]) -> Result<(), Error>
pub fn blocking_read(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read data from LPUART RX blocking execution until the buffer is filled
Sourcepub fn read(&mut self, buf: &mut [u8]) -> Result<(), Error>
pub fn read(&mut self, buf: &mut [u8]) -> Result<(), Error>
Read data from LPUART RX without blocking
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_byte(&mut self, byte: u8) -> Result<(), Error>
pub fn read_byte_blocking(&mut self) -> u8
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> Lpuart<'a, Buffered>
impl<'a> Lpuart<'a, Buffered>
Sourcepub fn new_buffered<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
rx_pin: Peri<'a, impl RxPin<T>>,
_irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a,
tx_buffer: &'a mut [u8],
rx_buffer: &'a mut [u8],
config: Config,
) -> Result<Self, Error>
pub fn new_buffered<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, rx_pin: Peri<'a, impl RxPin<T>>, _irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a, tx_buffer: &'a mut [u8], rx_buffer: &'a mut [u8], config: Config, ) -> Result<Self, Error>
Create a new full duplex buffered LPUART.
Any external pin will be placed into Disabled state upon Drop.
§SAFETY
You must NOT call core::mem::forget on Lpuart if rx_buffer or tx_buffer are not
'static. This will cause memory corruption.
Sourcepub fn new_buffered_with_rtscts<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
rx_pin: Peri<'a, impl RxPin<T>>,
rts_pin: Peri<'a, impl RtsPin<T>>,
cts_pin: Peri<'a, impl CtsPin<T>>,
_irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a,
tx_buffer: &'a mut [u8],
rx_buffer: &'a mut [u8],
config: Config,
) -> Result<Self, Error>
pub fn new_buffered_with_rtscts<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, rx_pin: Peri<'a, impl RxPin<T>>, rts_pin: Peri<'a, impl RtsPin<T>>, cts_pin: Peri<'a, impl CtsPin<T>>, _irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a, tx_buffer: &'a mut [u8], rx_buffer: &'a mut [u8], config: Config, ) -> Result<Self, Error>
Create a new buffered LPUART instance with RTS/CTS flow control.
Any external pin will be placed into Disabled state upon Drop.
§SAFETY
You must NOT call core::mem::forget on Lpuart if rx_buffer or tx_buffer are not
'static. This will cause memory corruption.
Sourcepub fn new_buffered_with_rts<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
rx_pin: Peri<'a, impl RxPin<T>>,
rts_pin: Peri<'a, impl RtsPin<T>>,
_irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a,
tx_buffer: &'a mut [u8],
rx_buffer: &'a mut [u8],
config: Config,
) -> Result<Self, Error>
pub fn new_buffered_with_rts<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, rx_pin: Peri<'a, impl RxPin<T>>, rts_pin: Peri<'a, impl RtsPin<T>>, _irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a, tx_buffer: &'a mut [u8], rx_buffer: &'a mut [u8], config: Config, ) -> Result<Self, Error>
Create a new buffered LPUART with only RTS flow control (RX flow control).
Any external pin will be placed into Disabled state upon Drop.
§SAFETY
You must NOT call core::mem::forget on Lpuart if rx_buffer or tx_buffer are not
'static. This will cause memory corruption.
Sourcepub fn new_buffered_with_cts<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
rx_pin: Peri<'a, impl RxPin<T>>,
cts_pin: Peri<'a, impl CtsPin<T>>,
_irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a,
tx_buffer: &'a mut [u8],
rx_buffer: &'a mut [u8],
config: Config,
) -> Result<Self, Error>
pub fn new_buffered_with_cts<T: Instance>( _inner: Peri<'a, T>, tx_pin: Peri<'a, impl TxPin<T>>, rx_pin: Peri<'a, impl RxPin<T>>, cts_pin: Peri<'a, impl CtsPin<T>>, _irq: impl Binding<T::Interrupt, BufferedInterruptHandler<T>> + 'a, tx_buffer: &'a mut [u8], rx_buffer: &'a mut [u8], config: Config, ) -> Result<Self, Error>
Create a new buffered LPUART with only CTS flow control (TX flow control).
Any external pin will be placed into Disabled state upon Drop.
§SAFETY
You must NOT call core::mem::forget on Lpuart if rx_buffer or tx_buffer are not
'static. This will cause memory corruption.
Source§impl<'a> Lpuart<'a, Dma<'a>>
impl<'a> Lpuart<'a, Dma<'a>>
Sourcepub fn new_async_with_dma<T: Instance>(
_inner: Peri<'a, T>,
tx_pin: Peri<'a, impl TxPin<T>>,
rx_pin: Peri<'a, impl RxPin<T>>,
tx_dma_ch: Peri<'a, impl Channel>,
rx_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>>, rx_pin: Peri<'a, impl RxPin<T>>, tx_dma_ch: Peri<'a, impl Channel>, rx_dma_ch: Peri<'a, impl Channel>, config: Config, ) -> Result<Self, Error>
Create a new LPUART driver with DMA support for both TX and RX.
Any external pin will be placed into Disabled state upon Drop.
Trait Implementations§
Source§impl Read for Lpuart<'_, Blocking>
impl Read for Lpuart<'_, 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 Lpuart<'_, Buffered>
impl Read for Lpuart<'_, 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 Lpuart<'a, Dma<'a>>
impl<'a> Read for Lpuart<'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