Control Surface
main
MIDI Control Surface library for Arduino
Toggle main menu visibility
Loading...
Searching...
No Matches
src
AH
Hardware
IncrementDecrementButtons.hpp
Go to the documentation of this file.
1
/* ✔ */
2
3
#pragma once
4
5
#include "
Button.hpp
"
6
7
BEGIN_AH_NAMESPACE
8
22
class
IncrementDecrementButtons
{
23
public
:
34
IncrementDecrementButtons
(
const
Button
&
incrementButton
,
35
const
Button
&
decrementButton
)
36
:
incrementButton
(
incrementButton
),
decrementButton
(
decrementButton
) {}
37
39
void
begin
() {
40
incrementButton
.begin();
41
decrementButton
.begin();
42
}
43
49
enum
State
{
50
Nothing
= 0,
51
IncrementShort
,
52
IncrementLong
,
53
IncrementHold
,
54
DecrementShort
,
55
DecrementLong
,
56
DecrementHold
,
57
Reset
,
58
};
59
63
State
update
() {
return
state
=
updateImplementation
(); }
64
71
State
getState
()
const
{
return
state
; }
72
74
void
invert
() {
75
incrementButton
.invert();
76
decrementButton
.invert();
77
}
78
79
protected
:
80
State updateImplementation();
81
82
private
:
83
Button
incrementButton
;
84
Button
decrementButton
;
85
86
enum
{
87
Initial
,
88
LongPress
,
89
AfterReset
,
90
} longPressState = Initial;
91
unsigned
long
longPressRepeat
;
92
State
state
=
Nothing
;
93
};
94
95
END_AH_NAMESPACE
END_AH_NAMESPACE
#define END_AH_NAMESPACE
Definition
AH/Settings/NamespaceSettings.hpp:14
BEGIN_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Definition
AH/Settings/NamespaceSettings.hpp:11
Button.hpp
AH::Button
A class for reading and debouncing buttons and switches.
Definition
Button.hpp:15
::IncrementDecrementButtons
A class for buttons that increment and decrement some counter or setting.
Definition
IncrementDecrementButtons.hpp:22
AH::IncrementDecrementButtons::IncrementDecrementButtons
IncrementDecrementButtons(const Button &incrementButton, const Button &decrementButton)
Create a IncrementDecrementButtons object.
Definition
IncrementDecrementButtons.hpp:34
AH::IncrementDecrementButtons::incrementButton
Button incrementButton
Definition
IncrementDecrementButtons.hpp:83
AH::IncrementDecrementButtons::updateImplementation
State updateImplementation()
Definition
IncrementDecrementButtons.cpp:6
AH::IncrementDecrementButtons::State
State
An enumeration of the different actions to be performed by the counter.
Definition
IncrementDecrementButtons.hpp:49
AH::IncrementDecrementButtons::DecrementLong
@ DecrementLong
The counter must be decremented (after long press).
Definition
IncrementDecrementButtons.hpp:55
AH::IncrementDecrementButtons::Nothing
@ Nothing
The counter should not be incremented.
Definition
IncrementDecrementButtons.hpp:50
AH::IncrementDecrementButtons::IncrementShort
@ IncrementShort
The counter must be incremented (after short press).
Definition
IncrementDecrementButtons.hpp:51
AH::IncrementDecrementButtons::IncrementHold
@ IncrementHold
The counter must be incremented (still pressed).
Definition
IncrementDecrementButtons.hpp:53
AH::IncrementDecrementButtons::DecrementHold
@ DecrementHold
The counter must be decremented (still pressed).
Definition
IncrementDecrementButtons.hpp:56
AH::IncrementDecrementButtons::DecrementShort
@ DecrementShort
The counter must be decremented (after short press).
Definition
IncrementDecrementButtons.hpp:54
AH::IncrementDecrementButtons::Reset
@ Reset
The counter should be reset to the initial value.
Definition
IncrementDecrementButtons.hpp:57
AH::IncrementDecrementButtons::IncrementLong
@ IncrementLong
The counter must be incremented (after long press).
Definition
IncrementDecrementButtons.hpp:52
AH::IncrementDecrementButtons::Initial
@ Initial
Definition
IncrementDecrementButtons.hpp:87
AH::IncrementDecrementButtons::AfterReset
@ AfterReset
Definition
IncrementDecrementButtons.hpp:89
AH::IncrementDecrementButtons::LongPress
@ LongPress
Definition
IncrementDecrementButtons.hpp:88
AH::IncrementDecrementButtons::longPressRepeat
unsigned long longPressRepeat
Definition
IncrementDecrementButtons.hpp:91
AH::IncrementDecrementButtons::invert
void invert()
Definition
IncrementDecrementButtons.hpp:74
AH::IncrementDecrementButtons::state
State state
Definition
IncrementDecrementButtons.hpp:92
AH::IncrementDecrementButtons::getState
State getState() const
Return the state of the increment/decrement button without updating it.
Definition
IncrementDecrementButtons.hpp:71
AH::IncrementDecrementButtons::begin
void begin()
Definition
IncrementDecrementButtons.hpp:39
AH::IncrementDecrementButtons::update
State update()
Update and return the state of the increment/decrement button.
Definition
IncrementDecrementButtons.hpp:63
AH::IncrementDecrementButtons::decrementButton
Button decrementButton
Definition
IncrementDecrementButtons.hpp:84
Generated by
1.17.0