![]() |
InputEvents v1.4.0
An easy to use but comprehensive Event Library for Buttons, Encoders, Encoder Buttons, Analog Inputs, Joysticks and Switches.
|
This is the default PinAdapter for regular GPIO pins.
#include <GpioPinAdapter.h>
Public Member Functions | |
GpioPinAdapter (byte pin, uint8_t mode=INPUT_PULLUP) | |
Construct a new Gpio Pin Adapter. More... | |
void | begin () |
Initialise the pin adapter. Must be safe for repeated calls (Idempotent) More... | |
bool | read () |
Read the current state of the pin. More... | |
virtual void | begin ()=0 |
Initialise the pin adapter. Must be safe for repeated calls (Idempotent) More... | |
virtual bool | read ()=0 |
Read the current state of the pin. More... | |
|
inline |
Construct a new Gpio Pin Adapter.
By default this PinAdapter will set the pinMode to INPUT_PULLUP
If you pass mode value as HIGH
, you must also set EventButton::setPressedState()
, EventEncoderButton::setPressedState()
or EventSwitch::setOnState()
to HIGH
If your board does not support INPUT_PULLDOWN
, pass INPUT
and use an external resistor.
pin | The regular GPIO pin number |
pinMode | Defaults to INPUT_PULLUP. |
|
inlinevirtual |
Initialise the pin adapter. Must be safe for repeated calls (Idempotent)
Implements PinAdapter.
|
inlinevirtual |