AceButton
1.0.0
An Adjustable Compact Event-driven (ACE) button library for Arduino.
|
A subclass of ButtonConfig which overrides getClock() and readButton() so that their values can be controlled manually. More...
#include <TestableButtonConfig.h>
Public Member Functions | |
virtual void | init () override |
Initialize to its pristine state. More... | |
virtual unsigned long | getClock () override |
Read the time of the fake clock. More... | |
virtual int | readButton (uint8_t pin) override |
Read the fake physical button. More... | |
void | setClock (unsigned long millis) |
Set the time of the fake clock. More... | |
void | setButtonState (int buttonState) |
Set the state of the fake physical button. More... | |
![]() | |
ButtonConfig () | |
Constructor. More... | |
virtual uint16_t | getDebounceDelay () |
Milliseconds to wait for debouncing. More... | |
virtual uint16_t | getClickDelay () |
Milliseconds to wait for a possible click. More... | |
virtual uint16_t | getDoubleClickDelay () |
Milliseconds between the first and second click to register as a double-click. | |
virtual uint16_t | getLongPressDelay () |
Milliseconds for a long press event. More... | |
virtual uint16_t | getRepeatPressDelay () |
Milliseconds that a button needs to be Pressed down before the start of the sequence of RepeatPressed events. More... | |
virtual uint16_t | getRepeatPressInterval () |
Milliseconds between two successive RepeatPressed events. | |
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 overrides getClock() and readButton() so that their values can be controlled manually.
This is intended to be used for unit testing.
|
inlineoverridevirtual |
Read the time of the fake clock.
Reimplemented from ace_button::ButtonConfig.
|
inlineoverridevirtual |
Initialize to its pristine state.
This method is needed because ArduinoUnit does not create a new instance of the Test class for each test case, so we have to reuse objects between test cases, so we need a way to reinitialize this object to its pristine state just after construction.
Reimplemented from ace_button::ButtonConfig.
|
inlineoverridevirtual |
Read the fake physical button.
Reimplemented from ace_button::ButtonConfig.
|
inline |
Set the state of the fake physical button.
|
inline |
Set the time of the fake clock.