Struct esp_idf_hal::uart::UartRxDriver
source · pub struct UartRxDriver<'d> { /* private fields */ }
Expand description
Serial receiver
Implementations§
source§impl<'d> UartRxDriver<'d>
impl<'d> UartRxDriver<'d>
sourcepub fn new<UART: Uart>(
uart: impl Peripheral<P = UART> + '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>
pub fn new<UART: Uart>( uart: impl Peripheral<P = UART> + '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>
Create a new serial receiver
sourcepub fn event_queue(&self) -> Option<&Queue<UartEvent>>
pub fn event_queue(&self) -> Option<&Queue<UartEvent>>
Retrieves the event queue for this UART. Returns None
if
the config specified 0 for queue_size
.
sourcepub fn change_stop_bits(&self, stop_bits: StopBits) -> Result<&Self, EspError>
pub fn change_stop_bits(&self, stop_bits: StopBits) -> Result<&Self, EspError>
Change the number of stop bits
sourcepub fn change_data_bits(&self, data_bits: DataBits) -> Result<&Self, EspError>
pub fn change_data_bits(&self, data_bits: DataBits) -> Result<&Self, EspError>
Change the number of data bits
sourcepub fn change_parity(&self, parity: Parity) -> Result<&Self, EspError>
pub fn change_parity(&self, parity: Parity) -> Result<&Self, EspError>
Change the type of parity checking
sourcepub fn change_baudrate<T: Into<Hertz> + Copy>(
&self,
baudrate: T,
) -> Result<&Self, EspError>
pub fn change_baudrate<T: Into<Hertz> + Copy>( &self, baudrate: T, ) -> Result<&Self, EspError>
Change the baudrate.
Will automatically select the clock source. When possible the reference clock (1MHz) will be used, because this is constant when the clock source/frequency changes. However if one of the clock frequencies is below 10MHz or if the baudrate is above the reference clock or if the baudrate cannot be set within 1.5% then use the APB clock.
sourcepub fn read(&self, buf: &mut [u8], delay: TickType_t) -> Result<usize, EspError>
pub fn read(&self, buf: &mut [u8], delay: TickType_t) -> Result<usize, EspError>
Read multiple bytes into a slice; block until specified timeout
sourcepub fn flush(&self) -> Result<(), EspError>
👎Deprecated since 0.41.3: Use UartRxDriver::clear
instead
pub fn flush(&self) -> Result<(), EspError>
UartRxDriver::clear
insteadClears the receive buffer.
pub fn clear(&self) -> Result<(), EspError>
pub fn port(&self) -> uart_port_t
Trait Implementations§
source§impl<'d> Drop for UartRxDriver<'d>
impl<'d> Drop for UartRxDriver<'d>
source§impl<'d> ErrorType for UartRxDriver<'d>
impl<'d> ErrorType for UartRxDriver<'d>
§type Error = SerialError
type Error = SerialError
Error type
source§impl<'d> ErrorType for UartRxDriver<'d>
impl<'d> ErrorType for UartRxDriver<'d>
§type Error = EspIOError
type Error = EspIOError
Error type of all the IO operations on this type.
source§impl<'d> Read for UartRxDriver<'d>
impl<'d> Read for UartRxDriver<'d>
source§impl<'d> Read for UartRxDriver<'d>
impl<'d> Read for UartRxDriver<'d>
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error>
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§fn read_exact(
&mut self,
buf: &mut [u8],
) -> Result<(), ReadExactError<Self::Error>>
fn read_exact( &mut self, buf: &mut [u8], ) -> Result<(), ReadExactError<Self::Error>>
Read the exact number of bytes required to fill
buf
. Read more