[][src]Struct stm32f0xx_hal::serial::Serial

pub struct Serial<USART, TXPIN, RXPIN> { /* fields omitted */ }

Serial abstraction

Methods

impl<TXPIN, RXPIN> Serial<USART1, TXPIN, RXPIN> where
    TXPIN: TxPin<USART1>,
    RXPIN: RxPin<USART1>, 
[src]

pub fn usart1(
    usart: USART1,
    pins: (TXPIN, RXPIN),
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Self
[src]

Creates a new serial instance

impl<TXPIN> Serial<USART1, TXPIN, ()> where
    TXPIN: TxPin<USART1>, 
[src]

pub fn usart1tx(
    usart: USART1,
    txpin: TXPIN,
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Self
[src]

Creates a new tx-only serial instance

impl<RXPIN> Serial<USART1, (), RXPIN> where
    RXPIN: RxPin<USART1>, 
[src]

pub fn usart1rx(
    usart: USART1,
    rxpin: RXPIN,
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Self
[src]

Creates a new tx-only serial instance

impl<TXPIN, RXPIN> Serial<USART1, TXPIN, RXPIN>[src]

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

impl<TXPIN, RXPIN> Serial<USART2, TXPIN, RXPIN> where
    TXPIN: TxPin<USART2>,
    RXPIN: RxPin<USART2>, 
[src]

pub fn usart2(
    usart: USART2,
    pins: (TXPIN, RXPIN),
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Self
[src]

Creates a new serial instance

impl<TXPIN> Serial<USART2, TXPIN, ()> where
    TXPIN: TxPin<USART2>, 
[src]

pub fn usart2tx(
    usart: USART2,
    txpin: TXPIN,
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Self
[src]

Creates a new tx-only serial instance

impl<RXPIN> Serial<USART2, (), RXPIN> where
    RXPIN: RxPin<USART2>, 
[src]

pub fn usart2rx(
    usart: USART2,
    rxpin: RXPIN,
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Self
[src]

Creates a new tx-only serial instance

impl<TXPIN, RXPIN> Serial<USART2, TXPIN, RXPIN>[src]

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

impl<USART, TXPIN, RXPIN> Serial<USART, TXPIN, RXPIN> where
    USART: Deref<Target = RegisterBlock>, 
[src]

pub fn split(self) -> (Tx<USART>, Rx<USART>) where
    TXPIN: TxPin<USART>,
    RXPIN: RxPin<USART>, 
[src]

Splits the UART Peripheral in a Tx and an Rx part This is required for sending/receiving

pub fn release(self) -> (USART, (TXPIN, RXPIN))[src]

Trait Implementations

impl<USART, TXPIN, RXPIN> Write for Serial<USART, TXPIN, RXPIN> where
    USART: Deref<Target = RegisterBlock>,
    TXPIN: TxPin<USART>, 
[src]

impl<USART, TXPIN, RXPIN> Read<u8> for Serial<USART, TXPIN, RXPIN> where
    USART: Deref<Target = RegisterBlock>,
    RXPIN: RxPin<USART>, 
[src]

type Error = Error

Read error

fn read(&mut self) -> Result<u8, Error>[src]

Tries to read a byte from the uart

impl<USART, TXPIN, RXPIN> Write<u8> for Serial<USART, TXPIN, RXPIN> where
    USART: Deref<Target = RegisterBlock>,
    TXPIN: TxPin<USART>, 
[src]

type Error = Void

Write error

fn flush(&mut self) -> Result<(), Self::Error>[src]

Ensures that none of the previously written words are still buffered

fn write(&mut self, byte: u8) -> Result<(), Self::Error>[src]

Tries to write a byte to the uart Fails if the transmit buffer is full

Auto Trait Implementations

impl<USART, TXPIN, RXPIN> Unpin for Serial<USART, TXPIN, RXPIN> where
    RXPIN: Unpin,
    TXPIN: Unpin,
    USART: Unpin

impl<USART, TXPIN, RXPIN> Send for Serial<USART, TXPIN, RXPIN> where
    RXPIN: Send,
    TXPIN: Send,
    USART: Send

impl<USART, TXPIN, RXPIN> Sync for Serial<USART, TXPIN, RXPIN> where
    RXPIN: Sync,
    TXPIN: Sync,
    USART: Sync

Blanket Implementations

impl<T> From<T> for 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> Into<U> for T where
    U: From<T>, 
[src]

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.

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self