Skip to content

Commit 78b03fa

Browse files
authored
Merge pull request #25 from semininja/main
add option to specify baudrate
2 parents 1f8f3a6 + bd3ad17 commit 78b03fa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

adafruit_74hc595.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,18 @@ def pull(self, val: digitalio.Pull): # pylint: disable=no-self-use
120120

121121

122122
class ShiftRegister74HC595:
123-
"""Initialise the 74HC595 on specified SPI bus
124-
and indicate the number of shift registers being used
123+
"""Initialise the 74HC595 on specified SPI bus, indicate the
124+
number of shift registers being used and optional baudrate.
125125
"""
126126

127127
def __init__(
128128
self,
129129
spi: busio.SPI,
130130
latch: digitalio.DigitalInOut,
131131
number_of_shift_registers: int = 1,
132+
baudrate: int = 1000000,
132133
):
133-
self._device = spi_device.SPIDevice(spi, latch, baudrate=1000000)
134+
self._device = spi_device.SPIDevice(spi, latch, baudrate=baudrate)
134135
self._number_of_shift_registers = number_of_shift_registers
135136
self._gpio = bytearray(self._number_of_shift_registers)
136137

0 commit comments

Comments
 (0)