Skip to content

Commit ce80342

Browse files
Support for 'write_then_readfrom'
Added support for the busio 'write_then_readfrom' function as some i2c devices require this (e.g. the Adafruit i2c FRAM module)
1 parent e396d47 commit ce80342

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

adafruit_tca9548a.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ 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+
if address == self.tca.address:
87+
raise ValueError("Device address must be different than TCA9548A address.")
88+
return self.tca.i2c.writeto_then_readfrom(address, buffer_out, buffer_in, **kwargs)
8489

8590
class TCA9548A():
8691
"""Class which provides interface to TCA9548A I2C multiplexer."""

0 commit comments

Comments
 (0)