Struct esp32c3_hal::Uart
source · pub struct Uart<'d, T> { /* private fields */ }
Expand description
UART driver
Implementations§
source§impl<'d, T> Uart<'d, T>where
T: Instance,
impl<'d, T> Uart<'d, T>where T: Instance,
sourcepub fn new_with_config<P>(
_uart: impl Peripheral<P = T> + 'd,
config: Config,
pins: Option<P>,
clocks: &Clocks<'_>
) -> Uart<'d, T>where
P: UartPins,
pub fn new_with_config<P>( _uart: impl Peripheral<P = T> + 'd, config: Config, pins: Option<P>, clocks: &Clocks<'_> ) -> Uart<'d, T>where P: UartPins,
Create a new UART instance with defaults
sourcepub fn new(
uart: impl Peripheral<P = T> + 'd,
clocks: &Clocks<'_>
) -> Uart<'d, T>
pub fn new( uart: impl Peripheral<P = T> + 'd, clocks: &Clocks<'_> ) -> Uart<'d, T>
Create a new UART instance with defaults
sourcepub fn split(self) -> (UartTx<'d, T>, UartRx<'d, T>)
pub fn split(self) -> (UartTx<'d, T>, UartRx<'d, T>)
Split the Uart into a transmitter and receiver, which is particuarly useful when having two tasks correlating to transmitting and receiving.
sourcepub fn set_at_cmd(&mut self, config: AtCmdConfig)
pub fn set_at_cmd(&mut self, config: AtCmdConfig)
Configures the AT-CMD detection settings.
sourcepub fn set_rx_fifo_full_threshold(
&mut self,
threshold: u16
) -> Result<(), Error>
pub fn set_rx_fifo_full_threshold( &mut self, threshold: u16 ) -> Result<(), Error>
Configures the RX-FIFO threshold
Errors
Err(Error::InvalidArgument)
if provided value exceeds maximum value
for SOC :
esp32
0x7Fesp32c6
,esp32h2
0xFFesp32c3
,esp32c2
,esp32s2
0x1FFesp32s3
0x3FF
sourcepub fn listen_at_cmd(&mut self)
pub fn listen_at_cmd(&mut self)
Listen for AT-CMD interrupts
sourcepub fn unlisten_at_cmd(&mut self)
pub fn unlisten_at_cmd(&mut self)
Stop listening for AT-CMD interrupts
sourcepub fn listen_tx_done(&mut self)
pub fn listen_tx_done(&mut self)
Listen for TX-DONE interrupts
sourcepub fn unlisten_tx_done(&mut self)
pub fn unlisten_tx_done(&mut self)
Stop listening for TX-DONE interrupts
sourcepub fn listen_rx_fifo_full(&mut self)
pub fn listen_rx_fifo_full(&mut self)
Listen for RX-FIFO-FULL interrupts
sourcepub fn unlisten_rx_fifo_full(&mut self)
pub fn unlisten_rx_fifo_full(&mut self)
Stop listening for RX-FIFO-FULL interrupts
sourcepub fn at_cmd_interrupt_set(&self) -> bool
pub fn at_cmd_interrupt_set(&self) -> bool
Checks if AT-CMD interrupt is set
sourcepub fn tx_done_interrupt_set(&self) -> bool
pub fn tx_done_interrupt_set(&self) -> bool
Checks if TX-DONE interrupt is set
sourcepub fn rx_fifo_full_interrupt_set(&self) -> bool
pub fn rx_fifo_full_interrupt_set(&self) -> bool
Checks if RX-FIFO-FULL interrupt is set
sourcepub fn reset_at_cmd_interrupt(&self)
pub fn reset_at_cmd_interrupt(&self)
Reset AT-CMD interrupt
sourcepub fn reset_tx_done_interrupt(&self)
pub fn reset_tx_done_interrupt(&self)
Reset TX-DONE interrupt
sourcepub fn reset_rx_fifo_full_interrupt(&self)
pub fn reset_rx_fifo_full_interrupt(&self)
Reset RX-FIFO-FULL interrupt
sourcepub fn change_stop_bits(&mut self, stop_bits: StopBits) -> &mut Uart<'d, T>
pub fn change_stop_bits(&mut self, stop_bits: StopBits) -> &mut Uart<'d, T>
Change the number of stop bits