opentitanlib::test_utils::bitbanging::uart

Struct UartBitbangDecoder

Source
pub struct UartBitbangDecoder<const RX: u8> {
    pub config: UartBitbangConfig,
    /* private fields */
}
Expand description

A decoder for decoding UART samples. RX is the bit in the input sample bitfield to use for RX transmissions.

Fields§

§config: UartBitbangConfig

Implementations§

Source§

impl<const RX: u8> UartBitbangDecoder<RX>

Source

pub fn new(config: UartBitbangConfig) -> Self

Source

pub fn decode_sample(&mut self, sample: u8) -> Result<Option<UartTransfer>>

Given a sampled waveform (where bit RX is the UART RX), advance the UART decoder state based on the contents of the sample. If the sample is the final stop bit, return the decoded UART transfer.

Source

pub fn decode_samples(&mut self, samples: &Vec<u8>) -> Result<Vec<UartTransfer>>

A helper function to decode a sequence of UART waveform samples, advancing the decoder based on the contents. If the sample contains any final stop bits, the decoded UART transfers are returned.

Source

pub fn is_idle(&self) -> bool

Check if the decoder is currently in the idle state or not

Source

pub fn reset(&mut self)

Reset the state of decoder

Auto Trait Implementations§

§

impl<const RX: u8> Freeze for UartBitbangDecoder<RX>

§

impl<const RX: u8> RefUnwindSafe for UartBitbangDecoder<RX>

§

impl<const RX: u8> Send for UartBitbangDecoder<RX>

§

impl<const RX: u8> Sync for UartBitbangDecoder<RX>

§

impl<const RX: u8> Unpin for UartBitbangDecoder<RX>

§

impl<const RX: u8> UnwindSafe for UartBitbangDecoder<RX>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V