Skip to content

Commit 33280a6

Browse files
authored
Merge pull request #7 from StevenBruinen/patch-1
Support for `writeto_then_readfrom` which linux machines need for `write_then_readinto`.
2 parents e396d47 + 2ea6865 commit 33280a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

adafruit_tca9548a.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ def writeto(self, address, buffer, **kwargs):
8181
raise ValueError("Device address must be different than TCA9548A address.")
8282
return self.tca.i2c.writeto(address, buffer, **kwargs)
8383

84+
def writeto_then_readfrom(self, address, buffer_out, buffer_in, **kwargs):
85+
"""Pass thru for writeto_then_readfrom."""
86+
#In linux, at least, this is a special kernel function call
87+
if address == self.tca.address:
88+
raise ValueError("Device address must be different than TCA9548A address.")
89+
return self.tca.i2c.writeto_then_readfrom(address, buffer_out, buffer_in, **kwargs)
8490

8591
class TCA9548A():
8692
"""Class which provides interface to TCA9548A I2C multiplexer."""

0 commit comments

Comments
 (0)