Skip to content

Commit e9b2b05

Browse files
committed
software/i2c/bus: discover returns the list of addresses
1 parent 6141c2e commit e9b2b05

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lambdalib/software/i2c/bus.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def read_block_data(self, addr, reg, length):
7575
def discover(self):
7676
print("Discovering...")
7777

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

8081
length = 0
@@ -87,13 +88,16 @@ def discover(self):
8788
sys.stdout.write(".. ")
8889
sys.stdout.flush()
8990
else:
91+
addrs.append(addr)
9092
sys.stdout.write(f"{addr:02x} ")
9193
sys.stdout.flush()
9294

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

99+
return addrs
100+
97101
def discover_queue(self):
98102
print("Discovering...")
99103

0 commit comments

Comments
 (0)