Control Surface
stm32
MIDI Control Surface library for Arduino
src
AH
Hardware
IncrementButton.hpp
Go to the documentation of this file.
1
/* ✔ */
2
3
#pragma once
4
5
#include <
AH/Settings/Warnings.hpp
>
6
AH_DIAGNOSTIC_WERROR
()
// Enable errors on warnings
7
8
#include "Button.hpp"
9
10
BEGIN_AH_NAMESPACE
11
22
class
IncrementButton
{
23
public
:
31
IncrementButton
(
const
Button
&button) : button(button) {}
32
34
void
begin
() { button.begin(); }
35
41
enum
State
{
42
Nothing = 0,
43
IncrementShort
,
44
IncrementLong
,
45
IncrementHold
,
46
ReleasedShort
,
47
ReleasedLong
,
48
};
49
53
State
update
() {
return
state = updateImplementation(); }
54
60
State
getState
()
const
{
return
state; }
61
63
void
invert
() { button.invert(); }
64
65
protected
:
66
State updateImplementation();
67
68
private
:
69
Button
button
;
70
71
enum
{
72
Initial
,
73
LongPress
,
74
} longPressState = Initial;
75
unsigned
long
longPressRepeat
;
76
77
State
state = Nothing;
78
};
79
80
END_AH_NAMESPACE
81
82
AH_DIAGNOSTIC_POP
()
END_AH_NAMESPACE
#define END_AH_NAMESPACE
Definition:
AH/Settings/NamespaceSettings.hpp:10
BEGIN_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
Definition:
AH/Settings/NamespaceSettings.hpp:9
Warnings.hpp
AH_DIAGNOSTIC_POP
#define AH_DIAGNOSTIC_POP()
Definition:
Warnings.hpp:37
AH_DIAGNOSTIC_WERROR
#define AH_DIAGNOSTIC_WERROR()
Definition:
Warnings.hpp:36
AH::Button
A class for reading and debouncing buttons and switches.
Definition:
Button.hpp:18
AH::IncrementButton
A class for buttons that increment some counter or setting.
Definition:
IncrementButton.hpp:22
AH::IncrementButton::Initial
@ Initial
Definition:
IncrementButton.hpp:72
AH::IncrementButton::LongPress
@ LongPress
Definition:
IncrementButton.hpp:73
AH::IncrementButton::IncrementButton
IncrementButton(const Button &button)
Create a IncrementButton.
Definition:
IncrementButton.hpp:31
AH::IncrementButton::State
State
An enumeration of the different actions to be performed by the counter.
Definition:
IncrementButton.hpp:41
AH::IncrementButton::IncrementShort
@ IncrementShort
The counter must be incremented (after short press).
Definition:
IncrementButton.hpp:43
AH::IncrementButton::IncrementHold
@ IncrementHold
The counter must be incremented (still pressed).
Definition:
IncrementButton.hpp:45
AH::IncrementButton::ReleasedLong
@ ReleasedLong
The button was released after a long press.
Definition:
IncrementButton.hpp:47
AH::IncrementButton::IncrementLong
@ IncrementLong
The counter must be incremented (after long press).
Definition:
IncrementButton.hpp:44
AH::IncrementButton::ReleasedShort
@ ReleasedShort
The button was released after a short press.
Definition:
IncrementButton.hpp:46
AH::IncrementButton::longPressRepeat
unsigned long longPressRepeat
Definition:
IncrementButton.hpp:75
AH::IncrementButton::invert
void invert()
Definition:
IncrementButton.hpp:63
AH::IncrementButton::getState
State getState() const
Return the state of the increment button without updating it.
Definition:
IncrementButton.hpp:60
AH::IncrementButton::button
Button button
Definition:
IncrementButton.hpp:69
AH::IncrementButton::begin
void begin()
Definition:
IncrementButton.hpp:34
AH::IncrementButton::update
State update()
Update and return the state of the increment button.
Definition:
IncrementButton.hpp:53
Generated by
1.9.4