![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
A blue button is always a nice toy ...
Dependencies: BLE_API X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
bricks/stop.cpp@29:a6b74dfdd5f2, 2017-10-01 (annotated)
- Committer:
- hux
- Date:
- Sun Oct 01 12:49:25 2017 +0000
- Revision:
- 29:a6b74dfdd5f2
- Parent:
- 28:307f58df778a
A blue button is always a nice toy ...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hux | 28:307f58df778a | 1 | // stop.cpp - stop button functionality |
hux | 28:307f58df778a | 2 | |
hux | 28:307f58df778a | 3 | #include "bricks/stop.h" |
hux | 28:307f58df778a | 4 | |
hux | 28:307f58df778a | 5 | //============================================================================== |
hux | 28:307f58df778a | 6 | // Stop Button Functionality |
hux | 28:307f58df778a | 7 | //============================================================================== |
hux | 28:307f58df778a | 8 | |
hux | 28:307f58df778a | 9 | static bool flag; // stop indication flag |
hux | 28:307f58df778a | 10 | |
hux | 28:307f58df778a | 11 | static void cbButton(void) // button press callback |
hux | 28:307f58df778a | 12 | { |
hux | 28:307f58df778a | 13 | flag = true; |
hux | 28:307f58df778a | 14 | } |
hux | 28:307f58df778a | 15 | |
hux | 28:307f58df778a | 16 | void StopButton::set() // set stop flag |
hux | 28:307f58df778a | 17 | { |
hux | 28:307f58df778a | 18 | flag = true; |
hux | 28:307f58df778a | 19 | } |
hux | 28:307f58df778a | 20 | |
hux | 28:307f58df778a | 21 | void StopButton::clear() // clear stop flag |
hux | 28:307f58df778a | 22 | { |
hux | 28:307f58df778a | 23 | flag = false; |
hux | 28:307f58df778a | 24 | } |
hux | 28:307f58df778a | 25 | |
hux | 28:307f58df778a | 26 | bool StopButton::request() // stop requested? |
hux | 28:307f58df778a | 27 | { |
hux | 28:307f58df778a | 28 | return flag; |
hux | 28:307f58df778a | 29 | } |
hux | 28:307f58df778a | 30 | |
hux | 28:307f58df778a | 31 | StopButton::StopButton(PinName pin) : InterruptIn(pin) // constructor |
hux | 28:307f58df778a | 32 | { |
hux | 28:307f58df778a | 33 | clear(); |
hux | 28:307f58df778a | 34 | rise(&cbButton); |
hux | 28:307f58df778a | 35 | } |
hux | 28:307f58df778a | 36 | |
hux | 28:307f58df778a | 37 | // eof |