Skip to content

Commit 109f664

Browse files
authored
Merge pull request #172 from CytronTechnologies/add_baudrate_option
Added option to set the SPI baudrate.
2 parents 9000b5a + 064947c commit 109f664

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

adafruit_wiznet5k/adafruit_wiznet5k.py

Lines changed: 6 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,14 @@ 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(
217+
spi_bus, cs, baudrate=spi_baudrate, polarity=0, phase=0
218+
)
214219
# init c.s.
215220
self._cs = cs
216221

0 commit comments

Comments
 (0)