Modified to also return int16_t values.
Fork of MMA8451Q by
Revision 6:2511055a5dd2, committed 2013-06-07
- Comitter:
- jhestolano
- Date:
- Fri Jun 07 03:14:46 2013 +0000
- Parent:
- 5:2d14600116fc
- Commit message:
- Modified to return int16_t values instead of float type.
Changed in this revision
MMA8451Q.cpp | Show annotated file Show diff for this revision Revisions of this file |
MMA8451Q.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MMA8451Q.cpp Sun Mar 10 04:34:03 2013 +0000 +++ b/MMA8451Q.cpp Fri Jun 07 03:14:46 2013 +0000 @@ -72,6 +72,24 @@ res[2] = getAccZ(); } +int16_t MMA8451Q::getAccX_int() { + return getAccAxis(REG_OUT_X_MSB); +} + +int16_t MMA8451Q::getAccY_int() { + return getAccAxis(REG_OUT_Y_MSB); +} + +int16_t MMA8451Q::getAccZ_int() { + return getAccAxis(REG_OUT_Z_MSB); +} + +void MMA8451Q::getAccAllAxis_int(int16_t* res) { + res[0] = getAccX_int(); + res[1] = getAccY_int(); + res[2] = getAccZ_int(); +} + int16_t MMA8451Q::getAccAxis(uint8_t addr) { int16_t acc; uint8_t res[2];
--- a/MMA8451Q.h Sun Mar 10 04:34:03 2013 +0000 +++ b/MMA8451Q.h Fri Jun 07 03:14:46 2013 +0000 @@ -98,10 +98,19 @@ */ void getAccAllAxis(float * res); + /*******************************************************/ + + int16_t getAccX_int(); + int16_t getAccY_int(); + int16_t getAccZ_int(); + void getAccAllAxis_int(int16_t* res); + + /*******************************************************/ + + /** JK * Setup Double Tap detection - Example: #include "mbed.h"