BLE NAND for ST Boards
Dependencies: BLE_API X_NUCLEO_IDB0XA1 mbed
Fork of N06_NAND by
Diff: bricks/stop.cpp
- Revision:
- 25:339931243be4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bricks/stop.cpp Sat May 19 14:09:24 2018 +0000 @@ -0,0 +1,37 @@ +// stop.cpp - stop button functionality + +#include "bricks/stop.h" + +//============================================================================== +// Stop Button Functionality +//============================================================================== + + static bool flag; // stop indication flag + + static void cbButton(void) // button press callback + { + flag = true; + } + + void StopButton::set() // set stop flag + { + flag = true; + } + + void StopButton::clear() // clear stop flag + { + flag = false; + } + + bool StopButton::request() // stop requested? + { + return flag; + } + + StopButton::StopButton(PinName pin) : InterruptIn(pin) // constructor + { + clear(); + rise(&cbButton); + } + +// eof \ No newline at end of file