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: MMA8451Q8.cpp
- Revision:
- 8:993bb9e96a4b
- Parent:
- 7:ed7e11d269f8
- Child:
- 10:c875155f829d
--- a/MMA8451Q8.cpp Wed Jan 28 21:39:04 2015 +0000
+++ b/MMA8451Q8.cpp Tue Feb 03 17:59:00 2015 +0000
@@ -26,6 +26,9 @@
#define REG_OUT_Y_MSB 0x03
#define REG_OUT_Z_MSB 0x05
#define XYZ_DATA_CFG 0x0E
+// adding tap config register adderesses
+#define REG_PULSE_SRC 0x22
+#define REG_PULSE_CFG 0x21
#define UINT14_MAX 16383
@@ -64,7 +67,21 @@
data[DATA_INDEX] = 0x01;
writeRegs(data, 2); // make active
}
-
+// add Puse configuratioin register access
+// Also add function prototype to .h file
+void MMA8451Q::setPulseConfiguration(uint8_t latch,uint8_t axisSet) {
+ uint8_t configBits;
+ uint8_t data[NUM_DATA] = {REG_CTRL_REG_1, 0x00}; // put in standby mode
+// set up configuration bits.
+ configBits = latch | axisSet;
+ writeRegs(data, NUM_DATA); // put in standby
+ data[ADDRESS_INDEX ] = REG_PULSE_CFG;
+ data[DATA_INDEX] = configBits;
+ writeRegs(data, NUM_DATA);
+ data[ADDRESS_INDEX ] = REG_CTRL_REG_1; // put back in active mode
+ data[DATA_INDEX] = 0x01;
+ writeRegs(data, 2); // make active
+}
float MMA8451Q::getAccX() {
return (float(getAccAxis(REG_OUT_X_MSB))/gScaling[gChosen]);
}
