Change LSM6DS3 power mode using nRF51-DK BLE.

Dependencies:   BLE_API LSM6DS3 mbed nRF51822 nrf51_rtc

Revision:
5:e2ba3c39e3b3
Parent:
4:46dd8065e05b
--- a/main.cpp	Fri Jul 08 21:26:38 2016 +0000
+++ b/main.cpp	Mon Jul 11 21:03:17 2016 +0000
@@ -20,6 +20,8 @@
 #include "ble/services/UARTService.h"
 #include "LSM6DS3/LSM6DS3.h"
 
+#include "nrf51_rtc.h"
+
 LSM6DS3 imu(p30, p7);
 Serial pc(p9, p11);
 
@@ -95,6 +97,7 @@
 
 void periodicCallback(void)
 {
+    ble.waitForEvent();
     ledAlive = !ledAlive;
 }
 
@@ -115,6 +118,8 @@
 
 int main(void)
 {
+    time_t rawtime = 0;
+    
     // turn all LED off
     ledAlive = 1;
     ledIntrG = 1;
@@ -155,21 +160,18 @@
     intrGXO.rise(&flip3);
 
     while (true) {
-        ble.waitForEvent();
-        
+        rawtime = rtc.time();
+    
         imu.readAccel();
-        pc.printf("%2f,%2f,%2f\r\n", imu.ax,imu.ay,imu.az);
         imu.readGyro();
-        pc.printf("%2f,%2f,%2f\r\n", imu.gx,imu.gy,imu.gz);
         // no magnetometer available for this sensor
-        pc.printf("0.000000,0.000000,0.000000\r\n");
+        pc.printf("%d,%d,%d,%d,%d,%d,%d,0.000000,0.000000,0.000000\r\n", rawtime,imu.ax_raw,imu.ay_raw,imu.az_raw,imu.gx_raw,imu.gy_raw,imu.gz_raw);
+
         //imu.readIntr();
 //        pc.printf("intr: %f\r\n", imu.intr);
 //        if(imu.intr > 0) {
 //            pc.printf(" == interrupted == \r\n");
 //            flip(LED2);
 //        }
-        
-        wait(1.0);
     }
 }