Struct embassy_stm32::usart::Uart
source · pub struct Uart<'d, T: BasicInstance, TxDma = NoDma, RxDma = NoDma> { /* private fields */ }
Expand description
Bidirectional UART Driver
Implementations§
source§impl<'d, T: BasicInstance, TxDma, RxDma> Uart<'d, T, TxDma, RxDma>
impl<'d, T: BasicInstance, TxDma, RxDma> Uart<'d, T, TxDma, RxDma>
sourcepub fn new(
peri: impl Peripheral<P = T> + 'd,
rx: impl Peripheral<P = impl RxPin<T>> + 'd,
tx: impl Peripheral<P = impl TxPin<T>> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
tx_dma: impl Peripheral<P = TxDma> + 'd,
rx_dma: impl Peripheral<P = RxDma> + 'd,
config: Config
) -> Result<Self, ConfigError>
pub fn new( peri: impl Peripheral<P = T> + 'd, rx: impl Peripheral<P = impl RxPin<T>> + 'd, tx: impl Peripheral<P = impl TxPin<T>> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, tx_dma: impl Peripheral<P = TxDma> + 'd, rx_dma: impl Peripheral<P = RxDma> + 'd, config: Config ) -> Result<Self, ConfigError>
Create a new bidirectional UART
sourcepub fn new_with_rtscts(
peri: impl Peripheral<P = T> + 'd,
rx: impl Peripheral<P = impl RxPin<T>> + 'd,
tx: impl Peripheral<P = impl TxPin<T>> + 'd,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd,
rts: impl Peripheral<P = impl RtsPin<T>> + 'd,
cts: impl Peripheral<P = impl CtsPin<T>> + 'd,
tx_dma: impl Peripheral<P = TxDma> + 'd,
rx_dma: impl Peripheral<P = RxDma> + 'd,
config: Config
) -> Result<Self, ConfigError>
pub fn new_with_rtscts( peri: impl Peripheral<P = T> + 'd, rx: impl Peripheral<P = impl RxPin<T>> + 'd, tx: impl Peripheral<P = impl TxPin<T>> + 'd, _irq: impl Binding<T::Interrupt, InterruptHandler<T>> + 'd, rts: impl Peripheral<P = impl RtsPin<T>> + 'd, cts: impl Peripheral<P = impl CtsPin<T>> + 'd, tx_dma: impl Peripheral<P = TxDma> + 'd, rx_dma: impl Peripheral<P = RxDma> + 'd, config: Config ) -> Result<Self, ConfigError>
Create a new bidirectional UART with request-to-send and clear-to-send pins
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 write
sourcepub fn blocking_flush(&mut self) -> Result<(), Error>
pub fn blocking_flush(&mut self) -> Result<(), Error>
Block until transmission complete
sourcepub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error>where
RxDma: RxDma<T>,
pub async fn read(&mut self, buffer: &mut [u8]) -> Result<(), Error>where
RxDma: RxDma<T>,
Initiate an asynchronous read into buffer
sourcepub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
pub fn blocking_read(&mut self, buffer: &mut [u8]) -> Result<(), Error>
Perform a blocking read into buffer
Trait Implementations§
source§impl<T, TxDma, RxDma> ErrorType for Uart<'_, T, TxDma, RxDma>where
T: BasicInstance,
impl<T, TxDma, RxDma> ErrorType for Uart<'_, T, TxDma, RxDma>where
T: BasicInstance,
source§impl<'d, T: BasicInstance, TxDma, RxDma> ErrorType for Uart<'d, T, TxDma, RxDma>
impl<'d, T: BasicInstance, TxDma, RxDma> ErrorType for Uart<'d, T, TxDma, RxDma>
source§impl<'d, T: BasicInstance, TxDma, RxDma> Read for Uart<'d, T, TxDma, RxDma>
impl<'d, T: BasicInstance, TxDma, RxDma> Read for Uart<'d, T, TxDma, RxDma>
source§impl<'d, T: BasicInstance, TxDma, RxDma> SetConfig for Uart<'d, T, TxDma, RxDma>
impl<'d, T: BasicInstance, TxDma, RxDma> SetConfig for Uart<'d, T, TxDma, RxDma>
§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, RxDma> Write for Uart<'_, T, TxDma, RxDma>where
T: BasicInstance,
TxDma: TxDma<T>,
impl<T, TxDma, RxDma> Write for Uart<'_, T, TxDma, RxDma>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<T, TxDma, RxDma> Write for Uart<'_, T, TxDma, RxDma>where
T: BasicInstance,
TxDma: TxDma<T>,
impl<T, TxDma, RxDma> Write for Uart<'_, T, TxDma, RxDma>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<'d, T: BasicInstance, TxDma, RxDma> Write for Uart<'d, T, TxDma, RxDma>
impl<'d, T: BasicInstance, TxDma, RxDma> Write for Uart<'d, T, TxDma, RxDma>
Auto Trait Implementations§
impl<'d, T, TxDma, RxDma> Freeze for Uart<'d, T, TxDma, RxDma>
impl<'d, T, TxDma, RxDma> RefUnwindSafe for Uart<'d, T, TxDma, RxDma>
impl<'d, T, TxDma, RxDma> Send for Uart<'d, T, TxDma, RxDma>
impl<'d, T, TxDma, RxDma> Sync for Uart<'d, T, TxDma, RxDma>
impl<'d, T, TxDma, RxDma> Unpin for Uart<'d, T, TxDma, RxDma>
impl<'d, T, TxDma = NoDma, RxDma = NoDma> !UnwindSafe for Uart<'d, T, TxDma, RxDma>
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