45 inline Pin(uint8_t pin, uint8_t initState)
53 Pin &operator=(
const Pin &) =
delete;
83 inline int clicks(uint8_t pressed, uint8_t released) {
177 byte currReading = digitalRead(
pin_);
297 inline int clicks(uint8_t pressed, uint8_t released) {
373 inline int clicks(uint8_t pressed, uint8_t released)
const {
Debounced pin class that remembers the previous debounced state.
void readPin()
Debounce the pin readings to get a stable state of the pin.
int clicks(uint8_t pressed, uint8_t released)
Return the number of clicks.
uint8_t prevState_
Previous debounced reading of the pin.
ClickerPin(uint8_t pin, uint8_t initState)
Protected constructor used by sub-classes.
uint8_t prevReading_
The previous pin reading, to monitor state transitions.
void readPin()
Debounce the pin readings to get a stable state of the pin.
unsigned long millisStart_
Debounce start timer to handle button transition.
static void setDebounceTime(uint8_t debounceTime)
Set the debounce time for input pins.
static uint32_t idleTime_
Time required for button to be idle.
static uint8_t debounceTime()
Return the pin debounce time.
static uint16_t heldTime()
Return the pin held time.
static uint8_t debounceTime_
Time required to debounce all input pins.
DebouncedPin(uint8_t pin, uint8_t initState)
Protected constructor used by sub-classes.
static void setHeldTime(uint16_t heldTime)
Set the held time for input pins.
static void setIdleTime(uint32_t idleTime)
Set the idle time for input pins.
static uint32_t idleTime()
Return the pin idle time.
static uint16_t heldTime_
Time required for button to be held.
Pin class that counts state changes within a time-period.
static uint16_t clickTime_
Time required for button to be double-clicked.
DoubleClickerPin(uint8_t pin, uint8_t initState)
Protected constructor used by sub-classes.
unsigned long prevMillis_
Previous millisecond count from last state change.
void readPin()
Debounce the pin readings to get a stable state of the pin.
int clicks(uint8_t pressed, uint8_t released) const
Return the number of clicks.
uint8_t stateCount_
Count changes in state within double-click time.
static uint16_t clickTime()
Return the double-click time.
static void setClickTime(uint16_t clickTime)
Set the click time for input pins.
Pin base class reading direct from the pin (without debouncing).
uint8_t pin_
The Arduino pin connected to the button.
static uint8_t autoId_
Auto-assigned button identifier.
Pin(uint8_t pin, uint8_t initState)
Protected constructor used by sub-classes.
void readPin()
Read the pin directly.
uint8_t currState_
The reading of the pin.
static uint8_t nextId()
Return the next auto-assigned button identifier.
int clicks(uint8_t pressed, uint8_t released)
Return the number of clicks.