FXOS8700CQ demo for mbed OS 5

Dependencies:   FXOS8700CQ

Fork of fxos8700cq_example by Thomas Murphy

Files at this revision

API Documentation at this revision

Comitter:
janjongboom
Date:
Thu Mar 02 17:12:56 2017 +0000
Parent:
0:6c6060a8a2f6
Commit message:
Update to mbed OS 5 and have the lib maintain its own memory

Changed in this revision

FXOS8700CQ.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show diff for this revision Revisions of this file
--- a/FXOS8700CQ.lib	Wed May 28 17:32:41 2014 +0000
+++ b/FXOS8700CQ.lib	Thu Mar 02 17:12:56 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/trm/code/FXOS8700CQ/#4c2f8a3549a9
+https://developer.mbed.org/users/janjongboom/code/FXOS8700CQ/#2bd683278d23
--- a/main.cpp	Wed May 28 17:32:41 2014 +0000
+++ b/main.cpp	Thu Mar 02 17:12:56 2017 +0000
@@ -23,10 +23,6 @@
 uint32_t us_ellapsed = 0;
 bool start_sw_triggered = false;
 
-// Storage for the data from the sensor
-SRAWDATA accel_data;
-SRAWDATA magn_data;
-
 void trigger_fxos_int1(void)
 {
     fxos_int1_triggered = true;
@@ -47,8 +43,8 @@
 {
     pc.printf("%d A X:%5d,Y:%5d,Z:%5d   M X:%5d,Y:%5d,Z:%5d\r\n",
               us_ellapsed,
-              accel_data.x, accel_data.y, accel_data.z,
-              magn_data.x, magn_data.y, magn_data.z);
+              fxos.getAccelX(), fxos.getAccelY(), fxos.getAccelZ(),
+              fxos.getMagnetX(), fxos.getMagnetY(), fxos.getMagnetZ());
 }
 
 int main(void)
@@ -77,7 +73,7 @@
     green.write(0); // ready-green on
 
     // Example data printing
-    fxos.get_data(&accel_data, &magn_data);
+    fxos.get_data();
     print_reading();
 
     pc.printf("Waiting for data collection trigger on SW3\r\n");
@@ -95,7 +91,7 @@
    pc.printf("Started data collection. Accelerometer at max %dg.\r\n",
    fxos.get_accel_scale());
 
-    fxos.get_data(&accel_data, &magn_data); // clear interrupt from device
+    fxos.get_data(); // clear interrupt from device
     fxos_int2_triggered = false; // un-trigger
 
     t.start(); // start timer and enter collection loop
@@ -103,7 +99,7 @@
 
         if(fxos_int2_triggered) {
             fxos_int2_triggered = false; // un-trigger
-            fxos.get_data(&accel_data, &magn_data);
+            fxos.get_data();
             print_reading(); // outpouring of data !!
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Thu Mar 02 17:12:56 2017 +0000
@@ -0,0 +1,1 @@
+https://github.com/armmbed/mbed-os/#5faf4b26c5954d15c7c1cccac6498e0c690ad101
--- a/mbed.bld	Wed May 28 17:32:41 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/0b3ab51c8877
\ No newline at end of file