Struct esp_idf_svc::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: 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<UartRxDriver<'d>, EspError>where
UART: Uart,
pub fn new<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<UartRxDriver<'d>, EspError>where
UART: Uart,
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<&UartRxDriver<'d>, EspError>
pub fn change_stop_bits( &self, stop_bits: StopBits, ) -> Result<&UartRxDriver<'d>, EspError>
Change the number of stop bits
sourcepub fn change_data_bits(
&self,
data_bits: DataBits,
) -> Result<&UartRxDriver<'d>, EspError>
pub fn change_data_bits( &self, data_bits: DataBits, ) -> Result<&UartRxDriver<'d>, EspError>
Change the number of data bits
sourcepub fn change_parity(
&self,
parity: Parity,
) -> Result<&UartRxDriver<'d>, EspError>
pub fn change_parity( &self, parity: Parity, ) -> Result<&UartRxDriver<'d>, EspError>
Change the type of parity checking
sourcepub fn change_baudrate<T>(
&self,
baudrate: T,
) -> Result<&UartRxDriver<'d>, EspError>where
T: Into<Hertz> + Copy,
pub fn change_baudrate<T>(
&self,
baudrate: T,
) -> Result<&UartRxDriver<'d>, EspError>where
T: Into<Hertz> + Copy,
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: u32) -> Result<usize, EspError>
pub fn read(&self, buf: &mut [u8], delay: u32) -> 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) -> u32
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<u8> for UartRxDriver<'d>
impl<'d> Read<u8> for UartRxDriver<'d>
§type Error = SerialError
type Error = SerialError
Read error
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, <UartRxDriver<'d> as ErrorType>::Error>
fn read( &mut self, buf: &mut [u8], ) -> Result<usize, <UartRxDriver<'d> as ErrorType>::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