AceButton
1.0.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 int | readButton (uint8_t pin) |
Return the HIGH or LOW state of the button. More... | |
bool | isFeature (uint8_t features) ACE_BUTTON_INLINE |
Check if the given features are enabled. More... | |
void | setFeature (uint8_t features) ACE_BUTTON_INLINE |
Enable the given features. More... | |
void | clearFeature (uint8_t 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... | |
Additional Inherited Members | |
![]() | |
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 uint8_t | kFeatureClick = 0x01 |
Flag to activate the AceButton::kEventClicked event. More... | |
static const uint8_t | kFeatureDoubleClick = 0x02 |
Flag to activate the AceButton::kEventDoubleClicked event. More... | |
static const uint8_t | kFeatureLongPress = 0x04 |
Flag to activate the AceButton::kEventLongPress event. More... | |
static const uint8_t | kFeatureRepeatPress = 0x08 |
Flag to activate the AceButton::kEventRepeatPressed event. More... | |
static const uint8_t | kFeatureSuppressAfterClick = 0x10 |
Flag to suppress kEventReleased after a kEventClicked. More... | |
static const uint8_t | kFeatureSuppressAfterDoubleClick = 0x20 |
Flag to suppress kEventReleased after a kEventDoubleClicked. More... | |
static const uint8_t | kFeatureSuppressAfterLongPress = 0x40 |
Flag to suppress kEventReleased after a kEventLongPressed. More... | |
static const uint8_t | kFeatureSuppressAfterRepeatPress = 0x80 |
Flag to suppress kEventReleased after a kEventRepeatPressed. More... | |
static const uint8_t | 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.
|
inlineoverridevirtual |
Milliseconds to wait for a possible click.
Reimplemented from ace_button::ButtonConfig.
|
inlineoverridevirtual |
Milliseconds to wait for debouncing.
Reimplemented from ace_button::ButtonConfig.
|
inlineoverridevirtual |
Milliseconds for a long press event.
Reimplemented from ace_button::ButtonConfig.
|
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.
|
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.
|
inline |
Set the clickDelay.
|
inline |
Set the debounceDelay.
|
inline |
Set the doubleClickDelay.
|
inline |
Set the longPressDelay.
|
inline |
Set the repeatPressDelay.
|
inline |
Set the repeatPressInterval.