pulse sensor library

Dependents:   Pedometer_ticker 4180_Fitbit_rtos 4180_Fitness_Tracker

Revision:
1:2d8deec7cae7
Parent:
0:e80a245c4d0d
--- a/PulseSensor.cpp	Sun Feb 09 15:37:19 2014 +0000
+++ b/PulseSensor.cpp	Tue Apr 21 22:52:00 2020 +0000
@@ -10,8 +10,18 @@
     _callbackRateMs = callbackRateMs;
     
     _printDataCallback = printDataCallback;
+    
+    proc = true;
 }
 
+PulseSensor::PulseSensor(PinName analogPin)
+{
+    _started = false;
+    
+    _pAin = new AnalogIn(analogPin);
+    
+    proc = false;
+}
 
 PulseSensor::~PulseSensor()
 {
@@ -126,7 +136,9 @@
         QS = false;
         
         _pulseSensorTicker.attach(this, &PulseSensor::sensor_ticker_callback, ((float)_sensorTickRateMs/1000));
-        _processDataTicker.attach(this, &PulseSensor::process_data_ticker_callback,  ((float)_callbackRateMs/1000));
+        if(proc) {
+            _processDataTicker.attach(this, &PulseSensor::process_data_ticker_callback,  ((float)_callbackRateMs/1000));\
+        }
         _started = true;
         return true;
     }
@@ -149,4 +161,12 @@
     {
         return false;
     }
+}
+
+int PulseSensor::get_BPM()
+{
+    if(_started)
+    {
+        return BPM;
+    }
 }
\ No newline at end of file