Struct Serial

Source
pub struct Serial<TX, RX, USART, PINS>
where TX: PinId, RX: PinId, USART: Usart, PINS: UsartPins<TX, RX, USART>,
{ /* private fields */ }
Expand description

USART peripheral operating as serial

Implementations§

Source§

impl<TX, RX, USART, PINS> Serial<TX, RX, USART, PINS>
where TX: PinId, RX: PinId, USART: Usart, PINS: UsartPins<TX, RX, USART>,

Source

pub fn new(usart: USART, pins: PINS, config: Config) -> Self

Source

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

Source

pub fn release(self) -> (USART, PINS)

Trait Implementations§

Source§

impl<TX, RX, USART, PINS> Read<u8> for Serial<TX, RX, USART, PINS>
where TX: PinId, RX: PinId, USART: Usart, PINS: UsartPins<TX, RX, USART>,

Source§

type Error = Error

Read error
Source§

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

Reads a single word from the serial interface
Source§

impl<TX, RX, USART, PINS> Write<u8> for Serial<TX, RX, USART, PINS>
where TX: PinId, RX: PinId, USART: Usart, PINS: UsartPins<TX, RX, USART>,

Source§

type Error = Error

Write error
Source§

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

Ensures that none of the previously written words are still buffered
Source§

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

Writes a single word to the serial interface

Auto Trait Implementations§

§

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

§

impl<TX, RX, USART, PINS> RefUnwindSafe for Serial<TX, RX, USART, PINS>

§

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

§

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

§

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

§

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