[][src]Struct stm32f072b_disco::serial::Serial

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

Serial abstraction

Methods

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

pub fn split(self) -> (Tx<USART>, Rx<USART>) where
    RXPIN: RxPin<USART>,
    TXPIN: TxPin<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]

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

pub fn usart1(
    usart: USART1,
    pins: (TXPIN, RXPIN),
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Serial<USART1, TXPIN, RXPIN>
[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
) -> Serial<USART1, TXPIN, ()>
[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
) -> Serial<USART1, (), RXPIN>
[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
    RXPIN: RxPin<USART2>,
    TXPIN: TxPin<USART2>, 
[src]

pub fn usart2(
    usart: USART2,
    pins: (TXPIN, RXPIN),
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Serial<USART2, TXPIN, RXPIN>
[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
) -> Serial<USART2, TXPIN, ()>
[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
) -> Serial<USART2, (), RXPIN>
[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<TXPIN, RXPIN> Serial<USART3, TXPIN, RXPIN> where
    RXPIN: RxPin<USART3>,
    TXPIN: TxPin<USART3>, 
[src]

pub fn usart3(
    usart: USART3,
    pins: (TXPIN, RXPIN),
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Serial<USART3, TXPIN, RXPIN>
[src]

Creates a new serial instance

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

pub fn usart3tx(
    usart: USART3,
    txpin: TXPIN,
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Serial<USART3, TXPIN, ()>
[src]

Creates a new tx-only serial instance

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

pub fn usart3rx(
    usart: USART3,
    rxpin: RXPIN,
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Serial<USART3, (), RXPIN>
[src]

Creates a new tx-only serial instance

impl<TXPIN, RXPIN> Serial<USART3, 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<USART4, TXPIN, RXPIN> where
    RXPIN: RxPin<USART4>,
    TXPIN: TxPin<USART4>, 
[src]

pub fn usart4(
    usart: USART4,
    pins: (TXPIN, RXPIN),
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Serial<USART4, TXPIN, RXPIN>
[src]

Creates a new serial instance

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

pub fn usart4tx(
    usart: USART4,
    txpin: TXPIN,
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Serial<USART4, TXPIN, ()>
[src]

Creates a new tx-only serial instance

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

pub fn usart4rx(
    usart: USART4,
    rxpin: RXPIN,
    baud_rate: Bps,
    rcc: &mut Rcc
) -> Serial<USART4, (), RXPIN>
[src]

Creates a new tx-only serial instance

impl<TXPIN, RXPIN> Serial<USART4, 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

Trait Implementations

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

fn write_char(&mut self, c: char) -> Result<(), Error>
1.1.0
[src]

Writes a [char] into this writer, returning whether the write succeeded. Read more

fn write_fmt(&mut self, args: Arguments) -> Result<(), Error>
1.0.0
[src]

Glue for usage of the [write!] macro with implementors of this trait. Read more

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

type Error = Error

Read error

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

Tries to read a byte from the uart

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

type Error = Void

Write error

fn flush(
    &mut self
) -> Result<(), Error<<Serial<USART, TXPIN, RXPIN> as Write<u8>>::Error>>
[src]

Ensures that none of the previously written words are still buffered

fn write(
    &mut self,
    byte: u8
) -> Result<(), Error<<Serial<USART, TXPIN, RXPIN> as Write<u8>>::Error>>
[src]

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

Auto Trait Implementations

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> From for T[src]

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

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

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

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

impl<T> Same for T

type Output = T

Should always be Self