Skip to content

Commit 296d4ec

Browse files
author
BiffoBear
committed
Renamed _w5100_init to _w5xxx_init, detect_w5500 to _detect_and_reset_w5500, detect_w5100s to _detect_and_reset_w5100s.
1 parent bdd23c7 commit 296d4ec

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

adafruit_wiznet5k/adafruit_wiznet5k.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def __init__(
187187

188188
# attempt to initialize the module
189189
self._ch_base_msb = 0
190-
assert self._w5100_init() == 1, "Failed to initialize WIZnet module."
190+
assert self._w5xxx_init() == 1, "Failed to initialize WIZnet module."
191191
# Set MAC address
192192
self.mac_address = mac
193193
self.src_port = 0
@@ -449,7 +449,7 @@ def ifconfig(
449449

450450
self._dns = dns_server
451451

452-
def _w5100_init(self) -> int:
452+
def _w5xxx_init(self) -> int:
453453
"""
454454
Detect and initialize a Wiznet5k ethernet module.
455455
@@ -460,28 +460,29 @@ def _w5100_init(self) -> int:
460460
self._cs.value = 1
461461

462462
# Detect if chip is Wiznet W5500
463-
if self.detect_w5500() == 1:
463+
if self._detect_and_reset_w5500() == 1:
464464
# perform w5500 initialization
465465
for i in range(0, W5200_W5500_MAX_SOCK_NUM):
466466
ctrl_byte = 0x0C + (i << 5)
467467
self.write(0x1E, ctrl_byte, 2)
468468
self.write(0x1F, ctrl_byte, 2)
469469
else:
470470
# Detect if chip is Wiznet W5100S
471-
if self.detect_w5100s() == 1:
471+
if self._detect_and_reset_w5100s() == 1:
472472
pass
473473
else:
474474
return 0
475475
return 1
476476

477-
def detect_w5500(self) -> int:
477+
def _detect_and_reset_w5500(self) -> int:
478478
"""
479-
Detect W5500 chip.
479+
Detect and reset a W5500 chip. Called at startup to initialize the
480+
interface hardware.
480481
481482
:return int: 1 if a W5500 chip is detected, -1 if not.
482483
"""
483484
self._chip_type = "w5500"
484-
assert self.sw_reset() == 0, "Chip not reset properly!"
485+
# assert self.sw_reset() == 0, "Chip not reset properly!"
485486
self._write_mr(0x08)
486487
# assert self._read_mr()[0] == 0x08, "Expected 0x08."
487488
if self._read_mr()[0] != 0x08:
@@ -503,9 +504,10 @@ def detect_w5500(self) -> int:
503504
# self._ch_base_msb = 0x10
504505
return 1
505506

506-
def detect_w5100s(self) -> int:
507+
def _detect_and_reset_w5100s(self) -> int:
507508
"""
508-
Detect W5100S chip.
509+
Detect and reset a W5100S chip. Called at startup to initialize the
510+
interface hardware.
509511
510512
:return int: 1 if a W5100 chip is detected, -1 if not.
511513
"""

0 commit comments

Comments
 (0)