TOF based Presence Detector

Dependencies:   BLE_API X_NUCLEO_6180XA1 X_NUCLEO_IDB0XA1 mbed

Fork of BLE_HeartRate_IDB0XA1 by ST

Committer:
hux
Date:
Mon Aug 20 16:42:59 2018 +0000
Revision:
28:a23b16555909
TOF Detector - Basis for Presence Detection

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hux 28:a23b16555909 1 // stop.cpp - stop button functionality
hux 28:a23b16555909 2
hux 28:a23b16555909 3 #include "bricks/stop.h"
hux 28:a23b16555909 4
hux 28:a23b16555909 5 //==============================================================================
hux 28:a23b16555909 6 // Stop Button Functionality
hux 28:a23b16555909 7 //==============================================================================
hux 28:a23b16555909 8
hux 28:a23b16555909 9 static bool flag; // stop indication flag
hux 28:a23b16555909 10
hux 28:a23b16555909 11 static void cbButton(void) // button press callback
hux 28:a23b16555909 12 {
hux 28:a23b16555909 13 flag = true;
hux 28:a23b16555909 14 }
hux 28:a23b16555909 15
hux 28:a23b16555909 16 void StopButton::set() // set stop flag
hux 28:a23b16555909 17 {
hux 28:a23b16555909 18 flag = true;
hux 28:a23b16555909 19 }
hux 28:a23b16555909 20
hux 28:a23b16555909 21 void StopButton::clear() // clear stop flag
hux 28:a23b16555909 22 {
hux 28:a23b16555909 23 flag = false;
hux 28:a23b16555909 24 }
hux 28:a23b16555909 25
hux 28:a23b16555909 26 bool StopButton::request() // stop requested?
hux 28:a23b16555909 27 {
hux 28:a23b16555909 28 return flag;
hux 28:a23b16555909 29 }
hux 28:a23b16555909 30
hux 28:a23b16555909 31 StopButton::StopButton(PinName pin) : InterruptIn(pin) // constructor
hux 28:a23b16555909 32 {
hux 28:a23b16555909 33 clear();
hux 28:a23b16555909 34 rise(&cbButton);
hux 28:a23b16555909 35 }
hux 28:a23b16555909 36
hux 28:a23b16555909 37 // eof