2626
2727* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
2828"""
29+
30+ __version__ = "0.0.0+auto.0"
31+ __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k.git"
32+
2933# pylint: disable=too-many-lines
3034try :
3135 from typing import Optional , Union , List , Tuple , Sequence
4347import adafruit_wiznet5k .adafruit_wiznet5k_dhcp as dhcp
4448import adafruit_wiznet5k .adafruit_wiznet5k_dns as dns
4549
46-
47- __version__ = "0.0.0+auto.0"
48- __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k.git"
49-
50-
5150# Wiznet5k Registers
5251REG_MR = const (0x0000 ) # Mode
5352REG_GAR = const (0x0001 ) # Gateway IP Address
@@ -223,7 +222,7 @@ def set_dhcp(
223222 :param Optional[str] hostname: The desired hostname for the DHCP server with optional {} to
224223 fill in the MAC address, defaults to None.
225224 :param float response_timeout: Time to wait for server to return packet in seconds,
226- defaults to 30.
225+ defaults to 30.0.
227226
228227 :return int: 0 if DHCP configured, -1 otherwise.
229228 """
@@ -359,7 +358,6 @@ def pretty_mac(
359358 :param bytearray mac: The MAC address.
360359
361360 :return str: Mac Address in the form 00:00:00:00:00:00
362-
363361 """
364362 return "%s:%s:%s:%s:%s:%s" % (
365363 hex (mac [0 ]),
@@ -420,7 +418,7 @@ def ifconfig(
420418 Network configuration information.
421419
422420 :return Tuple[bytearray, bytearray, bytearray, Tuple[int, int, int, int]]: \
423- The IP address, subnet mask, gateway address and DNS server address."""
421+ The IP address, subnet mask, gateway address and DNS server address."""
424422 return (
425423 self .ip_address ,
426424 self .read (REG_SUBR , 0x00 , 4 ),
@@ -435,8 +433,8 @@ def ifconfig(
435433 """
436434 Set network configuration.
437435
438- :params Tuple[bytearray, bytearray, bytearray, Tuple[int, int, int, int]]: \
439- Configuration settings - (ip_address, subnet_mask, gateway_address, dns_server).
436+ :param Tuple[bytearray, bytearray, bytearray, Tuple[int, int, int, int]]:
437+ Configuration settings - (ip_address, subnet_mask, gateway_address, dns_server).
440438 """
441439 ip_address , subnet_mask , gateway_address , dns_server = params
442440
@@ -606,12 +604,11 @@ def write(
606604
607605 def socket_available (self , socket_num : int , sock_type : int = SNMR_TCP ) -> int :
608606 """
609- Return the number of bytes available to be read from the socket.
607+ Number of bytes available to be read from the socket.
610608
611609 :param int socket_num: Socket to check for available bytes.
612610 :param int sock_type: Socket type. Use SNMR_TCP for TCP or SNMR_UDP for UDP, \
613- defaults to SNMR_TCP.
614-
611+ defaults to SNMR_TCP.
615612 :return int: Number of bytes available to read.
616613 """
617614 if self ._debug :
@@ -642,7 +639,7 @@ def socket_available(self, socket_num: int, sock_type: int = SNMR_TCP) -> int:
642639
643640 def socket_status (self , socket_num : int ) -> Optional [bytearray ]:
644641 """
645- Return the socket connection status.
642+ Socket connection status.
646643
647644 Can be: SNSR_SOCK_CLOSED, SNSR_SOCK_INIT, SNSR_SOCK_LISTEN, SNSR_SOCK_SYNSENT,
648645 SNSR_SOCK_SYNRECV, SNSR_SYN_SOCK_ESTABLISHED, SNSR_SOCK_FIN_WAIT,
@@ -671,7 +668,7 @@ def socket_connect(
671668 :param Union[bytes, bytearray] dest: The destination as a host name or IP address.
672669 :param int port: Port to connect to (0 - 65,536).
673670 :param int conn_mode: The connection mode. Use SNMR_TCP for TCP or SNMR_UDP for UDP,
674- defaults to SNMR_TCP.
671+ defaults to SNMR_TCP.
675672 """
676673 assert self .link_status , "Ethernet cable disconnected!"
677674 if self ._debug :
@@ -712,7 +709,7 @@ def _send_socket_cmd(self, socket: int, cmd: int) -> None:
712709 def get_socket (self ) -> int :
713710 """Request, allocate and return a socket from the W5k chip.
714711
715- Cycles through the sockets to find the first available one, if any.
712+ Cycle through the sockets to find the first available one, if any.
716713
717714 :return int: The first available socket. Returns 0xFF if no sockets are free.
718715 """
@@ -773,7 +770,6 @@ def socket_accept(
773770 the IP address and port of the incoming connection.
774771
775772 :param int socket_num: Socket number with connection to check.
776-
777773 :return Tuple[int, Tuple[Union[str, bytearray], Union[int, bytearray]]]:
778774 If successful, the next (socket number, (destination IP address, destination port)).
779775
@@ -799,8 +795,7 @@ def socket_open(self, socket_num: int, conn_mode: int = SNMR_TCP) -> int:
799795
800796 :param int socket_num: The socket number to open.
801797 :param int conn_mode: The protocol to use. Use SNMR_TCP for TCP or SNMR_UDP for \
802- UDP, defaults to SNMR_TCP.
803-
798+ UDP, defaults to SNMR_TCP.
804799 :return int: 1 if the socket was opened, 0 if not.
805800 """
806801 assert self .link_status , "Ethernet cable disconnected!"
@@ -874,9 +869,9 @@ def socket_read(
874869 :param int length: The number of bytes to read from the socket.
875870
876871 :return Tuple[int, Union[int, bytearray]]: If the read was successful then the first
877- item of the tuple is the length of the data and the second is the data. If the read
878- was unsuccessful then both items equal an error code, 0 for no data waiting and -1
879- for no connection to the socket.
872+ item of the tuple is the length of the data and the second is the data. If the read
873+ was unsuccessful then both items equal an error code, 0 for no data waiting and -1
874+ for no connection to the socket.
880875 """
881876 assert self .link_status , "Ethernet cable disconnected!"
882877 assert socket_num <= self .max_sockets , "Provided socket exceeds max_sockets."
0 commit comments