@@ -150,7 +150,7 @@ def __init__(
150150 is_dhcp : bool = True ,
151151 mac : Union [List [int ], Tuple [int ]] = DEFAULT_MAC ,
152152 hostname : Optional [str ] = None ,
153- dhcp_timeout : float = 30 ,
153+ dhcp_timeout : float = 30.0 ,
154154 debug : bool = False ,
155155 ) -> None :
156156 """
@@ -162,7 +162,7 @@ def __init__(
162162 (0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED).
163163 :param str hostname: The desired hostname, with optional {} to fill in the MAC
164164 address, defaults to None.
165- :param float dhcp_timeout: Timeout in seconds for DHCP response, defaults to 30.
165+ :param float dhcp_timeout: Timeout in seconds for DHCP response, defaults to 30.0.
166166 :param bool debug: Enable debugging output, defaults to False.
167167 """
168168 self ._debug = debug
@@ -406,7 +406,6 @@ def remote_port(self, socket_num: int) -> Union[int, bytearray]:
406406
407407 :return Union[int, bytearray]: The port number of the socket connection.
408408 """
409- # TODO: why return the buffer?
410409 if socket_num >= self .max_sockets :
411410 return self ._pbuff
412411 for octet in range (2 ):
@@ -439,7 +438,6 @@ def ifconfig(
439438 :params Tuple[bytearray, bytearray, bytearray, Tuple[int, int, int, int]]: \
440439 Configuration settings - (ip_address, subnet_mask, gateway_address, dns_server).
441440 """
442- # TODO: Might be better if params can be str as well
443441 ip_address , subnet_mask , gateway_address , dns_server = params
444442
445443 self .write (REG_SIPR , 0x04 , ip_address )
@@ -455,7 +453,6 @@ def _w5100_init(self) -> int:
455453 :return int: 1 if the initialization succeeds, 0 if it fails.
456454 """
457455 time .sleep (1 )
458- # TODO: Isn't the CS pin initialized in busio?
459456 self ._cs .switch_to_output ()
460457 self ._cs .value = 1
461458
@@ -525,7 +522,6 @@ def sw_reset(self) -> int:
525522
526523 :return int: 0 if the reset succeeds, -1 if not.
527524 """
528- # TODO: mode_reg appears to be unused, maybe self._read_mr starts the reset?
529525 mode_reg = self ._read_mr ()
530526 self ._write_mr (0x80 )
531527 mode_reg = self ._read_mr ()
@@ -589,7 +585,6 @@ def write(
589585 :param int callback: Callback reference.
590586 :param Union[int, Sequence[Union[int, bytes]]] data: Data to write to the register address.
591587 """
592- # TODO: Call with int means an error in a previous function
593588 with self ._device as bus_device :
594589 if self ._chip_type == "w5500" :
595590 bus_device .write (bytes ([addr >> 8 ])) # pylint: disable=no-member
@@ -688,7 +683,7 @@ def socket_connect(
688683 # initialize a socket and set the mode
689684 res = self .socket_open (socket_num , conn_mode = conn_mode )
690685 if res == 1 :
691- raise RuntimeError ("Failed to initalize a connection with the socket." )
686+ raise RuntimeError ("Failed to initialize a connection with the socket." )
692687
693688 # set socket destination IP and port
694689 self ._write_sndipr (socket_num , dest )
@@ -758,7 +753,7 @@ def socket_listen(
758753 res = self .socket_open (socket_num , conn_mode = conn_mode )
759754 self .src_port = 0
760755 if res == 1 :
761- raise RuntimeError ("Failed to initalize the socket." )
756+ raise RuntimeError ("Failed to initialize the socket." )
762757 # Send listen command
763758 self ._send_socket_cmd (socket_num , CMD_SOCK_LISTEN )
764759 # Wait until ready
@@ -979,7 +974,7 @@ def socket_write(
979974 assert socket_num <= self .max_sockets , "Provided socket exceeds max_sockets."
980975 status = 0
981976 ret = 0
982- free_size = 0 # TODO: Bug report
977+ free_size = 0
983978 if len (buffer ) > SOCK_SIZE :
984979 ret = SOCK_SIZE
985980 else :
@@ -1020,7 +1015,7 @@ def socket_write(
10201015 dst_addr = socket_num * SOCK_SIZE + 0x4000
10211016 self .write (dst_addr , 0x00 , txbuf )
10221017 else :
1023- txbuf = buffer [:ret ] # TODO: Bug report
1018+ txbuf = buffer [:ret ]
10241019 self .write (dst_addr , 0x00 , buffer [:ret ])
10251020
10261021 # update sn_tx_wr to the value + data size
@@ -1153,5 +1148,4 @@ def _read_socket(self, sock: int, address: int) -> Optional[bytearray]: # *1
11531148 if self ._chip_type == "w5100s" :
11541149 cntl_byte = 0
11551150 return self .read (self ._ch_base_msb + sock * CH_SIZE + address , cntl_byte )
1156- # TODO: If the chip is not supported, this should raise an exception.
11571151 return None
0 commit comments