Struct embedded_hal_mock::I2cMock
[−]
[src]
pub struct I2cMock<'a> { /* fields omitted */ }
Methods
impl<'a> I2cMock<'a>
[src]
pub fn new() -> Self
[src]
pub fn set_read_data(&mut self, data: &'a [u8])
[src]
Set data that will be read by read()
.
pub fn get_write_data(&self) -> &[u8]
[src]
Return the data that was written by the last write command.
pub fn get_last_address(&self) -> Option<u8>
[src]
Return the address that was used by the last read or write command.
Trait Implementations
impl<'a> Read for I2cMock<'a>
[src]
type Error = MockError
Error type
fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error>
[src]
Reads enough bytes from slave with address
to fill buffer
Read more
impl<'a> Write for I2cMock<'a>
[src]
type Error = MockError
Error type
fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
[src]
Sends bytes to slave with address addr
Read more