Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: KL46z_single_tap_empty_DE_4_1_PROJECT1B_wInterrupts KL46z_single_tap_empty_DE_4_1_PROJECT1D KL46z_single_tap_generic RAHUL_KL46z_single_tap_generic_copy ... more
Fork of MMA8451Q8a 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();
