Skip to content

add option to specify baudrate #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions adafruit_74hc595.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,18 @@ def pull(self, val: digitalio.Pull): # pylint: disable=no-self-use


class ShiftRegister74HC595:
"""Initialise the 74HC595 on specified SPI bus
and indicate the number of shift registers being used
"""Initialise the 74HC595 on specified SPI bus, indicate the
number of shift registers being used and optional baudrate.
"""

def __init__(
self,
spi: busio.SPI,
latch: digitalio.DigitalInOut,
number_of_shift_registers: int = 1,
baudrate: int = 1000000,
):
self._device = spi_device.SPIDevice(spi, latch, baudrate=1000000)
self._device = spi_device.SPIDevice(spi, latch, baudrate=baudrate)
self._number_of_shift_registers = number_of_shift_registers
self._gpio = bytearray(self._number_of_shift_registers)

Expand Down