Arduino Helpers master
Utility library for Arduino
IncrementButton.hpp
Go to the documentation of this file.
1/* ✔ */
2
3#pragma once
4
5#include "Button.hpp"
6
8
20 public:
29
31 void begin() { button.begin(); }
32
38 enum State {
39 Nothing = 0,
45 };
46
51
57 State getState() const { return state; }
58
60 void invert() { button.invert(); }
61
62 protected:
64
65 private:
67
68 enum {
72 unsigned long longPressRepeat;
73
75};
76
#define END_AH_NAMESPACE
#define BEGIN_AH_NAMESPACE
A class for reading and debouncing buttons and switches.
Definition: Button.hpp:15
void invert()
Invert the input state of this button (button pressed is HIGH instead of LOW).
Definition: Button.cpp:9
void begin()
Initialize (enable the internal pull-up resistor).
Definition: Button.cpp:7
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.
@ Nothing
The counter must not be incremented.
@ 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
enum IncrementButton::@0 longPressState
State getState() const
Return the state of the increment button without updating it.
State update()
Update and return the state of the increment button.
State updateImplementation()