enhancing Multitech's library for some accelerometer

Fork of MMA845x by Multi-Hackers

Files at this revision

API Documentation at this revision

Comitter:
amateusz
Date:
Thu Jul 05 15:05:20 2018 +0000
Parent:
17:ff9a9933d123
Commit message:
FIX setting LowPower mode <- wrong bitmask was setting Fast mode instead, SIC

Changed in this revision

MMA845x.cpp Show annotated file Show diff for this revision Revisions of this file
MMA845x.h Show annotated file Show diff for this revision Revisions of this file
diff -r ff9a9933d123 -r 2316ca98e599 MMA845x.cpp
--- a/MMA845x.cpp	Thu Jul 05 01:24:33 2018 +0000
+++ b/MMA845x.cpp	Thu Jul 05 15:05:20 2018 +0000
@@ -108,7 +108,7 @@
     }
 
     result |= MMA845x::readRegister(CTRL_REG1, 1, datain);
-    dataout = (datain[0] & 0xB1) | resolution | lo_noise | data_rate;
+    dataout = (datain[0] & 0xC1) | resolution | lo_noise | data_rate; // 0b ‭0010 1010
     result |= MMA845x::writeRegister(CTRL_REG1, dataout);        // Set resolution, Low Noise mode, and data rate
 
     result |= MMA845x::readRegister(CTRL_REG2,1, datain);
diff -r ff9a9933d123 -r 2316ca98e599 MMA845x.h
--- a/MMA845x.h	Thu Jul 05 01:24:33 2018 +0000
+++ b/MMA845x.h	Thu Jul 05 15:05:20 2018 +0000
@@ -172,7 +172,7 @@
      */
     enum LOW_NOISE {
         LN_OFF = 0x00, /* Low Noise mode off */
-        LN_ON = 0x02  /* Low Noise mode on, 4g max readings */
+        LN_ON = 0x04  /* Low Noise mode on, 4g max readings */
     };
 
     /**