Skip to content

Commit b04926d

Browse files
committed
Use hard coded MAC if no 24AA02E48 on the I2C bus
Had to catch exception when creating I2C device for boards that have no I2C pull-ups.
1 parent a70ea39 commit b04926d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

examples/wiznet5k_wsgiserver_test.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,15 @@ def get_static_file(filename):
6262
# Chip Select for Particle Ethernet FeatherWing
6363
# cs = digitalio.DigitalInOut(board.D5)
6464

65-
# Initialize SPI and I2C bus
65+
# Initialize SPI bus
6666
spi_bus = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
67-
i2c = busio.I2C(board.SCL, board.SDA)
6867

6968
try:
69+
# Initialize the I2C bus to read the MAC
70+
i2c = busio.I2C(board.SCL, board.SDA)
7071
# Read the MAC from the 24AA02E48 chip
7172
mac = get_mac(i2c)
72-
except OSError:
73+
except (RuntimeError, OSError):
7374
# Hard coded MAC if there is no 24AA02E48
7475
mac = b"\xFE\xED\xDE\xAD\xBE\xEF"
7576

0 commit comments

Comments
 (0)