Skip to content

Possible fix for #11 #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 6, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion adafruit_tca9548a.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class TCA9548A_Channel():
def __init__(self, tca, channel):
self.tca = tca
self.channel_switch = bytearray([1 << channel])
# provide only if needed
if hasattr(self.tca.i2c, 'writeto_then_readfrom'):
setattr(self, 'writeto_then_readfrom', self.writeto_then_readfrom_passthru)

def try_lock(self):
"""Pass thru for try_lock."""
Expand All @@ -82,7 +85,7 @@ 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):
def writeto_then_readfrom_passthru(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:
Expand Down