![]() |
InputEvents v1.5.2
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
|
The base class/interface specification for GPIO expanders.
#include <GpioExpanderAdapter.h>

Public Member Functions | |
| 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... | |
|
pure virtual |
Use it to configure individual pin mode, if expander allows it. Not all of them do.
Implemented in AdafruitMCP23017ExpanderAdapter, AdafruitPCF8574ExpanderAdapter, AdafruitPCF8575ExpanderAdapter, HC165ExpanderAdapter, and RobTillaartPCF8575ExpanderAdapter.
|
pure virtual |
Initialize the expander. (Idempotent)
Implemented in AdafruitMCP23017ExpanderAdapter, AdafruitPCF8574ExpanderAdapter, AdafruitPCF8575ExpanderAdapter, HC165ExpanderAdapter, and RobTillaartPCF8575ExpanderAdapter.
|
inline |
Returns true if the concrete GpioExpanderAdapter has implemented the write() method.
GpioExpanderAdapter can write to pins.
|
pure virtual |
Returns the state of a pin on the expander.
Implemented in AdafruitMCP23017ExpanderAdapter, AdafruitPCF8574ExpanderAdapter, AdafruitPCF8575ExpanderAdapter, HC165ExpanderAdapter, and RobTillaartPCF8575ExpanderAdapter.
|
pure virtual |
Read the state of all pins on the expander.
Expander pins generally cannot be read like regular GPIO pins, they have to be 'scanned' for their current state before reading individual pins.
Implemented in AdafruitMCP23017ExpanderAdapter, AdafruitPCF8574ExpanderAdapter, AdafruitPCF8575ExpanderAdapter, HC165ExpanderAdapter, and RobTillaartPCF8575ExpanderAdapter.
|
inline |
Optionally implemented by concrete GpioExpanderAdapters if they support writing to pins.
Not used by InputEvents but provided so 'app' code can write to the GPIO expander.
| pin | The pin number on the expander |
| state | HIGH or LOW (true/false) |