Maruchi's Accelerometer Repo

Fork of MMA8451Q by Emilio Monti

Files at this revision

API Documentation at this revision

Comitter:
maruchik
Date:
Mon Sep 22 07:11:51 2014 +0000
Parent:
4:c4d879a39775
Commit message:
update;

Changed in this revision

MMA8451Q.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/MMA8451Q.cpp	Fri Oct 12 11:35:07 2012 +0000
+++ b/MMA8451Q.cpp	Mon Sep 22 07:11:51 2014 +0000
@@ -62,10 +62,14 @@
     int16_t acc;
     uint8_t res[2];
     readRegs(addr, res, 2);
-
+//    if (addr == REG_OUT_Z_MSB) {
+//        printf("%d, %d\r\n", res[0], res[1]);
+//    }
     acc = (res[0] << 6) | (res[1] >> 2);
-    if (acc > UINT14_MAX/2)
+//    acc = acc/2;
+    if (acc > UINT14_MAX/2) {
         acc -= UINT14_MAX;
+    }
 
     return acc;
 }