Arduino Filters master
Filter library for Arduino
IncrementDecrementButtons.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
6AH_DIAGNOSTIC_WERROR() // Enable errors on warnings
7
8#include "Button.hpp"
9
11
26 public:
40
42 void begin() {
45 }
46
52 enum State {
53 Nothing = 0,
61 };
62
67
74 State getState() const { return state; }
75
77 void invert() {
80 }
81
82 protected:
84
85 private:
88
89 enum {
94 unsigned long longPressRepeat;
96};
97
99
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
#define AH_DIAGNOSTIC_POP()
Definition: Warnings.hpp:36
#define AH_DIAGNOSTIC_WERROR()
Definition: Warnings.hpp:35
A class for reading and debouncing buttons and switches.
Definition: Button.hpp:18
void invert()
Invert the input state of this button (button pressed is HIGH instead of LOW).
Definition: Button.cpp:11
void begin()
Initialize (enable the internal pull-up resistor).
Definition: Button.cpp:9
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.