wws_74hc165

CircuitPython driver for 74HC165 shift register.

  • Author(s): John Woolsey

Implementation Notes

Based on Adafruit_CircuitPython_74HC595 driver library.

Hardware:

  • 74HC165 Shift Register

Software and Dependencies:

class wws_74hc165.DigitalInOut(pin_number: Pin, shift_register_74hc165: ShiftRegister74HC165)

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

property direction: digitalio.Direction.INPUT

Direction can only be set to INPUT.

property pull: None

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

switch_to_input(**kwargs) None

DigitalInOut switch_to_input

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

switch_to_output is not supported.

property value: bool

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

class wws_74hc165.ShiftRegister74HC165(spi: SPI, latch: digitalio.DigitalInOut, number_of_shift_registers: int = 1, baudrate: int = 1000000)

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

get_pin(pin: int) DigitalInOut

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

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

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

property number_of_shift_registers: int

The number of shift register chips.