AbleButtons V0.2.0
Lightweight button library for Arduino.
 
Loading...
Searching...
No Matches
Released.cpp
Go to the documentation of this file.
1/**
2 * @file Released.cpp Definition of the on-released callback function. This
3 * function performs some assertions on the state of the button list and the
4 * individual button pressed when a button is released.
5 *
6 * @copyright Copyright (c) 2022 John Scott
7 */
8#include "TestAbleButton.h"
9#include "Utils.h"
10
11Button *releasedBtn; ///< Button just released.
12
13/**
14 * Callback function for button released.
15 *
16 * @param btn The button generaing the event.
17 */
19 checkButtonListIntegrity();
20
21 if(btn) {
23 checkButtonListJustReleased(btn);
24
26 } else {
27 assert(false);
28 }
29}
30
31/**
32 * Callback function for button idle.
33 *
34 * @param btn The button generaing the event.
35 */
37 checkButtonListIntegrity();
38
39 if(btn) {
41 checkButtonListJustIdle(btn);
42 } else {
43 assert(false);
44 }
45}
Button btn(BUTTON_PIN)
The button to check.
void checkButtonJustReleased(Button *btn)
Check button that has just been released.
Definition: CheckButton.cpp:41
void checkButtonJustIdle(Button *btn)
Check button that has just become idle.
Definition: CheckButton.cpp:73
Button * releasedBtn
Button just released.
Definition: Released.cpp:11
void onIdle(Button *btn)
Callback function for button idle.
Definition: Released.cpp:36
void onReleased(Button *btn)
Callback function for button released.
Definition: Released.cpp:18
Declarations for the TestAbleButton program.
Utility function declarations.
#define assert(e)
Macro to assert using FlashStringHelper to reduce memory usage.
Definition: Utils.h:30
Core Button class.
Definition: Button.h:22