diff --git a/adafruit_tca9548a.py b/adafruit_tca9548a.py index c42ae73..3e3cad0 100644 --- a/adafruit_tca9548a.py +++ b/adafruit_tca9548a.py @@ -87,7 +87,17 @@ def writeto_then_readfrom(self, address, buffer_out, buffer_in, **kwargs): #In linux, at least, this is a special kernel function call if address == self.tca.address: raise ValueError("Device address must be different than TCA9548A address.") - return self.tca.i2c.writeto_then_readfrom(address, buffer_out, buffer_in, **kwargs) + + if hasattr(self.tca.i2c, 'writeto_then_readfrom'): + self.tca.i2c.writeto_then_readfrom(address, buffer_out, buffer_in, **kwargs) + else: + self.tca.i2c.writeto(address, buffer_out, + start=kwargs.get("out_start", 0), + end=kwargs.get("out_end", None), + stop=False) + self.tca.i2c.readfrom_into(address, buffer_in, + start=kwargs.get("in_start", 0), + end=kwargs.get("in_end", None)) class TCA9548A(): """Class which provides interface to TCA9548A I2C multiplexer."""