Fork of FXOS8700CQ, with modifications to setup and some additions to class on the way to make it more application configurable... also re-did 14 bit accelerometer data transform.

Dependents:   fxos8700cq_JH_explore

Fork of FXOS8700CQ by Thomas Murphy

Files at this revision

API Documentation at this revision

Comitter:
julianhigginson
Date:
Fri Feb 05 01:57:41 2016 +0000
Parent:
6:f79ab691a47b
Commit message:
adjusted 14 bit 2s compliment transform (14 bits are Left justified so need to add 4 (1<<2) after bitwise inversion)

Changed in this revision

FXOS8700CQ.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r f79ab691a47b -r e2b87c7f6c8d FXOS8700CQ.cpp
--- a/FXOS8700CQ.cpp	Fri Feb 05 00:30:30 2016 +0000
+++ b/FXOS8700CQ.cpp	Fri Feb 05 01:57:41 2016 +0000
@@ -70,13 +70,13 @@
 
     //deal with -ve representations
     if (accel_data->x && 0x8000) { //MSB is ONE
-        accel_data->x = -(~(accel_data->x)+1);
+        accel_data->x = -(~(accel_data->x)+4);
     }
     if (accel_data->y && 0x8000) { //MSB is ONE
-        accel_data->y = -(~(accel_data->y)+1);
+        accel_data->y = -(~(accel_data->y)+4);
     }
     if (accel_data->z && 0x8000) { //MSB is ONE
-        accel_data->z = -(~(accel_data->z)+1);
+        accel_data->z = -(~(accel_data->z)+4);
     }
     
     // scale back down to actual 14 bit number