From ce80342f83ec06239846678eea28a1c54827b7d2 Mon Sep 17 00:00:00 2001 From: StevenBruinen <38690210+StevenBruinen@users.noreply.github.com> Date: Wed, 3 Apr 2019 10:40:55 +0200 Subject: [PATCH 1/3] 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) --- adafruit_tca9548a.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/adafruit_tca9548a.py b/adafruit_tca9548a.py index 5e709b1..8d4c42e 100644 --- a/adafruit_tca9548a.py +++ b/adafruit_tca9548a.py @@ -81,6 +81,11 @@ def writeto(self, address, buffer, **kwargs): raise ValueError("Device address must be different than TCA9548A address.") return self.tca.i2c.writeto(address, buffer, **kwargs) + def writeto_then_readfrom(self, address, buffer_out, buffer_in, **kwargs): + """Pass thru for writeto_then_readfrom.""" + 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) class TCA9548A(): """Class which provides interface to TCA9548A I2C multiplexer.""" From 77df4e9d9328a508842a8fca4ed0e5a5d2271ae4 Mon Sep 17 00:00:00 2001 From: StevenBruinen <38690210+StevenBruinen@users.noreply.github.com> Date: Wed, 3 Apr 2019 20:36:00 +0200 Subject: [PATCH 2/3] Added comment. --- adafruit_tca9548a.py | 1 + 1 file changed, 1 insertion(+) diff --git a/adafruit_tca9548a.py b/adafruit_tca9548a.py index 8d4c42e..fcab8c0 100644 --- a/adafruit_tca9548a.py +++ b/adafruit_tca9548a.py @@ -83,6 +83,7 @@ def writeto(self, address, buffer, **kwargs): def writeto_then_readfrom(self, address, buffer_out, buffer_in, **kwargs): """Pass thru for writeto_then_readfrom.""" + """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) From 2ea68651efb5cd9a48c094bb78cec1fce814b1ab Mon Sep 17 00:00:00 2001 From: StevenBruinen <38690210+StevenBruinen@users.noreply.github.com> Date: Wed, 3 Apr 2019 20:44:58 +0200 Subject: [PATCH 3/3] Update adafruit_tca9548a.py --- adafruit_tca9548a.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_tca9548a.py b/adafruit_tca9548a.py index fcab8c0..dc3d7a1 100644 --- a/adafruit_tca9548a.py +++ b/adafruit_tca9548a.py @@ -83,7 +83,7 @@ def writeto(self, address, buffer, **kwargs): def writeto_then_readfrom(self, address, buffer_out, buffer_in, **kwargs): """Pass thru for writeto_then_readfrom.""" - """In linux, at least, this is a special kernel function call""" + #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)