A blue button is always a nice toy ...

Dependencies:   BLE_API X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

bricks/stop.cpp

Committer:
hux
Date:
2017-10-01
Revision:
29:a6b74dfdd5f2
Parent:
28:307f58df778a

File content as of revision 29:a6b74dfdd5f2:

// 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