CircuitPython driver for 74HC595 shift register.

  • Author(s): Kattni Rembor, Tony DiCola

Implementation Notes


“* 74HC595 Shift Register - 3 pack

Software and Dependencies:

class adafruit_74hc595.DigitalInOut(pin_number: Pin, shift_register_74hc595: ShiftRegister74HC595)

Digital input/output of the 74HC595. The interface is exactly the same as the digitalio.DigitalInOut class, however note that by design this device is OUTPUT ONLY! Attempting to read inputs or set direction as input will raise an exception.

property direction: digitalio.Direction.OUTPUT

Direction can only be set to OUTPUT.

property pull: None

Pull-up/down not supported, return None for no pull-up/down.

switch_to_input(**kwargs) None

switch_to_input is not supported.

switch_to_output(value: bool = False, **kwargs) None

DigitalInOut switch_to_output

property value: bool

The value of the pin, either True for high or False for low.

class adafruit_74hc595.ShiftRegister74HC595(spi: SPI, latch: DigitalInOut, number_of_shift_registers: int = 1, baudrate: int = 1000000)

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

get_pin(pin: int) DigitalInOut

Convenience function to create an instance of the DigitalInOut class pointing at the specified pin of this 74HC595 device .

property gpio: array | bytearray | bytes | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray

The raw GPIO output register. Each bit represents the output value of the associated pin (0 = low, 1 = high).

property number_of_shift_registers: int

The number of shift register chips