heart rate monitor

Dependencies:   BLE_API GroveEarbudSensor mbed nRF51822

Fork of BLE_HeartRate by Bluetooth Low Energy

Revision:
67:b2d2dee347c0
Parent:
66:c09ddf226b9c
Child:
71:c86b4658af70
diff -r c09ddf226b9c -r b2d2dee347c0 main.cpp
--- a/main.cpp	Sat Jun 20 23:25:02 2015 +0000
+++ b/main.cpp	Wed Jul 01 07:45:55 2015 +0000
@@ -1,5 +1,5 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
+ * Copyright (c) 2006-2015 ARM Limited
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,17 +15,12 @@
  */
 
 #include "mbed.h"
-#include "BLE.h"
-#include "HeartRateService.h"
-#include "DeviceInformationService.h"
+#include "ble/BLE.h"
+#include "ble/services/HeartRateService.h"
+#include "ble/services/BatteryService.h"
+#include "ble/services/DeviceInformationService.h"
 
-/* Enable the following if you need to throttle the connection interval. This has
- * the effect of reducing energy consumption after a connection is made;
- * particularly for applications where the central may want a fast connection
- * interval.*/
-#define UPDATE_PARAMS_FOR_LONGER_CONNECTION_INTERVAL 0
-
-BLE        ble;
+BLE  ble;
 DigitalOut led1(LED1);
 
 const static char     DEVICE_NAME[]        = "HRM1";
@@ -69,7 +64,7 @@
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::GENERIC_HEART_RATE_SENSOR);
     ble.gap().accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LOCAL_NAME, (uint8_t *)DEVICE_NAME, sizeof(DEVICE_NAME));
     ble.gap().setAdvertisingType(GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED);
-    ble.gap().setAdvertisingInterval(1000);
+    ble.gap().setAdvertisingInterval(1000); /* 1000ms */
     ble.gap().startAdvertising();
 
     // infinite loop
@@ -79,14 +74,14 @@
             triggerSensorPolling = false;
 
             // Do blocking calls or whatever is necessary for sensor polling.
-            // In our case, we simply update the HRM measurement. 
+            // In our case, we simply update the HRM measurement.
             hrmCounter++;
-            
+
             //  100 <= HRM bps <=175
             if (hrmCounter == 175) {
                 hrmCounter = 100;
             }
-            
+
             // update bps
             hrService.updateHeartRate(hrmCounter);
         } else {