Skip to content

Commit

Permalink
Merge pull request #55 from rjauquet/rej-add-probe
Browse files Browse the repository at this point in the history
Add i2c probe compatibility
  • Loading branch information
FoamyGuy authored Jan 22, 2025
2 parents b1a232b + a78092f commit d7b8234
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions adafruit_tca9548a.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ def scan(self) -> List[int]:
"""Perform an I2C Device Scan"""
return self.tca.i2c.scan()

def probe(self, address: int) -> bool:
"""Check if an I2C device is at the specified address on the hub."""
# backwards compatibility for circuitpython <9.2
if hasattr(self.tca.i2c, "probe"):
return self.tca.i2c.probe(address)
return address in self.scan()


class TCA9548A:
"""Class which provides interface to TCA9548A I2C multiplexer."""
Expand Down

0 comments on commit d7b8234

Please sign in to comment.