@@ -236,7 +236,7 @@ def __init__(
236
236
# attempt to initialize the module
237
237
self ._ch_base_msb = 0
238
238
self ._src_ports_in_use = []
239
- self ._w5xxx_init ()
239
+ self ._wiznet_chip_init ()
240
240
241
241
# Set MAC address
242
242
self .mac_address = mac
@@ -951,13 +951,39 @@ def sw_reset(self) -> None:
951
951
if result != expected_result :
952
952
raise RuntimeError ("WIZnet chip reset failed." )
953
953
954
- def _w5xxx_init (self ) -> None :
954
+ def _wiznet_chip_init (self ) -> None :
955
955
"""
956
956
Detect and initialize a WIZnet 5k Ethernet module.
957
957
958
958
:raises RuntimeError: If no WIZnet chip is detected.
959
959
"""
960
960
961
+ def _detect_and_reset_w6100 () -> bool :
962
+ """
963
+ Detect and reset a W6100 chip. Called at startup to initialize the
964
+ interface hardware.
965
+
966
+ :return bool: True if a W6100 chip is detected, False if not.
967
+ """
968
+ self ._chip_type = "w6100"
969
+ try :
970
+ self .sw_reset ()
971
+ except RuntimeError :
972
+ return False
973
+
974
+ if self ._read (_REG_VERSIONR [self ._chip_type ], 0x00 )[0 ] != 0x61 :
975
+ return False
976
+ # Initialize w6100.
977
+ self ._write (0x41F5 , 0x04 , 0x3A ) # Unlock network settings.
978
+ for i in range (_MAX_SOCK_NUM [self ._chip_type ]):
979
+ ctrl_byte = 0x0C + (i << 5 )
980
+ self ._write (0x1E , ctrl_byte , 2 )
981
+ self ._write (0x1F , ctrl_byte , 2 )
982
+ self ._ch_base_msb = 0x00
983
+ WIZNET5K ._sockets_reserved = [False ] * (_MAX_SOCK_NUM [self ._chip_type ] - 1 )
984
+ self ._src_ports_in_use = [0 ] * _MAX_SOCK_NUM [self ._chip_type ]
985
+ return True
986
+
961
987
def _detect_and_reset_w5500 () -> bool :
962
988
"""
963
989
Detect and reset a W5500 chip. Called at startup to initialize the
@@ -1015,7 +1041,11 @@ def _detect_and_reset_w5100s() -> bool:
1015
1041
self ._src_ports_in_use = [0 ] * _MAX_SOCK_NUM [self ._chip_type ]
1016
1042
return True
1017
1043
1018
- for func in [_detect_and_reset_w5100s , _detect_and_reset_w5500 ]:
1044
+ for func in [
1045
+ _detect_and_reset_w5100s ,
1046
+ _detect_and_reset_w5500 ,
1047
+ _detect_and_reset_w6100 ,
1048
+ ]:
1019
1049
if func ():
1020
1050
return
1021
1051
self ._chip_type = None
0 commit comments