Pull request for i.a. sensor buffer template

Dependencies:   BLE_API MPU6050 mbed nRF51822

Revision:
5:614164945894
Parent:
4:aea4ff8e52ef
Child:
6:ed0dc0647c01
--- a/main.cpp	Wed Sep 19 18:24:52 2018 +0000
+++ b/main.cpp	Wed Sep 19 19:49:39 2018 +0000
@@ -9,6 +9,7 @@
 #include "UARTService.h"
 #include "BatteryService.h"
 #include "DeviceInformationService.h"
+#include "TemperatureService.h"
 
 
 #define LOG(...)    { pc.printf(__VA_ARGS__); }
@@ -167,6 +168,7 @@
     //uartService.retargetStdout();
     BatteryService battery(ble);
     DeviceInformationService deviceInfo(ble, MANUFACTURER, MODELNUMBER, SERIALNUMBER, HARDWAREREVISION, FIRMWAREREVISION, SOFTWAREREVISION);
+    TemperatureService tempService(ble);
 
     ble.setAdvertisingInterval(160); /* 100ms; in multiples of 0.625ms. */
     ble.gap().startAdvertising();
@@ -187,7 +189,13 @@
             startMeasure = false;
             
             float temp = mpu.getTemp();
-            LOG("Temp = %f\n", temp);
+            LOG("Temp = %.01f\n", temp);
+            int16_t tempRaw = mpu.getTempRaw();
+            tempRaw *= 10;
+            tempRaw += 5210;
+            tempRaw /= 340;
+            tempRaw += 350;
+            tempService.updateTemperature(tempRaw);
         }
     }
 }