Skip to content

Commit c5617b7

Browse files
authored
Merge pull request #12 from caternuson/iss11
Possible fix for #11
2 parents 8d211f4 + bad25bc commit c5617b7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

adafruit_tca9548a.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,17 @@ def writeto_then_readfrom(self, address, buffer_out, buffer_in, **kwargs):
8787
#In linux, at least, this is a special kernel function call
8888
if address == self.tca.address:
8989
raise ValueError("Device address must be different than TCA9548A address.")
90-
return self.tca.i2c.writeto_then_readfrom(address, buffer_out, buffer_in, **kwargs)
90+
91+
if hasattr(self.tca.i2c, 'writeto_then_readfrom'):
92+
self.tca.i2c.writeto_then_readfrom(address, buffer_out, buffer_in, **kwargs)
93+
else:
94+
self.tca.i2c.writeto(address, buffer_out,
95+
start=kwargs.get("out_start", 0),
96+
end=kwargs.get("out_end", None),
97+
stop=False)
98+
self.tca.i2c.readfrom_into(address, buffer_in,
99+
start=kwargs.get("in_start", 0),
100+
end=kwargs.get("in_end", None))
91101

92102
class TCA9548A():
93103
"""Class which provides interface to TCA9548A I2C multiplexer."""

0 commit comments

Comments
 (0)