1use core::convert::Infallible;
3use embedded_hal::blocking::i2c::{Read, SevenBitAddress, Write};
4
5pub struct DummyI2CBus {}
6
7impl DummyI2CBus {
8 pub fn new() -> Self {
9 DummyI2CBus {}
10 }
11}
12
13impl Write for DummyI2CBus {
14 type Error = Infallible;
15
16 fn write(&mut self, _address: SevenBitAddress, _bytes: &[u8]) -> Result<(), Self::Error> {
17 Ok(())
18 }
19}
20
21impl Read for DummyI2CBus {
22 type Error = Infallible;
23
24 fn read(&mut self, address: SevenBitAddress, buffer: &mut [u8]) -> Result<(), Self::Error> {
25 match address {
26 0x00 => buffer[0] = 0b0010_0110,
27 0x01 => buffer[0] = 0b1110_0101,
28 _ => {}
29 };
30
31 Ok(())
32 }
33}