pub struct MockI2CDevice {
pub regmap: I2CRegisterMap,
}Expand description
Mock I2C device exposing a register map
Fields§
§regmap: I2CRegisterMapI2C register map
Implementations§
Source§impl MockI2CDevice
impl MockI2CDevice
Sourcepub fn new() -> MockI2CDevice
pub fn new() -> MockI2CDevice
Create a new mock I2C device
Trait Implementations§
Source§impl Default for MockI2CDevice
impl Default for MockI2CDevice
Source§fn default() -> MockI2CDevice
fn default() -> MockI2CDevice
Returns the “default value” for a type. Read more
Source§impl I2CDevice for MockI2CDevice
impl I2CDevice for MockI2CDevice
Source§fn read(&mut self, data: &mut [u8]) -> I2CResult<()>
fn read(&mut self, data: &mut [u8]) -> I2CResult<()>
Read data from the device to fill the provided slice
Source§fn smbus_write_quick(&mut self, _bit: bool) -> I2CResult<()>
fn smbus_write_quick(&mut self, _bit: bool) -> I2CResult<()>
This sends a single bit to the device, at the place of the Rd/Wr bit
Source§fn smbus_read_block_data(&mut self, _register: u8) -> I2CResult<Vec<u8>>
fn smbus_read_block_data(&mut self, _register: u8) -> I2CResult<Vec<u8>>
Read a block of up to 32 bytes from a device Read more
Source§fn smbus_write_block_data(
&mut self,
_register: u8,
_values: &[u8],
) -> I2CResult<()>
fn smbus_write_block_data( &mut self, _register: u8, _values: &[u8], ) -> I2CResult<()>
Write a block of up to 32 bytes to a device Read more
Source§fn smbus_process_block(
&mut self,
_register: u8,
_values: &[u8],
) -> I2CResult<Vec<u8>>
fn smbus_process_block( &mut self, _register: u8, _values: &[u8], ) -> I2CResult<Vec<u8>>
Select a register, send 1 to 31 bytes of data to it, and reads
1 to 31 bytes of data from it.
Source§fn smbus_read_i2c_block_data(
&mut self,
_register: u8,
_len: u8,
) -> I2CResult<Vec<u8>>
fn smbus_read_i2c_block_data( &mut self, _register: u8, _len: u8, ) -> I2CResult<Vec<u8>>
Read a block of up to 32 bytes from a device Read more
Source§fn smbus_write_i2c_block_data(
&mut self,
_register: u8,
_values: &[u8],
) -> I2CResult<()>
fn smbus_write_i2c_block_data( &mut self, _register: u8, _values: &[u8], ) -> I2CResult<()>
Write a block of up to 32 bytes from a device Read more
Source§fn smbus_read_byte(&mut self) -> Result<u8, Self::Error>
fn smbus_read_byte(&mut self) -> Result<u8, Self::Error>
Read a single byte from a device, without specifying a device register Read more
Source§fn smbus_write_byte(&mut self, value: u8) -> Result<(), Self::Error>
fn smbus_write_byte(&mut self, value: u8) -> Result<(), Self::Error>
Write a single byte to a device, without specifying a device register Read more
Source§fn smbus_read_byte_data(&mut self, register: u8) -> Result<u8, Self::Error>
fn smbus_read_byte_data(&mut self, register: u8) -> Result<u8, Self::Error>
Read a single byte from a device, from a designated register Read more
Source§fn smbus_write_byte_data(
&mut self,
register: u8,
value: u8,
) -> Result<(), Self::Error>
fn smbus_write_byte_data( &mut self, register: u8, value: u8, ) -> Result<(), Self::Error>
Write a single byte to a specific register on a device Read more
Source§fn smbus_read_word_data(&mut self, register: u8) -> Result<u16, Self::Error>
fn smbus_read_word_data(&mut self, register: u8) -> Result<u16, Self::Error>
Read 2 bytes from a given register on a device (lsb first)
Source§impl<'a> I2CTransfer<'a> for MockI2CDevicewhere
MockI2CDevice: I2CDevice,
impl<'a> I2CTransfer<'a> for MockI2CDevicewhere
MockI2CDevice: I2CDevice,
Auto Trait Implementations§
impl Freeze for MockI2CDevice
impl RefUnwindSafe for MockI2CDevice
impl Send for MockI2CDevice
impl Sync for MockI2CDevice
impl Unpin for MockI2CDevice
impl UnsafeUnpin for MockI2CDevice
impl UnwindSafe for MockI2CDevice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more