Template for a list of buttons of the same type. More...
#include <ButtonList.h>
Public Member Functions | |
template<size_t n> | |
ButtonList (Button *(&buttons)[n]) | |
Create a list of buttons. More... | |
ButtonList (Button **buttons, size_t len) | |
Create a list of buttons. More... | |
void | begin () |
Initialise all the buttons. More... | |
void | handle () |
Handle all the buttons. More... | |
bool | resetClicked () |
Reset clicked state of all buttons, returning true if any were clicked. More... | |
bool | resetDoubleClicked () |
Reset double-clicked state of all buttons, returning true if any were double-clicked. More... | |
bool | resetSingleClicked () |
Reset single-clicked state of all buttons, returning true if any were single-clicked. More... | |
Button * | button (uint8_t id) const |
For CallbackButtons (which each have an id), return a pointer to the first button matching the id (or a null pointer if the id is not found). More... | |
bool | allPressed () const |
Determine if all of the buttons are currently pressed. More... | |
bool | anyPressed () const |
Determine if any of the buttons are currently pressed. More... | |
bool | allHeld () const |
Determine if all of the buttons are currently held. More... | |
bool | anyHeld () const |
Determine if any of the buttons are currently held. More... | |
bool | allIdle () const |
Determine if all of the buttons are currently idle. More... | |
bool | anyIdle () const |
Determine if any of the buttons are currently idle. More... | |
bool | allClicked () const |
Determine if all of the buttons have been clicked. More... | |
bool | anyClicked () const |
Determine if all of the buttons have been clicked. More... | |
bool | allDoubleClicked () const |
Determine if all of the buttons have been double-clicked. More... | |
bool | anyDoubleClicked () const |
Determine if any of the buttons have been double-clicked. More... | |
bool | allSingleClicked () const |
Determine if all of the buttons have been single-clicked. More... | |
bool | anySingleClicked () const |
Determine if any of the buttons have been single-clicked. More... | |
Template for a list of buttons of the same type.
Allows a set of buttons to be controlled together. NB: You cannot mix different button types in the same button list. Use separate lists to manage collections of pulldown, and pull-up resistors, buttons and clickers) s in the same list (use separate lists).
Definition at line 20 of file ButtonList.h.
|
inline |
Create a list of buttons.
Makes beginning and handling of a set of buttons easier.
buttons | The array of buttons to manage together. |
Definition at line 33 of file ButtonList.h.
|
inline |
Create a list of buttons.
Makes beginning and handling of a set of buttons easier.
buttons | The array of buttons to manage together. |
len | The number of buttons in the list. |
Definition at line 42 of file ButtonList.h.
|
inline |
Determine if all of the buttons have been clicked.
Definition at line 244 of file ButtonList.h.
|
inline |
Determine if all of the buttons have been double-clicked.
Definition at line 274 of file ButtonList.h.
|
inline |
Determine if all of the buttons are currently held.
Definition at line 184 of file ButtonList.h.
|
inline |
Determine if all of the buttons are currently idle.
Definition at line 214 of file ButtonList.h.
|
inline |
Determine if all of the buttons are currently pressed.
Definition at line 154 of file ButtonList.h.
|
inline |
Determine if all of the buttons have been single-clicked.
Definition at line 304 of file ButtonList.h.
|
inline |
Determine if all of the buttons have been clicked.
Definition at line 259 of file ButtonList.h.
|
inline |
Determine if any of the buttons have been double-clicked.
Definition at line 289 of file ButtonList.h.
|
inline |
Determine if any of the buttons are currently held.
Definition at line 199 of file ButtonList.h.
|
inline |
Determine if any of the buttons are currently idle.
Definition at line 229 of file ButtonList.h.
|
inline |
Determine if any of the buttons are currently pressed.
Definition at line 169 of file ButtonList.h.
|
inline |
Determine if any of the buttons have been single-clicked.
Definition at line 319 of file ButtonList.h.
|
inline |
Initialise all the buttons.
Called from setup() of an Arduino program.
Definition at line 53 of file ButtonList.h.
|
inline |
For CallbackButtons (which each have an id), return a pointer to the first button matching the id (or a null pointer if the id is not found).
When using the button, always check if the return value is non-zero.
Button *btn = btnList.button(id); if(btn) { // Use btn... } else { // Id not found in list... }
id | The identifier of the button to find in the list. |
Definition at line 138 of file ButtonList.h.
|
inline |
Handle all the buttons.
Called in the loop() of an Arduino program to monitor all button states and dispatch any callback events if required.
Definition at line 63 of file ButtonList.h.
|
inline |
Reset clicked state of all buttons, returning true if any were clicked.
Definition at line 74 of file ButtonList.h.
|
inline |
Reset double-clicked state of all buttons, returning true if any were double-clicked.
Definition at line 90 of file ButtonList.h.
|
inline |
Reset single-clicked state of all buttons, returning true if any were single-clicked.
Definition at line 106 of file ButtonList.h.