Skip to content

Commit 3624750

Browse files
committed
Fix reading hexpansion headers
The documentation for reading a hexpansion header had sample code that has been broken since v1.8.0, due to a backwards-incompatible. Fix these, by adding the addr length.
1 parent 5b42366 commit 3624750

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

docs/hexpansions/writing-hexpansion-apps.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ Below is an example of how you find which port your hexpansion is plugged in to
126126
for port in range(1, 7):
127127
print(f"Searching for hexpansion on port: {port}")
128128
i2c = I2C(port)
129-
addr,addr_len = detect_eeprom_addr(i2c) # Firmware version 1.8 and upwards only!
129+
addr, addr_len = detect_eeprom_addr(i2c) # Firmware version 1.8 and upwards only!
130130

131131
if addr is None:
132132
continue
133133
else:
134134
print("Found EEPROM at addr " + hex(addr))
135135

136-
header = read_hexpansion_header(i2c, addr)
136+
header = read_hexpansion_header(i2c, addr, addr_len=addr_len)
137137
if header is None:
138138
continue
139139
else:

docs/tildagon-apps/examples/detect-hexpansion.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ class ExampleApp(app.App):
5656
for port in range(1, 7):
5757
print(f"Searching for hexpansion on port: {port}")
5858
i2c = I2C(port)
59-
addr = detect_eeprom_addr(i2c)
59+
addr, addr_len = detect_eeprom_addr(i2c)
6060

6161
if addr is None:
6262
continue
6363
else:
6464
print("Found EEPROM at addr " + hex(addr))
6565

66-
header = read_hexpansion_header(i2c, addr)
66+
header = read_hexpansion_header(i2c, addr, addr_len=addr_len)
6767
if header is None:
6868
continue
6969
else:

docs/tildagon-apps/reference/badge-hardware.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,14 +698,14 @@ bus = I2C(1)
698698
for port in range(1, 7):
699699
print(f"Searching for hexpansion on port: {port}")
700700
i2c = I2C(port)
701-
addr = detect_eeprom_addr(i2c)
701+
addr, addr_len = detect_eeprom_addr(i2c)
702702

703703
if addr is None:
704704
continue
705705
else:
706706
print("Found EEPROM at addr " + hex(addr))
707707

708-
header = read_hexpansion_header(i2c, addr)
708+
header = read_hexpansion_header(i2c, addr, addr_len=addr_len)
709709
if header is None:
710710
continue
711711
else:

0 commit comments

Comments
 (0)