21# if TESTABLE_CLASS >= TESTABLE_BUTTON
26# if TESTABLE_CLASS >= TESTABLE_CLICKER
30# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
46# if TESTABLE_CLASS >= TESTABLE_BUTTON
51# if TESTABLE_CLASS >= TESTABLE_CLICKER
55# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
71# if TESTABLE_CLASS >= TESTABLE_BUTTON
76# if TESTABLE_CLASS >= TESTABLE_CLICKER
80# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
96# if TESTABLE_CLASS >= TESTABLE_BUTTON
101# if TESTABLE_CLASS >= TESTABLE_CLICKER
105# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
121# if TESTABLE_CLASS >= TESTABLE_BUTTON
126# if TESTABLE_CLASS >= TESTABLE_CLICKER
130# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
146# if TESTABLE_CLASS >= TESTABLE_BUTTON
151# if TESTABLE_CLASS >= TESTABLE_CLICKER
155# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
181# if TESTABLE_CLASS >= TESTABLE_BUTTON
186# if TESTABLE_CLASS >= TESTABLE_CLICKER
190# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
206 if(!state.isPressed) {
210# if TESTABLE_CLASS >= TESTABLE_BUTTON
216# if TESTABLE_CLASS >= TESTABLE_CLICKER
220# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
227 if(state.isPressed) {
231# if TESTABLE_CLASS >= TESTABLE_BUTTON
237# if TESTABLE_CLASS >= TESTABLE_CLICKER
241# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
248# if TESTABLE_CLASS >= TESTABLE_BUTTON
261# if TESTABLE_CLASS >= TESTABLE_CLICKER
269# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
290# if TESTABLE_CLASS >= TESTABLE_BUTTON
305# if TESTABLE_CLASS >= TESTABLE_CLICKER
309# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
317# if TESTABLE_CLASS >= TESTABLE_BUTTON
332# if TESTABLE_CLASS >= TESTABLE_CLICKER
336# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
349 ButtonState &state(
btnState[index]);
353 if(!state.isPressed) {
354 Serial << F(
"Button btns[") << index << F(
"] (btn") << (char)(
'A' + index) << F(
") pressed") <<
endl;
356 state.isPressed =
true;
358 if(state.isPressed) {
359 Serial << F(
"Button btns[") << index << F(
"] (btn") << (char)(
'A' + index) << F(
") released") <<
endl;
361 state.isPressed =
false;
364# if TESTABLE_CLASS >= TESTABLE_BUTTON
367 Serial << F(
"Button btns[") << index << F(
"] (btn") << (char)(
'A' + index) << F(
") held") <<
endl;
372 Serial << F(
"Button btns[") << index << F(
"] (btn") << (char)(
'A' + index) << F(
") un-held") <<
endl;
374 state.isHeld =
false;
379 Serial << F(
"Button btns[") << index << F(
"] (btn") << (char)(
'A' + index) << F(
") idle") <<
endl;
384 Serial << F(
"Button btns[") << index << F(
"] (btn") << (char)(
'A' + index) << F(
") un-idle") <<
endl;
386 state.isIdle =
false;
391# if TESTABLE_CLASS >= TESTABLE_CLICKER
393 if(!state.isClicked) {
394 Serial << F(
"Button btns[") << index << F(
"] (btn") << (char)(
'A' + index) << F(
") clicked") <<
endl;
396 state.isClicked =
true;
397 }
else if(state.isClicked) {
398 state.isClicked =
false;
403# if TESTABLE_CLASS >= TESTABLE_DOUBLECLICKER
405 Serial << F(
"Button btns[") << index << F(
"] (btn") << (char)(
'A' + index) << F(
") double-clicked") <<
endl;
406 state.isDoubleClicked =
true;
408 state.isDoubleClicked =
false;
void checkButtonJustSingleClicked(Button *btn)
Check button that has just been single-clicked.
void checkButtonJustClicked(Button *btn)
Check button that has just been clicked.
void checkButtonListIntegrity()
Check integrity of ButtonList invariants (always hold true).
void checkButtonJustReleased(Button *btn)
Check button that has just been released.
void checkButtonJustHeld(Button *btn)
Check button that has just been held.
void checkButtonIntegrity(Button *btn, ButtonState &state)
Check integrity of Button invariants (always hold true).
void checkButtonJustIdle(Button *btn)
Check button that has just become or remains idle.
void checkButtonSetup(Button *btn)
Check the state of an individual button just setup.
void displayButtonChanges(int index)
Display button changes to Serial.
struct ButtonState btnState[NUM_BUTTONS]
Previous state for each button.
void checkButtonJustDoubleClicked(Button *btn)
Check button that has just been double-clicked.
void checkButtonJustPressed(Button *btn)
Check state of a pressed button just pressed.
Declarations for the Checks module.
#define NUM_BUTTONS
The number of buttons to connect for testing.
Utility function declarations.
#define assert(e)
Macro to assert using FlashStringHelper to reduce memory usage.
endl
Special type to allow Serial << endl to print a line and flush the stream.