Another commit for the interrupt added. Renamed the main branch screwed up somethings..

Dependencies:   BLE_API LSM9DS1 mbed nRF51822 nrf51_rtc

Files at this revision

API Documentation at this revision

Comitter:
5hel2l2y
Date:
Mon Jul 11 20:53:21 2016 +0000
Parent:
4:89be9162c6aa
Commit message:
Modified read rate.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
nrf51_rtc.lib Show annotated file Show diff for this revision Revisions of this file
diff -r 89be9162c6aa -r b0e3d5d682b0 main.cpp
--- a/main.cpp	Fri Jul 08 21:15:16 2016 +0000
+++ b/main.cpp	Mon Jul 11 20:53:21 2016 +0000
@@ -20,6 +20,8 @@
 #include "ble/services/UARTService.h"
 #include "LSM9DS1/LSM9DS1.h"
 
+#include "nrf51_rtc.h"
+
 LSM9DS1 imu(p30, p7);
 Serial pc(p9, p11);
 
@@ -98,6 +100,7 @@
 
 void periodicCallback(void)
 {
+    ble.waitForEvent();
     ledAlive = !ledAlive;
 }
 
@@ -122,6 +125,8 @@
 
 int main(void)
 {
+    time_t rawtime = 0;
+    
     // turn all LED off
     ledAlive = 1;
     ledIntrM = 1;
@@ -163,15 +168,13 @@
     intrGX.rise(&flip4);
     intrGXO.rise(&flip3);
 
-    while (true) {
-        ble.waitForEvent();
-        
+    while (true) {        
+        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);
         imu.readMag();
-        pc.printf("%2f,%2f,%2f\r\n", imu.mx,imu.my,imu.mz);
+        pc.printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\r\n", rawtime,imu.ax_raw,imu.ay_raw,imu.az_raw,imu.gx_raw,imu.gy_raw,imu.gz_raw,imu.mx_raw,imu.my_raw,imu.mz_raw);
         
         // Interrupt stats: This is only enabled in Low Power Mode
         // 38 - no interrupt
@@ -183,7 +186,5 @@
 //            pc.printf(" == interrupted == \r\n");
 //            flip(ledIntrO);
 //        }
-        
-        wait(1.0);
     }
 }
diff -r 89be9162c6aa -r b0e3d5d682b0 nrf51_rtc.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nrf51_rtc.lib	Mon Jul 11 20:53:21 2016 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/fxschumacher/code/nrf51_rtc/#3677a016109b