cycle speed and cadence service
Dependencies: BLE_API mbed nRF51822
Fork of Bluetooth_Heart_Rate_Monitor_dummy by
Diff: main.cpp
- Revision:
- 61:16f888838853
- Parent:
- 60:9fd2b0b43718
- Child:
- 62:2ea9997b5249
--- a/main.cpp Sun May 03 07:05:17 2015 +0000 +++ b/main.cpp Mon May 04 17:18:12 2015 +0000 @@ -16,7 +16,7 @@ #include "mbed.h" #include "BLEDevice.h" -#include "HeartRateService.h" +#include "CycleSpeedCadenceService.h" #include "DeviceInformationService.h" /* Enable the following if you need to throttle the connection interval. This has @@ -29,7 +29,7 @@ DigitalOut led1(LED1); const static char DEVICE_NAME[] = "ST HRM2"; -static const uint16_t uuid16_list[] = {GattService::UUID_HEART_RATE_SERVICE, +static const uint16_t uuid16_list[] = {GattService::UUID_CYCLING_SPEED_AND_CADENCE, GattService::UUID_DEVICE_INFORMATION_SERVICE}; static volatile bool triggerSensorPolling = false; @@ -57,8 +57,9 @@ ble.onDisconnection(disconnectionCallback); /* Setup primary service. */ - uint8_t hrmCounter = 100; // init HRM to 100bps - HeartRateService hrService(ble, hrmCounter, HeartRateService::LOCATION_FINGER); + uint32_t counter = 0; // init HRM to 100bps + uint16_t event = 0; // init HRM to 100bps + CycleSpeedCadenceService speedService(ble, counter,event, CycleSpeedCadenceService::LOCATION_REAR_DROPOUT, false); /* Setup auxiliary service. */ DeviceInformationService deviceInfo(ble, "ARM", "Model1", "SN1", "hw-rev1", "fw-rev1", "soft-rev1"); @@ -80,15 +81,12 @@ // Do blocking calls or whatever is necessary for sensor polling. // In our case, we simply update the HRM measurement. - hrmCounter++; + counter++; - // 100 <= HRM bps <=175 - if (hrmCounter == 175) { - hrmCounter = 100; - } + // update bps - hrService.updateHeartRate(hrmCounter); + speedService.updateWheel(counter,event); } else { ble.waitForEvent(); // low power wait for event }