![]() |
InputEvents v1.5.2
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
|
An implementation of the GpioExpanderAdapter using 74HC165 shift register(s)
Datasheet: https://www.ti.com/lit/ds/symlink/sn74hc165.pdf
Supports up to 4 cascaded 74HC165 shift registers, returning 32 pin states (read only)
pin 0 is pin H (pin 7 is pin A) on the first 74HC165, pin 8 is a pin H on the second 74HC165, etc
#include <HC165ExpanderAdapter.h>

Public Member Functions | |
| HC165ExpanderAdapter (byte dataPin, byte clockPin, byte shldPin, byte cascadeLength=cascadeDefaultLength) | |
| Construct a new HC165ExpanderAdapter. More... | |
| void | begin () override |
| Initialize the pin expander. More... | |
| void | update () override |
| Read the state of pins on the 74HC165 cascade. More... | |
| bool | read (byte pin) override |
| Returns the state of a pin on the expander. More... | |
| void | attachPin (byte pin, int mode=INPUT_PULLUP) override |
| pinMode not supported by 74HC165 so do nothing More... | |
Public Member Functions inherited from GpioExpanderAdapter | |
| virtual void | begin ()=0 |
| Initialize the expander. (Idempotent) More... | |
| virtual void | update ()=0 |
| Read the state of all pins on the expander. More... | |
| virtual bool | read (byte pin)=0 |
| Returns the state of a pin on the expander. More... | |
| virtual void | attachPin (byte pin, int mode=INPUT_PULLUP)=0 |
| Use it to configure individual pin mode, if expander allows it. Not all of them do. More... | |
| void | write (byte pin, bool state) |
Optionally implemented by concrete GpioExpanderAdapters if they support writing to pins. More... | |
| bool | canWrite () |
Returns true if the concrete GpioExpanderAdapter has implemented the write() method. More... | |
|
inline |
Construct a new HC165ExpanderAdapter.
| dataPin | Serial data |
| clockPin | Used to shift to next bit |
| shldPin | Shift/Load input |
| cascadeLength | The number of 74HC165s chained together (1-4, default is 1) |
|
inlineoverridevirtual |
|
inlineoverridevirtual |
Initialize the pin expander.
Implements GpioExpanderAdapter.
|
inlineoverridevirtual |
Returns the state of a pin on the expander.
Implements GpioExpanderAdapter.
|
inlineoverridevirtual |
Read the state of pins on the 74HC165 cascade.
Implements GpioExpanderAdapter.