From e208d978269619eec8f7a38f1d55774f350722ba Mon Sep 17 00:00:00 2001 From: Kong Wai Weng Date: Tue, 22 Oct 2024 22:55:19 +0800 Subject: [PATCH 1/3] Added option to set the SPI baudrate. --- adafruit_wiznet5k/adafruit_wiznet5k.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/adafruit_wiznet5k/adafruit_wiznet5k.py b/adafruit_wiznet5k/adafruit_wiznet5k.py index f75a877..723f78f 100644 --- a/adafruit_wiznet5k/adafruit_wiznet5k.py +++ b/adafruit_wiznet5k/adafruit_wiznet5k.py @@ -196,6 +196,7 @@ def __init__( mac: Union[MacAddressRaw, str] = _DEFAULT_MAC, hostname: Optional[str] = None, debug: bool = False, + spi_baudrate: int = 8000000, ) -> None: """ :param busio.SPI spi_bus: The SPI bus the Wiznet module is connected to. @@ -207,10 +208,12 @@ def __init__( :param str hostname: The desired hostname, with optional {} to fill in the MAC address, defaults to None. :param bool debug: Enable debugging output, defaults to False. + : param int spi_baudrate: The SPI clock frequency, defaults to 8MHz. + Might not be the actual baudrate, dependent on the hardware. """ self._debug = debug self._chip_type = None - self._device = SPIDevice(spi_bus, cs, baudrate=8000000, polarity=0, phase=0) + self._device = SPIDevice(spi_bus, cs, baudrate=spi_baudrate, polarity=0, phase=0) # init c.s. self._cs = cs From e60e2591a1022be0bbc85a93f8aa9a45fceb3aef Mon Sep 17 00:00:00 2001 From: Kong Wai Weng Date: Tue, 22 Oct 2024 23:25:08 +0800 Subject: [PATCH 2/3] Removed space after : at the param description. --- adafruit_wiznet5k/adafruit_wiznet5k.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adafruit_wiznet5k/adafruit_wiznet5k.py b/adafruit_wiznet5k/adafruit_wiznet5k.py index 723f78f..c6497b5 100644 --- a/adafruit_wiznet5k/adafruit_wiznet5k.py +++ b/adafruit_wiznet5k/adafruit_wiznet5k.py @@ -208,7 +208,7 @@ def __init__( :param str hostname: The desired hostname, with optional {} to fill in the MAC address, defaults to None. :param bool debug: Enable debugging output, defaults to False. - : param int spi_baudrate: The SPI clock frequency, defaults to 8MHz. + :param int spi_baudrate: The SPI clock frequency, defaults to 8MHz. Might not be the actual baudrate, dependent on the hardware. """ self._debug = debug From 064947c912edb402d5281a864e0ec6fd257b449e Mon Sep 17 00:00:00 2001 From: Kong Wai Weng Date: Tue, 22 Oct 2024 23:30:23 +0800 Subject: [PATCH 3/3] Reformatted. --- adafruit_wiznet5k/adafruit_wiznet5k.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/adafruit_wiznet5k/adafruit_wiznet5k.py b/adafruit_wiznet5k/adafruit_wiznet5k.py index c6497b5..046900d 100644 --- a/adafruit_wiznet5k/adafruit_wiznet5k.py +++ b/adafruit_wiznet5k/adafruit_wiznet5k.py @@ -213,7 +213,9 @@ def __init__( """ self._debug = debug self._chip_type = None - self._device = SPIDevice(spi_bus, cs, baudrate=spi_baudrate, polarity=0, phase=0) + self._device = SPIDevice( + spi_bus, cs, baudrate=spi_baudrate, polarity=0, phase=0 + ) # init c.s. self._cs = cs