pounder_test/src/eeprom.rs

11 lines
254 B
Rust
Raw Normal View History

2019-09-01 06:24:24 +08:00
use super::i2c;
2020-04-18 16:54:55 +08:00
use stm32h7::stm32h743v as pac;
2019-09-01 06:24:24 +08:00
const I2C_ADDR: u8 = 0xa0;
2019-11-24 21:55:20 +08:00
pub fn read_eui48(i2c: &pac::I2C2) -> Result<[u8; 6], i2c::Error> {
2019-09-01 06:24:24 +08:00
let mut buffer = [0u8; 6];
i2c::write_read(i2c, I2C_ADDR, &[0xFAu8], &mut buffer)?;
Ok(buffer)
}