Multiple I2C devices on same bus
chevdor opened this issue · comments
Hello, how is it planned to access multiple eeproms on the same I2C bus?
Consider the following code:
let mut eeprom1 = Eeprom24x::new_24x32(i2c2, SlaveAddr::Alternative(false, false, false));
let mut eeprom2 = Eeprom24x::new_24x32(i2c2, SlaveAddr::Alternative(true, false, false));
Each line is valid and the code (write / read) works fine. However, since eeprom1
takes ownership of i2c2
, it is then no longer usable for eeprom2
. Shouln't you avoid taking ownership of the bus ?
Hello @chevdor, you can use shared-bus to share a bus among several devices.