Skip to content

Commit d7b8234

Browse files
authored
Merge pull request #55 from rjauquet/rej-add-probe
Add i2c probe compatibility
2 parents b1a232b + a78092f commit d7b8234

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

adafruit_tca9548a.py

+7
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ def scan(self) -> List[int]:
9898
"""Perform an I2C Device Scan"""
9999
return self.tca.i2c.scan()
100100

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

102109
class TCA9548A:
103110
"""Class which provides interface to TCA9548A I2C multiplexer."""

0 commit comments

Comments
 (0)