Struct bitbang_hal::serial::Serial

source ·
pub struct Serial<TX, RX, Timer>
where TX: OutputPin, RX: InputPin, Timer: CountDown + Periodic,
{ /* private fields */ }
Expand description

Bit banging serial communication (USART) device

Implementations§

source§

impl<TX, RX, Timer, E> Serial<TX, RX, Timer>
where TX: OutputPin<Error = E>, RX: InputPin<Error = E>, Timer: CountDown + Periodic,

source

pub fn new(tx: TX, rx: RX, timer: Timer) -> Self

Create instance

Trait Implementations§

source§

impl<TX, RX, Timer, E> Read<u8> for Serial<TX, RX, Timer>
where TX: OutputPin<Error = E>, RX: InputPin<Error = E>, Timer: CountDown + Periodic,

§

type Error = Error<E>

Read error
source§

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

Reads a single word from the serial interface
source§

impl<TX, RX, Timer, E> Write<u8> for Serial<TX, RX, Timer>
where TX: OutputPin<Error = E>, RX: InputPin<Error = E>, Timer: CountDown + Periodic,

§

type Error = Error<E>

Write error
source§

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

Writes a single word to the serial interface
source§

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

Ensures that none of the previously written words are still buffered

Auto Trait Implementations§

§

impl<TX, RX, Timer> Freeze for Serial<TX, RX, Timer>
where TX: Freeze, RX: Freeze, Timer: Freeze,

§

impl<TX, RX, Timer> RefUnwindSafe for Serial<TX, RX, Timer>
where TX: RefUnwindSafe, RX: RefUnwindSafe, Timer: RefUnwindSafe,

§

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

§

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

§

impl<TX, RX, Timer> Unpin for Serial<TX, RX, Timer>
where TX: Unpin, RX: Unpin, Timer: Unpin,

§

impl<TX, RX, Timer> UnwindSafe for Serial<TX, RX, Timer>
where TX: UnwindSafe, RX: UnwindSafe, Timer: 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.