Arduino Helpers master
Utility library for Arduino
IncrementDecrementButtons.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
5#include "Button.hpp"
6
8
23 public:
37
39 void begin() {
42 }
43
49 enum State {
50 Nothing = 0,
58 };
59
64
71 State getState() const { return state; }
72
74 void invert() {
77 }
78
79 protected:
81
82 private:
85
86 enum {
91 unsigned long longPressRepeat;
93};
94
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
A class for reading and debouncing buttons and switches.
Definition: Button.hpp:15
void invert()
Invert the input state of this button (button pressed is HIGH instead of LOW).
Definition: Button.cpp:9
void begin()
Initialize (enable the internal pull-up resistor).
Definition: Button.cpp:7
A class for buttons that increment and decrement some counter or setting.
IncrementDecrementButtons(const Button &incrementButton, const Button &decrementButton)
Create a IncrementDecrementButtons object.
enum IncrementDecrementButtons::@1 longPressState
State
An enumeration of the different actions to be performed by the counter.
@ DecrementLong
The counter must be decremented (after long press).
@ Nothing
The counter should not be incremented.
@ IncrementShort
The counter must be incremented (after short press).
@ IncrementHold
The counter must be incremented (still pressed).
@ DecrementHold
The counter must be decremented (still pressed).
@ DecrementShort
The counter must be decremented (after short press).
@ Reset
The counter should be reset to the initial value.
@ IncrementLong
The counter must be incremented (after long press).
State getState() const
Return the state of the increment/decrement button without updating it.
State update()
Update and return the state of the increment/decrement button.