opentitanlib::test_utils::bitbanging::spi

Struct SpiBitbangDecoder

Source
pub struct SpiBitbangDecoder<const D0: u8, const D1: u8, const D2: u8, const D3: u8, const CLK: u8, const CS: u8> {
    pub config: SpiBitbangConfig,
    pub endpoint: SpiEndpoint,
}
Expand description

A decoder for SPI transmissions, parameterized over bits in input sample bitfields of SPI transmissions.

Fields§

§config: SpiBitbangConfig§endpoint: SpiEndpoint

Implementations§

Source§

impl<const D0: u8, const D1: u8, const D2: u8, const D3: u8, const CLK: u8, const CS: u8> SpiBitbangDecoder<D0, D1, D2, D3, CLK, CS>

Source

pub fn new(config: SpiBitbangConfig, endpoint: SpiEndpoint) -> Self

Source

pub fn set_data_mode(&mut self, mode: SpiDataMode)

Source

pub fn run(&self, samples: Vec<u8>) -> Result<Vec<u8>, SpiTransferDecodeError>

Decode a full SPI transmission from input GPIO samples, which may contain many SPI words. Expects CS to be deasserted by the end of all transactions. Returns the SPI words as a vector of bytes, using the LSBs for partial bytes (e.g. for 12-bit words, the mask is [0xFF, 0X0F, …]).

Auto Trait Implementations§

§

impl<const D0: u8, const D1: u8, const D2: u8, const D3: u8, const CLK: u8, const CS: u8> Freeze for SpiBitbangDecoder<D0, D1, D2, D3, CLK, CS>

§

impl<const D0: u8, const D1: u8, const D2: u8, const D3: u8, const CLK: u8, const CS: u8> RefUnwindSafe for SpiBitbangDecoder<D0, D1, D2, D3, CLK, CS>

§

impl<const D0: u8, const D1: u8, const D2: u8, const D3: u8, const CLK: u8, const CS: u8> Send for SpiBitbangDecoder<D0, D1, D2, D3, CLK, CS>

§

impl<const D0: u8, const D1: u8, const D2: u8, const D3: u8, const CLK: u8, const CS: u8> Sync for SpiBitbangDecoder<D0, D1, D2, D3, CLK, CS>

§

impl<const D0: u8, const D1: u8, const D2: u8, const D3: u8, const CLK: u8, const CS: u8> Unpin for SpiBitbangDecoder<D0, D1, D2, D3, CLK, CS>

§

impl<const D0: u8, const D1: u8, const D2: u8, const D3: u8, const CLK: u8, const CS: u8> UnwindSafe for SpiBitbangDecoder<D0, D1, D2, D3, CLK, CS>

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