[][src]Struct ht16k33::i2c_mock::I2cMock

pub struct I2cMock {
    pub data_values: [u8; 16],
}

The mock I2C state.

Example

use ht16k33::i2c_mock::I2cMock;

// Create an I2cMock.
let i2c_mock = I2cMock::new();

Fields

data_values: [u8; 16]

Display RAM state.

Methods

impl I2cMock[src]

pub fn new() -> Self[src]

Create an I2cMock.

Trait Implementations

impl Write for I2cMock[src]

type Error = I2cMockError

Error type

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

write implementation.

Arguments

  • _address - The slave address. Ignored.
  • bytes - The command/address instructions to be written.

Examples

let mut i2c_mock = I2cMock::new();

// First value is the data address, remaining values are to be written
// starting at the data address which auto-increments and then wraps.
let write_buffer = [ht16k33::DisplayDataAddress::ROW_0.bits(), 0u8, 0u8];

i2c_mock.write(0, &write_buffer);

impl WriteRead for I2cMock[src]

type Error = I2cMockError

Error type

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

write_read implementation.

Arguments

  • _address - The slave address. Ignored.
  • bytes - The command/address instructions to be written.
  • buffer - The read results.

Examples

let mut i2c_mock = I2cMock::new();

let mut read_buffer = [0u8; 16];
i2c_mock.write_read(0, &[ht16k33::DisplayDataAddress::ROW_0.bits()], &mut read_buffer);

Auto Trait Implementations

impl Send for I2cMock

impl Sync for I2cMock

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]