pounder_test/src/eeprom.rs

14 lines
286 B
Rust
Raw Normal View History

2020-04-19 19:37:03 +08:00
use embedded_hal::blocking::i2c::WriteRead;
2019-09-01 06:24:24 +08:00
2020-04-19 19:37:03 +08:00
const I2C_ADDR: u8 = 0x50;
2019-09-01 06:24:24 +08:00
2020-04-22 01:02:52 +08:00
#[allow(dead_code)]
2020-04-19 19:37:03 +08:00
pub fn read_eui48<T>(i2c: &mut T) -> Result<[u8; 6], T::Error>
2020-06-16 22:22:12 +08:00
where
T: WriteRead,
2020-04-19 19:37:03 +08:00
{
2019-09-01 06:24:24 +08:00
let mut buffer = [0u8; 6];
2020-04-19 19:37:03 +08:00
i2c.write_read(I2C_ADDR, &[0xFA_u8], &mut buffer)?;
2019-09-01 06:24:24 +08:00
Ok(buffer)
}