DE_4_1 Project 1b 150203
Fork of MMA8451Q8b by
Diff: MMA8451Q.cpp
- Revision:
- 3:db7126dbd63f
- Parent:
- 1:d2630136d51e
diff -r a077541cbadc -r db7126dbd63f MMA8451Q.cpp --- a/MMA8451Q.cpp Thu Oct 11 14:28:23 2012 +0000 +++ b/MMA8451Q.cpp Fri Oct 12 11:30:34 2012 +0000 @@ -40,19 +40,19 @@ return who_am_i; } -int16_t MMA8451Q::getAccX() { - return getAccAxis(REG_OUT_X_MSB); +float MMA8451Q::getAccX() { + return (float(getAccAxis(REG_OUT_X_MSB))/4096.0); } -int16_t MMA8451Q::getAccY() { - return getAccAxis(REG_OUT_Y_MSB); +float MMA8451Q::getAccY() { + return (float(getAccAxis(REG_OUT_Y_MSB))/4096.0); } -int16_t MMA8451Q::getAccZ() { - return getAccAxis(REG_OUT_Z_MSB); +float MMA8451Q::getAccZ() { + return (float(getAccAxis(REG_OUT_Z_MSB))/4096.0); } -void MMA8451Q::getAccAllAxis(int16_t * res) { +void MMA8451Q::getAccAllAxis(float * res) { res[0] = getAccX(); res[1] = getAccY(); res[2] = getAccZ();