Nora Vazbyte
/
99Problems-BLEAint1
app critics will say it's money, cash, toes
Diff: source/main.cpp
- Revision:
- 4:af0530752b76
- Parent:
- 3:a33709dad06c
- Child:
- 5:c75ea8bfa9fb
--- a/source/main.cpp Sun Oct 28 14:10:06 2018 +0000 +++ b/source/main.cpp Sun Oct 28 15:38:10 2018 +0000 @@ -28,8 +28,11 @@ const static char DEVICE_NAME[] = "ProVaida"; static const uint16_t uuid16_list[] = {GattService::UUID_HEART_RATE_SERVICE}; +int16_t destination[3]; uint8_t hrmCounter = 0; static HeartRateService* hrService; +//MPU9250 mpu = MPU9250(p26, p27); +MPU9250 mpu = MPU9250(P0_26, P0_27); static EventQueue eventQueue(/* event count */ 16 * EVENTS_EVENT_SIZE); @@ -39,12 +42,7 @@ } void updateSensorValue() { -// hrmCounter++; -// if (hrmCounter > 175) { -// hrmCounter = 100; -// } - MPU9250 mpu = MPU9250(p26, p27); - int16_t * destination; + mpu.readAccelData(destination); uint8_t acc_x = destination[0]; @@ -57,7 +55,8 @@ double sum_acc = sqr_acc_x + sqr_acc_y + sqr_acc_z; - hrmCounter = sqrt(sum_acc); + uint8_t value = sqrt(sum_acc); + hrmCounter = acc_x; hrService->updateHeartRate(hrmCounter); } @@ -134,10 +133,9 @@ } int main() -{ - MPU9250 mpu = MPU9250(p26, p27); +{ mpu.initMPU9250(); - eventQueue.call_every(100, blinkCallback); + eventQueue.call_every(400, blinkCallback); BLE &ble = BLE::Instance(); ble.onEventsToProcess(scheduleBleEventsProcessing);