AceButton
1.1.0
An adjustable, compact, event-driven (ACE) button library for Arduino.
|
A subclass of ButtonConfig which allows the user to override the varous timing parameters of ButtonConfig at runtime. More...
#include <AdjustableButtonConfig.h>
Public Member Functions | |
virtual void | init () override |
Initialize to its pristine state, except for the EventHandler which is unchanged. More... | |
virtual uint16_t | getDebounceDelay () override |
Milliseconds to wait for debouncing. More... | |
virtual uint16_t | getClickDelay () override |
Milliseconds to wait for a possible click. More... | |
virtual uint16_t | getDoubleClickDelay () override |
Milliseconds between the first and second click to register as a double-click. | |
virtual uint16_t | getLongPressDelay () override |
Milliseconds for a long press event. More... | |
virtual uint16_t | getRepeatPressDelay () override |
Milliseconds that a button needs to be Pressed down before the start of the sequence of RepeatPressed events. More... | |
virtual uint16_t | getRepeatPressInterval () override |
Milliseconds between two successive RepeatPressed events. | |
void | setDebounceDelay (uint16_t debounceDelay) |
Set the debounceDelay. More... | |
void | setClickDelay (uint16_t clickDelay) |
Set the clickDelay. More... | |
void | setDoubleClickDelay (uint16_t doubleClickDelay) |
Set the doubleClickDelay. More... | |
void | setLongPressDelay (uint16_t longPressDelay) |
Set the longPressDelay. More... | |
void | setRepeatPressDelay (uint16_t repeatPressDelay) |
Set the repeatPressDelay. More... | |
void | setRepeatPressInterval (uint16_t repeatPressInterval) |
Set the repeatPressInterval. More... | |
![]() | |
ButtonConfig () | |
Constructor. More... | |
virtual unsigned long | getClock () |
Return the milliseconds of the internal clock. More... | |
virtual unsigned long | getClockMicros () |
Return the microseconds of the internal clock. More... | |
virtual int | readButton (uint8_t pin) |
Return the HIGH or LOW state of the button. More... | |
bool | isFeature (FeatureFlagType features) ACE_BUTTON_INLINE |
Check if the given features are enabled. More... | |
void | setFeature (FeatureFlagType features) ACE_BUTTON_INLINE |
Enable the given features. More... | |
void | clearFeature (FeatureFlagType features) ACE_BUTTON_INLINE |
Disable the given features. More... | |
EventHandler | getEventHandler () ACE_BUTTON_INLINE |
Return the eventHandler. More... | |
void | setEventHandler (EventHandler eventHandler) ACE_BUTTON_INLINE |
Install the event handler. More... | |
void | setTimingStats (TimingStats *timingStats) |
Set the timing stats object. More... | |
TimingStats * | getTimingStats () |
Get the timing stats. More... | |
Additional Inherited Members | |
![]() | |
typedef uint16_t | FeatureFlagType |
Type of the feature flag. More... | |
typedef void(* | EventHandler) (AceButton *button, uint8_t eventType, uint8_t buttonState) |
The event handler signature. More... | |
![]() | |
static ButtonConfig * | getSystemButtonConfig () ACE_BUTTON_INLINE |
Return a pointer to the singleton instance of the ButtonConfig which is attached to all AceButton instances by default. | |
![]() | |
static const uint16_t | kDebounceDelay = 50 |
Default value returned by getDebounceDelay(). More... | |
static const uint16_t | kClickDelay = 200 |
Default value returned by getClickDelay(). More... | |
static const uint16_t | kDoubleClickDelay = 400 |
Default value returned by getDoubleClickDelay(). More... | |
static const uint16_t | kLongPressDelay = 1000 |
Default value returned by getLongPressDelay(). More... | |
static const uint16_t | kRepeatPressDelay = 1000 |
Default value returned by getRepeatPressDelay(). More... | |
static const uint16_t | kRepeatPressInterval = 200 |
Default value returned by getRepeatPressInterval(). More... | |
static const FeatureFlagType | kFeatureClick = 0x01 |
Flag to activate the AceButton::kEventClicked event. More... | |
static const FeatureFlagType | kFeatureDoubleClick = 0x02 |
Flag to activate the AceButton::kEventDoubleClicked event. More... | |
static const FeatureFlagType | kFeatureLongPress = 0x04 |
Flag to activate the AceButton::kEventLongPress event. More... | |
static const FeatureFlagType | kFeatureRepeatPress = 0x08 |
Flag to activate the AceButton::kEventRepeatPressed event. More... | |
static const FeatureFlagType | kFeatureSuppressAfterClick = 0x10 |
Flag to suppress kEventReleased after a kEventClicked. More... | |
static const FeatureFlagType | kFeatureSuppressAfterDoubleClick = 0x20 |
Flag to suppress kEventReleased after a kEventDoubleClicked. More... | |
static const FeatureFlagType | kFeatureSuppressAfterLongPress = 0x40 |
Flag to suppress kEventReleased after a kEventLongPressed. More... | |
static const FeatureFlagType | kFeatureSuppressAfterRepeatPress = 0x80 |
Flag to suppress kEventReleased after a kEventRepeatPressed. More... | |
static const FeatureFlagType | kFeatureSuppressClickBeforeDoubleClick = 0x100 |
Flag to suppress kEventClicked before a kEventDoubleClicked. More... | |
static const FeatureFlagType | kFeatureSuppressAll |
Convenience flag to suppress all suppressions. More... | |
A subclass of ButtonConfig which allows the user to override the varous timing parameters of ButtonConfig at runtime.
Each timing parameter is stored in a member variable, so an instance of AdjustableButtonConfig consumes far more static RAM than ButtonConfig. In return, this class allows these parameters to be changed at runtime by the user.
Definition at line 39 of file AdjustableButtonConfig.h.
|
inlineoverridevirtual |
Milliseconds to wait for a possible click.
Reimplemented from ace_button::ButtonConfig.
Definition at line 54 of file AdjustableButtonConfig.h.
|
inlineoverridevirtual |
Milliseconds to wait for debouncing.
Reimplemented from ace_button::ButtonConfig.
Definition at line 50 of file AdjustableButtonConfig.h.
|
inlineoverridevirtual |
Milliseconds for a long press event.
Reimplemented from ace_button::ButtonConfig.
Definition at line 62 of file AdjustableButtonConfig.h.
|
inlineoverridevirtual |
Milliseconds that a button needs to be Pressed down before the start of the sequence of RepeatPressed events.
The first event will fire as soon as this delay has passed. Subsequent events will fire after getRepeatPressInterval() time.
Reimplemented from ace_button::ButtonConfig.
Definition at line 66 of file AdjustableButtonConfig.h.
|
inlineoverridevirtual |
Initialize to its pristine state, except for the EventHandler which is unchanged.
This is intended mostly for testing purposes.
Reimplemented from ace_button::ButtonConfig.
Definition at line 45 of file AdjustableButtonConfig.h.
|
inline |
Set the clickDelay.
Definition at line 80 of file AdjustableButtonConfig.h.
|
inline |
Set the debounceDelay.
Definition at line 75 of file AdjustableButtonConfig.h.
|
inline |
Set the doubleClickDelay.
Definition at line 85 of file AdjustableButtonConfig.h.
|
inline |
Set the longPressDelay.
Definition at line 90 of file AdjustableButtonConfig.h.
|
inline |
Set the repeatPressDelay.
Definition at line 95 of file AdjustableButtonConfig.h.
|
inline |
Set the repeatPressInterval.
Definition at line 100 of file AdjustableButtonConfig.h.