Hi all
Wondering if anyone has managed to communicate with an Inky pHAT via a multiplexer for the i2c? My RPi has a few other i2c devices connected as well, so I’d like to use a TCA9548a multiplexer for i2c communication.
Inky pHAT appears to be at address 0x50 by default, and I think I’ve found the section of code needed to be changed in the eeprom.py file.
def read_eeprom(i2c_bus=None):
"""Return a class representing EEPROM contents, or none."""
try:
if i2c_bus is None:
try:
from smbus2 import SMBus
except ImportError:
raise ImportError('This library requires the smbus2 module\nInstall with: sudo pip install smbus2')
i2c_bus = SMBus(1)
i2c_bus.write_i2c_block_data(EEP_ADDRESS, 0x00, [0x00])
return EPDType.from_bytes(i2c_bus.read_i2c_block_data(EEP_ADDRESS, 0, 29))
except IOError:
return None
In this function, I think the communication part looks for 0x50 (thats the defined value of the variable EEP_ADDRESS). My question is how to change these two lines below so that instead of looking up 0x50 (EEP_ADDRESS), they look at the multiplexer address (0x70, channel 2).
i2c_bus = SMBus(1)
i2c_bus.write_i2c_block_data(EEP_ADDRESS, 0x00, [0x00])
return EPDType.from_bytes(i2c_bus.read_i2c_block_data(EEP_ADDRESS, 0, 29))
If anyone has any experience with a similar change, that would be most appreciated :) I’m a bit new to messing around with bus communications, so my apologies if this is a rather simple problem or if it’s been answered elsewhere on he forum :)
Cheers