AceButton  1.0.0
An Adjustable Compact Event-driven (ACE) button library for Arduino.
Public Member Functions | List of all members
ace_button::AdjustableButtonConfig Class Reference

A subclass of ButtonConfig which allows the user to override the varous timing parameters of ButtonConfig at runtime. More...

#include <AdjustableButtonConfig.h>

Inheritance diagram for ace_button::AdjustableButtonConfig:
Inheritance graph
[legend]
Collaboration diagram for ace_button::AdjustableButtonConfig:
Collaboration graph
[legend]

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...
 
- Public Member Functions inherited from ace_button::ButtonConfig
 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

- Public Types inherited from ace_button::ButtonConfig
typedef void(* EventHandler) (AceButton *button, uint8_t eventType, uint8_t buttonState)
 The event handler signature. More...
 
- Static Public Member Functions inherited from ace_button::ButtonConfig
static ButtonConfiggetSystemButtonConfig () ACE_BUTTON_INLINE
 Return a pointer to the singleton instance of the ButtonConfig which is attached to all AceButton instances by default.
 
- Static Public Attributes inherited from ace_button::ButtonConfig
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...
 

Detailed Description

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.

Member Function Documentation

◆ getClickDelay()

virtual uint16_t ace_button::AdjustableButtonConfig::getClickDelay ( )
inlineoverridevirtual

Milliseconds to wait for a possible click.

Reimplemented from ace_button::ButtonConfig.

◆ getDebounceDelay()

virtual uint16_t ace_button::AdjustableButtonConfig::getDebounceDelay ( )
inlineoverridevirtual

Milliseconds to wait for debouncing.

Reimplemented from ace_button::ButtonConfig.

◆ getLongPressDelay()

virtual uint16_t ace_button::AdjustableButtonConfig::getLongPressDelay ( )
inlineoverridevirtual

Milliseconds for a long press event.

Reimplemented from ace_button::ButtonConfig.

◆ getRepeatPressDelay()

virtual uint16_t ace_button::AdjustableButtonConfig::getRepeatPressDelay ( )
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.

◆ init()

virtual void ace_button::AdjustableButtonConfig::init ( )
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.

◆ setClickDelay()

void ace_button::AdjustableButtonConfig::setClickDelay ( uint16_t  clickDelay)
inline

Set the clickDelay.

◆ setDebounceDelay()

void ace_button::AdjustableButtonConfig::setDebounceDelay ( uint16_t  debounceDelay)
inline

Set the debounceDelay.

◆ setDoubleClickDelay()

void ace_button::AdjustableButtonConfig::setDoubleClickDelay ( uint16_t  doubleClickDelay)
inline

Set the doubleClickDelay.

◆ setLongPressDelay()

void ace_button::AdjustableButtonConfig::setLongPressDelay ( uint16_t  longPressDelay)
inline

Set the longPressDelay.

◆ setRepeatPressDelay()

void ace_button::AdjustableButtonConfig::setRepeatPressDelay ( uint16_t  repeatPressDelay)
inline

Set the repeatPressDelay.

◆ setRepeatPressInterval()

void ace_button::AdjustableButtonConfig::setRepeatPressInterval ( uint16_t  repeatPressInterval)
inline

Set the repeatPressInterval.


The documentation for this class was generated from the following file: