BLE NAND for ST Boards
Dependencies: BLE_API X_NUCLEO_IDB0XA1 mbed
Fork of N06_NAND by
bricks/stop.cpp@26:dce30a5341bb, 2018-05-19 (annotated)
- Committer:
- hux
- Date:
- Sat May 19 14:10:17 2018 +0000
- Revision:
- 26:dce30a5341bb
- Parent:
- 25:339931243be4
Published
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hux | 25:339931243be4 | 1 | // stop.cpp - stop button functionality |
hux | 25:339931243be4 | 2 | |
hux | 25:339931243be4 | 3 | #include "bricks/stop.h" |
hux | 25:339931243be4 | 4 | |
hux | 25:339931243be4 | 5 | //============================================================================== |
hux | 25:339931243be4 | 6 | // Stop Button Functionality |
hux | 25:339931243be4 | 7 | //============================================================================== |
hux | 25:339931243be4 | 8 | |
hux | 25:339931243be4 | 9 | static bool flag; // stop indication flag |
hux | 25:339931243be4 | 10 | |
hux | 25:339931243be4 | 11 | static void cbButton(void) // button press callback |
hux | 25:339931243be4 | 12 | { |
hux | 25:339931243be4 | 13 | flag = true; |
hux | 25:339931243be4 | 14 | } |
hux | 25:339931243be4 | 15 | |
hux | 25:339931243be4 | 16 | void StopButton::set() // set stop flag |
hux | 25:339931243be4 | 17 | { |
hux | 25:339931243be4 | 18 | flag = true; |
hux | 25:339931243be4 | 19 | } |
hux | 25:339931243be4 | 20 | |
hux | 25:339931243be4 | 21 | void StopButton::clear() // clear stop flag |
hux | 25:339931243be4 | 22 | { |
hux | 25:339931243be4 | 23 | flag = false; |
hux | 25:339931243be4 | 24 | } |
hux | 25:339931243be4 | 25 | |
hux | 25:339931243be4 | 26 | bool StopButton::request() // stop requested? |
hux | 25:339931243be4 | 27 | { |
hux | 25:339931243be4 | 28 | return flag; |
hux | 25:339931243be4 | 29 | } |
hux | 25:339931243be4 | 30 | |
hux | 25:339931243be4 | 31 | StopButton::StopButton(PinName pin) : InterruptIn(pin) // constructor |
hux | 25:339931243be4 | 32 | { |
hux | 25:339931243be4 | 33 | clear(); |
hux | 25:339931243be4 | 34 | rise(&cbButton); |
hux | 25:339931243be4 | 35 | } |
hux | 25:339931243be4 | 36 | |
hux | 25:339931243be4 | 37 | // eof |