![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
hr with 30102
Dependencies: BLE_API mbed X_NUCLEO_IDB0XA1
Fork of BLE_HeartRate by
Diff: main.cpp
- Revision:
- 80:808f6f367f45
- Parent:
- 75:8128a06c0a21
--- a/main.cpp Tue Sep 20 12:36:16 2016 +0100 +++ b/main.cpp Sun Jul 30 05:52:57 2017 +0000 @@ -19,16 +19,19 @@ #include "ble/services/HeartRateService.h" #include "ble/services/BatteryService.h" #include "ble/services/DeviceInformationService.h" +#include "MAX30102.h" DigitalOut led1(LED1); -const static char DEVICE_NAME[] = "HRM1"; +const static char DEVICE_NAME[] = "SPACE_CAKE"; static const uint16_t uuid16_list[] = {GattService::UUID_HEART_RATE_SERVICE, GattService::UUID_DEVICE_INFORMATION_SERVICE}; static volatile bool triggerSensorPolling = false; uint8_t hrmCounter = 100; // init HRM to 100bps +uint8_t uch_dummy; + HeartRateService *hrService; DeviceInformationService *deviceInfo; @@ -58,7 +61,7 @@ ble.gap().onDisconnection(disconnectionCallback); /* Setup primary service. */ - hrService = new HeartRateService(ble, hrmCounter, HeartRateService::LOCATION_FINGER); + hrService = new HeartRateService(ble, hrmCounter, HeartRateService::LOCATION_WRIST); /* Setup auxiliary service. */ deviceInfo = new DeviceInformationService(ble, "ARM", "Model1", "SN1", "hw-rev1", "fw-rev1", "soft-rev1"); @@ -85,7 +88,14 @@ /* SpinWait for initialization to complete. This is necessary because the * BLE object is used in the main loop below. */ while (ble.hasInitialized() == false) { /* spin loop */ } - + + maxim_max30102_reset(); //resets the MAX30102 + + //read and clear status register + maxim_max30102_read_reg(0,&uch_dummy); + + maxim_max30102_init(); //initializes the MAX30102 + // infinite loop while (1) { // check for trigger from periodicCallback()