Skip to content

Commit e208d97

Browse files
author
Kong Wai Weng
committed
Added option to set the SPI baudrate.
1 parent 9000b5a commit e208d97

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

adafruit_wiznet5k/adafruit_wiznet5k.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def __init__(
196196
mac: Union[MacAddressRaw, str] = _DEFAULT_MAC,
197197
hostname: Optional[str] = None,
198198
debug: bool = False,
199+
spi_baudrate: int = 8000000,
199200
) -> None:
200201
"""
201202
:param busio.SPI spi_bus: The SPI bus the Wiznet module is connected to.
@@ -207,10 +208,12 @@ def __init__(
207208
:param str hostname: The desired hostname, with optional {} to fill in the MAC
208209
address, defaults to None.
209210
:param bool debug: Enable debugging output, defaults to False.
211+
: param int spi_baudrate: The SPI clock frequency, defaults to 8MHz.
212+
Might not be the actual baudrate, dependent on the hardware.
210213
"""
211214
self._debug = debug
212215
self._chip_type = None
213-
self._device = SPIDevice(spi_bus, cs, baudrate=8000000, polarity=0, phase=0)
216+
self._device = SPIDevice(spi_bus, cs, baudrate=spi_baudrate, polarity=0, phase=0)
214217
# init c.s.
215218
self._cs = cs
216219

0 commit comments

Comments
 (0)