Control Surface main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
IncrementButton.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
5#include "Button.hpp"
6
8
20 public:
28 IncrementButton(const Button &button) : button(button) {}
29
31 void begin() { button.begin(); }
32
46
50 State update() { return state = updateImplementation(); }
51
57 State getState() const { return state; }
58
60 void invert() { button.invert(); }
61
62 protected:
63 State updateImplementation();
64
65 private:
67
68 enum {
71 } longPressState = Initial;
72 unsigned long longPressRepeat;
73
74 State state = Nothing;
75};
76
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
A class for reading and debouncing buttons and switches.
Definition Button.hpp:15
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.
@ 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
State getState() const
Return the state of the increment button without updating it.
State update()
Update and return the state of the increment button.
T * begin()
Get a pointer to the first element.
Definition Array.hpp:74