Control Surface
main
MIDI Control Surface library for Arduino
Loading...
Searching...
No Matches
src
AH
Hardware
IncrementButton.hpp
Go to the documentation of this file.
1
/* ✔ */
2
3
#pragma once
4
5
#include "
Button.hpp
"
6
7
BEGIN_AH_NAMESPACE
8
19
class
IncrementButton
{
20
public
:
28
IncrementButton
(
const
Button
&button) : button(button) {}
29
31
void
begin
() { button.
begin
(); }
32
38
enum
State
{
39
Nothing = 0,
40
IncrementShort
,
41
IncrementLong
,
42
IncrementHold
,
43
ReleasedShort
,
44
ReleasedLong
,
45
};
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
:
66
Button
button
;
67
68
enum
{
69
Initial
,
70
LongPress
,
71
} longPressState = Initial;
72
unsigned
long
longPressRepeat
;
73
74
State
state = Nothing;
75
};
76
77
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
AH::IncrementButton
A class for buttons that increment some counter or setting.
Definition
IncrementButton.hpp:19
AH::IncrementButton::Initial
@ Initial
Definition
IncrementButton.hpp:69
AH::IncrementButton::LongPress
@ LongPress
Definition
IncrementButton.hpp:70
AH::IncrementButton::IncrementButton
IncrementButton(const Button &button)
Create a IncrementButton.
Definition
IncrementButton.hpp:28
AH::IncrementButton::State
State
An enumeration of the different actions to be performed by the counter.
Definition
IncrementButton.hpp:38
AH::IncrementButton::IncrementShort
@ IncrementShort
The counter must be incremented (after short press).
Definition
IncrementButton.hpp:40
AH::IncrementButton::IncrementHold
@ IncrementHold
The counter must be incremented (still pressed).
Definition
IncrementButton.hpp:42
AH::IncrementButton::ReleasedLong
@ ReleasedLong
The button was released after a long press.
Definition
IncrementButton.hpp:44
AH::IncrementButton::IncrementLong
@ IncrementLong
The counter must be incremented (after long press).
Definition
IncrementButton.hpp:41
AH::IncrementButton::ReleasedShort
@ ReleasedShort
The button was released after a short press.
Definition
IncrementButton.hpp:43
AH::IncrementButton::longPressRepeat
unsigned long longPressRepeat
Definition
IncrementButton.hpp:72
AH::IncrementButton::invert
void invert()
Definition
IncrementButton.hpp:60
AH::IncrementButton::getState
State getState() const
Return the state of the increment button without updating it.
Definition
IncrementButton.hpp:57
AH::IncrementButton::button
Button button
Definition
IncrementButton.hpp:66
AH::IncrementButton::begin
void begin()
Definition
IncrementButton.hpp:31
AH::IncrementButton::update
State update()
Update and return the state of the increment button.
Definition
IncrementButton.hpp:50
AH::SPIShiftRegisterOut::begin
void begin() override
Initialize the shift register.
Generated by
1.10.0