This is an old version of the documentation. View the latest version
here
.
Control Surface
1.0.0
MIDI Control Surface library for Arduino
src
Hardware
IncrementDecrementButtons.hpp
Go to the documentation of this file.
1
/* ✔ */
2
3
#pragma once
4
5
#include "
Button.hpp
"
6
7
BEGIN_CS_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
Increment
,
52
Decrement
,
53
Reset
,
54
};
55
59
State
update
() {
return
state
=
updateImplementation
(); }
60
67
State
getState
()
const
{
return
state
; }
68
69
#ifdef INDIVIDUAL_BUTTON_INVERT
70
void
invert() {
72
incrementButton
.
invert
();
73
decrementButton
.
invert
();
74
}
75
#endif
76
77
protected
:
78
State
updateImplementation
();
79
80
private
:
81
Button
incrementButton
;
82
Button
decrementButton
;
83
84
enum
{
85
Initial
,
86
LongPress
,
87
AfterReset
,
88
}
longPressState
=
Initial
;
89
unsigned
long
longPressRepeat
;
90
State
state
=
Nothing
;
91
};
92
93
END_CS_NAMESPACE
IncrementDecrementButtons::LongPress
Definition:
IncrementDecrementButtons.hpp:86
Button::invert
INDIVIDUAL_BUTTON_INVERT_STATIC void invert()
Invert the state of all buttons, or of this specific button (button pressed is HIGH instead of LOW).
Definition:
Button.cpp:11
Button.hpp
IncrementDecrementButtons::decrementButton
Button decrementButton
Definition:
IncrementDecrementButtons.hpp:82
Button
A class for reading and debouncing buttons and switches.
Definition:
Button.hpp:15
IncrementDecrementButtons::state
State state
Definition:
IncrementDecrementButtons.hpp:90
IncrementDecrementButtons::longPressState
enum IncrementDecrementButtons::@2 longPressState
IncrementDecrementButtons::Nothing
The counter should not be incremented.
Definition:
IncrementDecrementButtons.hpp:50
IncrementDecrementButtons::update
State update()
Update and return the state of the increment/decrement button.
Definition:
IncrementDecrementButtons.hpp:59
IncrementDecrementButtons::getState
State getState() const
Return the state of the increment/decrement button without updating it.
Definition:
IncrementDecrementButtons.hpp:67
IncrementDecrementButtons::incrementButton
Button incrementButton
Definition:
IncrementDecrementButtons.hpp:81
IncrementDecrementButtons::Initial
Definition:
IncrementDecrementButtons.hpp:85
BEGIN_CS_NAMESPACE
#define BEGIN_CS_NAMESPACE
Definition:
NamespaceSettings.hpp:9
IncrementDecrementButtons::AfterReset
Definition:
IncrementDecrementButtons.hpp:87
IncrementDecrementButtons::longPressRepeat
unsigned long longPressRepeat
Definition:
IncrementDecrementButtons.hpp:89
IncrementDecrementButtons::updateImplementation
State updateImplementation()
Definition:
IncrementDecrementButtons.cpp:6
IncrementDecrementButtons::begin
void begin()
Definition:
IncrementDecrementButtons.hpp:39
END_CS_NAMESPACE
#define END_CS_NAMESPACE
Definition:
NamespaceSettings.hpp:10
IncrementDecrementButtons::IncrementDecrementButtons
IncrementDecrementButtons(const Button &incrementButton, const Button &decrementButton)
Create a IncrementDecrementButtons object.
Definition:
IncrementDecrementButtons.hpp:34
IncrementDecrementButtons
A class for buttons that increment and decrement some counter or setting.
Definition:
IncrementDecrementButtons.hpp:22
Button::begin
void begin()
Initialize (enable the internal pull-up resistor).
Definition:
Button.cpp:9
IncrementDecrementButtons::State
State
An enumeration of the different actions to be performed by the counter.
Definition:
IncrementDecrementButtons.hpp:49
IncrementDecrementButtons::Increment
The counter should be incremented.
Definition:
IncrementDecrementButtons.hpp:51
IncrementDecrementButtons::Decrement
The counter should be decremented.
Definition:
IncrementDecrementButtons.hpp:52
IncrementDecrementButtons::Reset
The counter should be reset to the initial value.
Definition:
IncrementDecrementButtons.hpp:53
Generated by
1.8.16