[][src]Struct gd32vf103xx_hal::serial::Serial

pub struct Serial<USART, TX, RX> { /* fields omitted */ }

Serial abstraction

Implementations

impl<USART: UsartX, TX, RX> Serial<USART, TX, RX>[src]

pub fn new<PINS>(
    usart: USART,
    pins: PINS,
    config: Config,
    afio: &mut Afio,
    rcu: &mut Rcu
) -> Self where
    PINS: Pins<USART, Tx = TX, Rx = RX>, 
[src]

Configures the serial interface and creates the interface struct.

pins is a tuple specifying transmit and receive pins. Current mode of these pins does not matter, as they are reconfigured during USART initialization.

config holds UART configuration such as the baud rate of the interface.

The Serial struct takes ownership over the USARTx device registers and the specified PINS

afio and rcu are register handles which are passed for configuration. (afio is used to map the USART to the corresponding pins. rcu is used to reset the USART.)

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

Starts listening to the USART by enabling the Received data ready to be read (RXNE) interrupt and Transmit data register empty (TXE) interrupt

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

Stops listening to the USART by disabling the Received data ready to be read (RXNE) interrupt and Transmit data register empty (TXE) interrupt

pub fn release(self) -> (USART, TX, RX)[src]

Returns ownership of the borrowed register handles

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

Separates the serial struct into separate channel objects for sending (Tx) and receiving (Rx)

Auto Trait Implementations

impl<USART, TX, RX> Send for Serial<USART, TX, RX> where
    RX: Send,
    TX: Send,
    USART: Send

impl<USART, TX, RX> Sync for Serial<USART, TX, RX> where
    RX: Sync,
    TX: Sync,
    USART: Sync

impl<USART, TX, RX> Unpin for Serial<USART, TX, RX> where
    RX: Unpin,
    TX: Unpin,
    USART: 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.