Struct Serial

Source
pub struct Serial<USART, PINS> { /* private fields */ }
Expand description

Serial abstraction

Implementations§

Source§

impl<TX, RX> Serial<USART1, (TX, RX)>

Source

pub fn usart1( usart: USART1, pins: (TX, RX), baud_rate: Bps, clocks: Clocks, apb: &mut APB2, ) -> Self
where TX: TxPin<USART1>, RX: RxPin<USART1>,

Configures a USART peripheral to provide serial communication

Source

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

Starts listening for an interrupt event

Source

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

Starts listening for an interrupt event

Source

pub fn split(self) -> (Tx<USART1>, Rx<USART1>)

Splits the Serial abstraction into a transmitter and a receiver half

Source

pub fn free(self) -> (USART1, (TX, RX))

Releases the USART peripheral and associated pins

Source§

impl<TX, RX> Serial<USART2, (TX, RX)>

Source

pub fn usart2( usart: USART2, pins: (TX, RX), baud_rate: Bps, clocks: Clocks, apb: &mut APB1, ) -> Self
where TX: TxPin<USART2>, RX: RxPin<USART2>,

Configures a USART peripheral to provide serial communication

Source

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

Starts listening for an interrupt event

Source

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

Starts listening for an interrupt event

Source

pub fn split(self) -> (Tx<USART2>, Rx<USART2>)

Splits the Serial abstraction into a transmitter and a receiver half

Source

pub fn free(self) -> (USART2, (TX, RX))

Releases the USART peripheral and associated pins

Source§

impl<TX, RX> Serial<USART3, (TX, RX)>

Source

pub fn usart3( usart: USART3, pins: (TX, RX), baud_rate: Bps, clocks: Clocks, apb: &mut APB1, ) -> Self
where TX: TxPin<USART3>, RX: RxPin<USART3>,

Configures a USART peripheral to provide serial communication

Source

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

Starts listening for an interrupt event

Source

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

Starts listening for an interrupt event

Source

pub fn split(self) -> (Tx<USART3>, Rx<USART3>)

Splits the Serial abstraction into a transmitter and a receiver half

Source

pub fn free(self) -> (USART3, (TX, RX))

Releases the USART peripheral and associated pins

Auto Trait Implementations§

§

impl<USART, PINS> Freeze for Serial<USART, PINS>
where USART: Freeze, PINS: Freeze,

§

impl<USART, PINS> RefUnwindSafe for Serial<USART, PINS>
where USART: RefUnwindSafe, PINS: RefUnwindSafe,

§

impl<USART, PINS> Send for Serial<USART, PINS>
where USART: Send, PINS: Send,

§

impl<USART, PINS> Sync for Serial<USART, PINS>
where USART: Sync, PINS: Sync,

§

impl<USART, PINS> Unpin for Serial<USART, PINS>
where USART: Unpin, PINS: Unpin,

§

impl<USART, PINS> UnwindSafe for Serial<USART, PINS>
where USART: UnwindSafe, PINS: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.