A blue button is always a nice toy ...

Dependencies:   BLE_API X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers stop.cpp Source File

stop.cpp

00001 // stop.cpp - stop button functionality
00002 
00003 #include "bricks/stop.h"
00004 
00005 //==============================================================================
00006 // Stop Button Functionality
00007 //==============================================================================
00008 
00009    static bool flag;                   // stop indication flag
00010 
00011    static void cbButton(void)          // button press callback
00012    {
00013       flag = true;
00014    } 
00015           
00016    void StopButton::set()              // set stop flag
00017    {
00018       flag = true;
00019    }
00020    
00021    void StopButton::clear()            // clear stop flag
00022    {
00023       flag = false;
00024    }
00025    
00026    bool StopButton::request()          // stop requested?
00027    {
00028       return flag;
00029    }
00030           
00031    StopButton::StopButton(PinName pin) : InterruptIn(pin)   // constructor
00032    {
00033       clear();
00034       rise(&cbButton);  
00035    }
00036 
00037 // eof