[][src]Struct esp32_hal::serial::Serial

pub struct Serial<UART: Instance, TX: OutputPin, RX: InputPin, CTS: InputPin = Gpio19<Input<Floating>>, RTS: OutputPin = Gpio22<Output<PushPull>>> { /* fields omitted */ }

Serial abstraction

Implementations

impl<UART: Instance, TX: OutputPin, RX: InputPin, CTS: InputPin, RTS: OutputPin> Serial<UART, TX, RX, CTS, RTS>[src]

pub fn new(
    uart: UART,
    pins: Pins<TX, RX, CTS, RTS>,
    config: Config,
    clock_control: ClockControlConfig
) -> Result<Self, Error>
[src]

Create a new serial driver

pub fn change_stop_bits(&mut self, stop_bits: StopBits) -> &mut Self[src]

Change the number of stop bits

pub fn change_data_bits(&mut self, data_bits: DataBits) -> &mut Self[src]

Change the number of data bits

pub fn change_parity(&mut self, parity: Parity) -> &mut Self[src]

Change the type of parity checking

pub fn change_baudrate<T: Into<Hertz> + Copy>(
    &mut self,
    baudrate: T
) -> Result<&mut Self, Error>
[src]

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.

pub fn change_baudrate_force_clock<T: Into<Hertz> + Copy>(
    &mut self,
    baudrate: T,
    use_apb_frequency: bool
) -> Result<&mut Self, Error>
[src]

Change the baudrate choosing the reference or APB clock manually

pub fn is_clock_apb(&self) -> bool[src]

Returns if the reference or APB clock is used

pub fn baudrate(&self) -> Hertz[src]

Returns the current baudrate

pub fn listen(&mut self, _event: Event)[src]

Starts listening for an interrupt event

pub fn unlisten(&mut self, _event: Event)[src]

Stop listening for an interrupt event

pub fn is_rx_idle(&self) -> bool[src]

Return true if the receiver is idle

pub fn is_tx_idle(&self) -> bool[src]

Return true if the transmitter is idle

pub fn split(self) -> (Tx<UART>, Rx<UART>)[src]

Split the serial driver in separate TX and RX drivers

pub fn release(self) -> (UART, Pins<TX, RX, CTS, RTS>)[src]

Release the UART and GPIO resources

pub fn reset_rx_fifo(&mut self)[src]

pub fn reset_tx_fifo(&self)[src]

Trait Implementations

impl<UART: Instance, TX: OutputPin, RX: InputPin, CTS: InputPin, RTS: OutputPin> Read<u8> for Serial<UART, TX, RX, CTS, RTS>[src]

type Error = Infallible

Read error

impl<UART: Instance, TX: OutputPin, RX: InputPin, CTS: InputPin, RTS: OutputPin> Write<u8> for Serial<UART, TX, RX, CTS, RTS>[src]

type Error = Infallible

Write error

impl<UART: Instance, TX: OutputPin, RX: InputPin, CTS: InputPin, RTS: OutputPin> Write for Serial<UART, TX, RX, CTS, RTS>[src]

Auto Trait Implementations

impl<UART, TX, RX, CTS, RTS> Send for Serial<UART, TX, RX, CTS, RTS> where
    CTS: Send,
    RTS: Send,
    RX: Send,
    TX: Send,
    UART: Send

impl<UART, TX, RX, CTS, RTS> Sync for Serial<UART, TX, RX, CTS, RTS> where
    CTS: Sync,
    RTS: Sync,
    RX: Sync,
    TX: Sync,
    UART: Sync

impl<UART, TX, RX, CTS, RTS> Unpin for Serial<UART, TX, RX, CTS, RTS> where
    CTS: Unpin,
    RTS: Unpin,
    RX: Unpin,
    TX: Unpin,
    UART: Unpin

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.