Type Alias embedded_hal_mock::eh1::spi::Mock
source · pub type Mock<W> = Generic<Transaction<W>>;
eh1
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<W> { /* private fields */ }
Trait Implementations§
source§impl<W> FullDuplex<W> for Mock<W>
impl<W> FullDuplex<W> for Mock<W>
source§impl<W> SpiBus<W> for Mock<W>
impl<W> SpiBus<W> for Mock<W>
source§fn read(&mut self, buffer: &mut [W]) -> Result<(), Self::Error>
fn read(&mut self, buffer: &mut [W]) -> Result<(), Self::Error>
spi::Read implementation for Mock
This will cause an assertion if the read call does not match the next expectation
source§fn write(&mut self, buffer: &[W]) -> Result<(), Self::Error>
fn write(&mut self, buffer: &[W]) -> Result<(), Self::Error>
spi::Write implementation for Mock
This will cause an assertion if the write call does not match the next expectation
source§fn transfer_in_place(&mut self, buffer: &mut [W]) -> Result<(), Self::Error>
fn transfer_in_place(&mut self, buffer: &mut [W]) -> Result<(), Self::Error>
spi::TransferInplace 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
source§impl<W> SpiBus<W> for Mock<W>
Available on crate feature embedded-hal-async
only.
impl<W> SpiBus<W> for Mock<W>
embedded-hal-async
only.source§async fn transfer_in_place(
&mut self,
words: &mut [W]
) -> Result<(), Self::Error>
async fn transfer_in_place( &mut self, words: &mut [W] ) -> Result<(), Self::Error>
spi::TransferInplace 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
source§async fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error>
async fn read(&mut self, words: &mut [W]) -> Result<(), Self::Error>
words
from the slave. Read moresource§async fn write(&mut self, words: &[W]) -> Result<(), Self::Error>
async fn write(&mut self, words: &[W]) -> Result<(), Self::Error>
words
to the slave, ignoring all the incoming words. Read moresource§impl<W> SpiDevice<W> for Mock<W>
impl<W> SpiDevice<W> for Mock<W>
source§fn transaction(
&mut self,
operations: &mut [Operation<'_, W>]
) -> Result<(), Self::Error>
fn transaction( &mut self, operations: &mut [Operation<'_, W>] ) -> Result<(), Self::Error>
spi::SpiDevice 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
source§fn read(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>
fn read(&mut self, buf: &mut [Word]) -> Result<(), Self::Error>
source§fn write(&mut self, buf: &[Word]) -> Result<(), Self::Error>
fn write(&mut self, buf: &[Word]) -> Result<(), Self::Error>
source§impl<W> SpiDevice<W> for Mock<W>
Available on crate feature embedded-hal-async
only.
impl<W> SpiDevice<W> for Mock<W>
embedded-hal-async
only.