Extended driver to be able to configure the accelerometer for tap detection, orientation detection, and data ready interrupts.
Dependents: FRDM-KL25Z_secret_knock bluetooth_robo01 robo_01
Fork of MMA8451Q by
Diff: MMA8451Q.h
- Revision:
- 5:c43505b5bc31
- Parent:
- 4:c4d879a39775
- Child:
- 8:018aea85c0db
diff -r c4d879a39775 -r c43505b5bc31 MMA8451Q.h --- a/MMA8451Q.h Fri Oct 12 11:35:07 2012 +0000 +++ b/MMA8451Q.h Wed Feb 27 03:58:53 2013 +0000 @@ -21,6 +21,12 @@ #include "mbed.h" +//just supporting Z taps in the code, not X, Y yet +#define MMA8451Q_ENABLE_DOUBLE_Z_TAP 0 +#define MMA8451Q_ENABLE_SINGLE_Z_TAP 1 +#define MMA8451Q_ENABLE_ORIENTATION 0 +#define MMA8451Q_ENABLE_DATAREADY 0 + /** * MMA8451Q accelerometer example * @@ -98,13 +104,19 @@ */ void getAccAllAxis(float * res); + uint8_t direction(void); + uint8_t tapSource(void); + uint8_t intSource(void); + private: I2C m_i2c; int m_addr; void readRegs(int addr, uint8_t * data, int len); void writeRegs(uint8_t * data, int len); int16_t getAccAxis(uint8_t addr); - + void writeRegister(uint8_t reg, uint8_t data); + uint8_t readRegister(uint8_t reg); + void modeStandby(void); + void modeActive(void); }; - #endif