Skip to content

Commit

Permalink
software/i2c/bus: discover returns the list of addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
povauboin committed Nov 14, 2024
1 parent 6141c2e commit e9b2b05
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lambdalib/software/i2c/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def read_block_data(self, addr, reg, length):
def discover(self):
print("Discovering...")

addrs = []
for addr in range(0, 128): # 7 bits addr

length = 0
Expand All @@ -87,13 +88,16 @@ def discover(self):
sys.stdout.write(".. ")
sys.stdout.flush()
else:
addrs.append(addr)
sys.stdout.write(f"{addr:02x} ")
sys.stdout.flush()

if (addr % 16) == 15:
sys.stdout.write("\n")
sys.stdout.flush()

return addrs

def discover_queue(self):
print("Discovering...")

Expand Down

0 comments on commit e9b2b05

Please sign in to comment.