I tried to make the changes by accessing the library but am getting errors now.

Fork of MMA8451Q by Emilio Monti

Files at this revision

API Documentation at this revision

Comitter:
menchacaeli
Date:
Wed Feb 22 03:07:58 2017 +0000
Parent:
5:96d33b2085e1
Commit message:
EMench_SSD645_HW6.1

Changed in this revision

MMA8451Q.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 96d33b2085e1 -r 522c62237b36 MMA8451Q.cpp
--- a/MMA8451Q.cpp	Mon Feb 20 04:23:52 2017 +0000
+++ b/MMA8451Q.cpp	Wed Feb 22 03:07:58 2017 +0000
@@ -52,6 +52,17 @@
     return (float(getAccAxis(REG_OUT_Z_MSB))/4096.0);
 }
 
+void MMA8451Q::setGLimit() {
+    uint8_t data[2] = {REG_CTRL_REG_1, 0x00};
+    writeRegs(data, 2); // put in standby
+    data[0] = XYZ_DATA_CFG;
+    data[1] = 0x02;
+    writeRegs(data, 2); // change g limit
+    data[0] = REG_CTRL_REG_1;
+    data[1] = 0x01;
+    writeRegs(data, 2); // make active
+}
+
 void MMA8451Q::getAccAllAxis(float * res) {
     res[0] = getAccX();
     res[1] = getAccY();