A blue button is always a nice toy ...
Dependencies: BLE_API X_NUCLEO_IDB0XA1 mbed
Fork of BLE_HeartRate_IDB0XA1 by
Diff: bricks/stop.cpp
- Revision:
- 28:307f58df778a
diff -r 32267cee7cb8 -r 307f58df778a bricks/stop.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bricks/stop.cpp Sun Oct 01 12:48:58 2017 +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