RSeries astromech firmware
|
#include <core/PushButton.h>
Public Types | |
typedef void(* | CallbackFunction) (void) |
typedef void(* | ParameterizedCallbackFunction) (void *) |
Public Member Functions | |
PushButton (const int pin, const bool activeLow=true, const bool pullupActive=true) | |
Initialize the PushButton. More... | |
void | setDebounceTicks (const int ticks) |
set # millisec after safe click is assumed. More... | |
void | setClickTicks (const int ticks) |
set # millisec after single click is assumed. More... | |
void | setPressTicks (const int ticks) |
set # millisec after press is assumed. More... | |
void | attachClick (CallbackFunction callback) |
Attach an event to be called when a single click is detected. More... | |
void | attachClick (ParameterizedCallbackFunction callback, void *param) |
Attach an event to be called when a single click is detected. More... | |
void | attachDoubleClick (CallbackFunction callback) |
Attach an event to be called after a double click is detected. More... | |
void | attachDoubleClick (ParameterizedCallbackFunction callback, void *param) |
Attach an event to be called after a double click is detected. More... | |
void | attachMultiClick (CallbackFunction callback) |
Attach an event to be called after a multi click is detected. More... | |
void | attachMultiClick (ParameterizedCallbackFunction callback, void *param) |
Attach an event to be called after a multi click is detected. More... | |
void | attachLongPressStart (CallbackFunction callback) |
Attach an event to fire when the button is pressed and held down. More... | |
void | attachLongPressStart (ParameterizedCallbackFunction callback, void *param) |
Attach an event to fire when the button is pressed and held down. More... | |
void | attachLongPressStop (CallbackFunction callback) |
Attach an event to fire as soon as the button is released after a long press. More... | |
void | attachLongPressStop (ParameterizedCallbackFunction callback, void *param) |
Attach an event to fire as soon as the button is released after a long press. More... | |
void | attachDuringLongPress (CallbackFunction callback) |
Attach an event to fire periodically while the button is held down. More... | |
void | attachDuringLongPress (ParameterizedCallbackFunction callback, void *param) |
Attach an event to fire periodically while the button is held down. More... | |
virtual void | setup () override |
Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor. More... | |
virtual void | animate () override |
Call this function every some milliseconds for checking the input level at the initialized digital pin. More... | |
void | reset (void) |
Reset the button state machine. More... | |
int | getNumberClicks (void) const |
Returns number of clicks in any case: single or multiple clicks. More... | |
bool | isIdle () const |
bool | isLongPressed () const |
Public Member Functions inherited from SetupEvent | |
SetupEvent () | |
Default Constructor. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from SetupEvent | |
static void | ready () |
Calls setup() for each created AnimatedEvent subclass. More... | |
typedef void(* PushButton::CallbackFunction) (void) |
typedef void(* PushButton::ParameterizedCallbackFunction) (void *) |
|
inline |
Initialize the PushButton.
pin | The pin to be used for input from a momentary button. |
activeLow | Set to true when the input level is LOW when the button is pressed, Default is true. |
pullupActive | Activate the internal pullup when available. Default is true. |
|
inlineoverridevirtual |
Call this function every some milliseconds for checking the input level at the initialized digital pin.
Implements AnimatedEvent.
|
inline |
Attach an event to be called when a single click is detected.
callback | This function will be called when the event has been detected. |
|
inline |
Attach an event to be called when a single click is detected.
callback | This function will be called when the event has been detected. |
|
inline |
Attach an event to be called after a double click is detected.
callback | This function will be called when the event has been detected. |
|
inline |
Attach an event to be called after a double click is detected.
callback | This function will be called when the event has been detected. |
|
inline |
Attach an event to fire periodically while the button is held down.
callback |
|
inline |
Attach an event to fire periodically while the button is held down.
callback |
|
inline |
Attach an event to fire when the button is pressed and held down.
callback |
|
inline |
Attach an event to fire when the button is pressed and held down.
callback |
|
inline |
Attach an event to fire as soon as the button is released after a long press.
callback |
|
inline |
Attach an event to fire as soon as the button is released after a long press.
callback |
|
inline |
Attach an event to be called after a multi click is detected.
callback | This function will be called when the event has been detected. |
|
inline |
Attach an event to be called after a multi click is detected.
callback | This function will be called when the event has been detected. |
|
inline |
Returns number of clicks in any case: single or multiple clicks.
|
inline |
|
inline |
|
inline |
Reset the button state machine.
|
inline |
set # millisec after single click is assumed.
|
inline |
set # millisec after safe click is assumed.
|
inline |
set # millisec after press is assumed.
|
inlineoverridevirtual |
Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor.
Implements SetupEvent.