@@ -187,7 +187,7 @@ def __init__(
187
187
188
188
# attempt to initialize the module
189
189
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."
191
191
# Set MAC address
192
192
self .mac_address = mac
193
193
self .src_port = 0
@@ -449,7 +449,7 @@ def ifconfig(
449
449
450
450
self ._dns = dns_server
451
451
452
- def _w5100_init (self ) -> int :
452
+ def _w5xxx_init (self ) -> int :
453
453
"""
454
454
Detect and initialize a Wiznet5k ethernet module.
455
455
@@ -460,28 +460,29 @@ def _w5100_init(self) -> int:
460
460
self ._cs .value = 1
461
461
462
462
# Detect if chip is Wiznet W5500
463
- if self .detect_w5500 () == 1 :
463
+ if self ._detect_and_reset_w5500 () == 1 :
464
464
# perform w5500 initialization
465
465
for i in range (0 , W5200_W5500_MAX_SOCK_NUM ):
466
466
ctrl_byte = 0x0C + (i << 5 )
467
467
self .write (0x1E , ctrl_byte , 2 )
468
468
self .write (0x1F , ctrl_byte , 2 )
469
469
else :
470
470
# Detect if chip is Wiznet W5100S
471
- if self .detect_w5100s () == 1 :
471
+ if self ._detect_and_reset_w5100s () == 1 :
472
472
pass
473
473
else :
474
474
return 0
475
475
return 1
476
476
477
- def detect_w5500 (self ) -> int :
477
+ def _detect_and_reset_w5500 (self ) -> int :
478
478
"""
479
- Detect W5500 chip.
479
+ Detect and reset a W5500 chip. Called at startup to initialize the
480
+ interface hardware.
480
481
481
482
:return int: 1 if a W5500 chip is detected, -1 if not.
482
483
"""
483
484
self ._chip_type = "w5500"
484
- assert self .sw_reset () == 0 , "Chip not reset properly!"
485
+ # assert self.sw_reset() == 0, "Chip not reset properly!"
485
486
self ._write_mr (0x08 )
486
487
# assert self._read_mr()[0] == 0x08, "Expected 0x08."
487
488
if self ._read_mr ()[0 ] != 0x08 :
@@ -503,9 +504,10 @@ def detect_w5500(self) -> int:
503
504
# self._ch_base_msb = 0x10
504
505
return 1
505
506
506
- def detect_w5100s (self ) -> int :
507
+ def _detect_and_reset_w5100s (self ) -> int :
507
508
"""
508
- Detect W5100S chip.
509
+ Detect and reset a W5100S chip. Called at startup to initialize the
510
+ interface hardware.
509
511
510
512
:return int: 1 if a W5100 chip is detected, -1 if not.
511
513
"""
0 commit comments