Type Alias embedded_hal_mock::eh0::spi::Mock

source ·
pub type Mock = Generic<Transaction>;
Available on crate feature eh0 only.
Expand description

Mock SPI implementation

This supports the specification and checking of expectations to allow automated testing of SPI based drivers. Mismatches between expected and real SPI transactions will cause runtime assertions to assist with locating faults.

See the usage section in the module level docs for an example.

Aliased Type§

struct Mock { /* private fields */ }

Trait Implementations§

source§

impl WriteIter<u8> for Mock

§

type Error = MockError

Error type
source§

fn write_iter<WI>(&mut self, words: WI) -> Result<(), Self::Error>
where WI: IntoIterator<Item = u8>,

Sends words to the slave, ignoring all the incoming words
source§

impl Transfer<u8> for Mock

source§

fn transfer<'w>( &mut self, buffer: &'w mut [u8] ) -> Result<&'w [u8], Self::Error>

spi::Transfer implementation for Mock

This writes the provided response to the buffer and will cause an assertion if the written data does not match the next expectation

§

type Error = MockError

Error type
source§

impl Write<u8> for Mock

source§

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

spi::Write implementation for Mock

This will cause an assertion if the write call does not match the next expectation

§

type Error = MockError

Error type
source§

impl FullDuplex<u8> for Mock

source§

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

spi::FullDuplex implementeation for Mock

This will call the nonblocking read/write primitives.

source§

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

spi::FullDuplex implementeation for Mock

This will call the nonblocking read/write primitives.

§

type Error = MockError

An enumeration of SPI errors