Skip to content
Draft
Changes from all commits
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
9 changes: 7 additions & 2 deletions src/adafruit_blinka/microcontroller/generic_linux/i2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ def scan(self):
"""Try to read a byte from each address, if you get an OSError
it means the device isnt there"""
found = []
for addr in range(0, 0x80):
# 0x00 - 0x07 and 0x78 - 0x7F reserved
# see https://www.i2c-bus.org/addressing
for addr in range(0x08, 0x78):
try:
self._i2c_bus.read_byte(addr)
if (0x30 <= addr <= 0x37) or (0x50 <= addr <= 0x5F):
self._i2c_bus.read_byte(addr)
else:
self._i2c_bus.write_quick(addr)
except OSError:
continue
found.append(addr)
Expand Down
Loading