Struct esp_idf_hal::uart::AsyncUartDriver
source · pub struct AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,{ /* private fields */ }
Implementations§
source§impl<'d> AsyncUartDriver<'d, UartDriver<'d>>
impl<'d> AsyncUartDriver<'d, UartDriver<'d>>
pub fn new( uart: impl Peripheral<P = impl Uart> + 'd, tx: impl Peripheral<P = impl OutputPin> + 'd, rx: impl Peripheral<P = impl InputPin> + 'd, cts: Option<impl Peripheral<P = impl InputPin> + 'd>, rts: Option<impl Peripheral<P = impl OutputPin> + 'd>, config: &Config, ) -> Result<Self, EspError>
source§impl<'d, T> AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
impl<'d, T> AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
pub fn wrap(driver: T) -> Result<Self, EspError>
pub fn wrap_custom( driver: T, priority: Option<u8>, pin_to_core: Option<Core>, ) -> Result<Self, EspError>
pub fn driver(&self) -> &UartDriver<'d>
pub fn driver_mut(&mut self) -> &mut UartDriver<'d>
sourcepub fn split(
&mut self,
) -> (AsyncUartTxDriver<'_, UartTxDriver<'_>>, AsyncUartRxDriver<'_, UartRxDriver<'_>>)
pub fn split( &mut self, ) -> (AsyncUartTxDriver<'_, UartTxDriver<'_>>, AsyncUartRxDriver<'_, UartRxDriver<'_>>)
Split the serial driver in separate TX and RX drivers
pub async fn read(&self, buf: &mut [u8]) -> Result<usize, EspError>
pub async fn write(&self, bytes: &[u8]) -> Result<usize, EspError>
pub async fn wait_tx_done(&self) -> Result<(), EspError>
Trait Implementations§
source§impl<'d, T> Drop for AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
impl<'d, T> Drop for AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
source§impl<'d, T> ErrorType for AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
impl<'d, T> ErrorType for AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
§type Error = EspIOError
type Error = EspIOError
Error type of all the IO operations on this type.
source§impl<'d, T> Read for AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
impl<'d, T> Read for AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
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>
Read some bytes from this source into the specified buffer, returning how many bytes were read. Read more
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>>
Read the exact number of bytes required to fill
buf
. Read moresource§impl<'d, T> Write for AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
impl<'d, T> Write for AsyncUartDriver<'d, T>where
T: BorrowMut<UartDriver<'d>>,
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