Modified to also return int16_t values.
Fork of MMA8451Q by
Diff: MMA8451Q.cpp
- Revision:
- 6:2511055a5dd2
- Parent:
- 5:2d14600116fc
diff -r 2d14600116fc -r 2511055a5dd2 MMA8451Q.cpp --- 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];