Arduino Filters master
Filter library for Arduino
IncrementButton.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
23 public:
32
34 void begin() { button.begin(); }
35
41 enum State {
42 Nothing = 0,
48 };
49
54
60 State getState() const { return state; }
61
63 void invert() { button.invert(); }
64
65 protected:
67
68 private:
70
71 enum {
75 unsigned long longPressRepeat;
76
78};
79
81
#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 some counter or setting.
IncrementButton(const Button &button)
Create a IncrementButton.
State
An enumeration of the different actions to be performed by the counter.
@ Nothing
The counter must not be incremented.
@ IncrementShort
The counter must be incremented (after short press).
@ IncrementHold
The counter must be incremented (still pressed).
@ ReleasedLong
The button was released after a long press.
@ IncrementLong
The counter must be incremented (after long press).
@ ReleasedShort
The button was released after a short press.
unsigned long longPressRepeat
enum IncrementButton::@0 longPressState
State getState() const
Return the state of the increment button without updating it.
State update()
Update and return the state of the increment button.
State updateImplementation()