Type Alias Mock

Source
pub type Mock = Generic<Transaction>;
Available on crate feature eh1 only.
Expand description

Mock I2C implementation

This supports the specification and evaluation of expectations to allow automated testing of I2C based drivers. Mismatches between expectations will cause runtime assertions to assist in locating the source of the fault.

Aliased Type§

pub struct Mock { /* private fields */ }

Trait Implementations§

Source§

impl ErrorType for Mock

Source§

type Error = ErrorKind

Error type
Source§

impl I2c for Mock

Source§

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

Reads enough bytes from slave with address to fill read. Read more
Source§

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

Writes bytes to slave with address address. Read more
Source§

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

Writes bytes to slave with address address and then reads enough bytes to fill read in a single transaction. Read more
Source§

fn transaction<'a>( &mut self, address: u8, operations: &mut [Operation<'a>], ) -> Result<(), Self::Error>

Execute the provided operations on the I2C bus. Read more
Source§

impl I2c for Mock

Available on crate feature embedded-hal-async only.
Source§

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

Reads enough bytes from slave with address to fill buffer. Read more
Source§

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

Writes bytes to slave with address address. Read more
Source§

async fn write_read( &mut self, address: u8, bytes: &[u8], buffer: &mut [u8], ) -> Result<(), Self::Error>

Writes bytes to slave with address address and then reads enough bytes to fill read in a single transaction. Read more
Source§

async fn transaction<'a>( &mut self, address: u8, operations: &mut [Operation<'a>], ) -> Result<(), Self::Error>

Execute the provided operations on the I2C bus as a single transaction. Read more