Added code to manage Orientation, FreeFall and Motion Detection. Data is also available via IRQ.
Dependents: Test_FRDM_MMA8451Q AccelTest FRDM-KL46-Template KL25Z_Demo ... more
Fork of MMA8451Q by
Diff: MMA8451Q.h
- Revision:
- 9:2aa9b1668d14
- Parent:
- 8:7e6013f11b10
- Child:
- 10:fa532bf396fb
--- a/MMA8451Q.h Tue May 28 17:18:30 2013 +0000 +++ b/MMA8451Q.h Tue May 28 20:19:38 2013 +0000 @@ -86,6 +86,15 @@ #define cLAPO_PD 1 // Portrait Down: Equipment standing vertically in the inverted orientation #define cLAPO_LR 2 // Landscape Right: Equipment is in landscape mode to the right #define cLAPO_LL 3 // Landscape Left: Equipment is in landscape mode to the left. +// System Output Data Rate for acceleration samples +#define cODR_800HZ 0 // 1.25 ms +#define cODR_400HZ 1 // 2.5 ms +#define cODR_200HZ 2 // 5 ms +#define cODR_100HZ 3 // 10 ms +#define cODR_50HZ 4 // 20 ms +#define cODR_12_5HZ 5 // 80 ms +#define cODR_6_25HZ 6 // 160 ms +#define cODR_1_56HZ 7 // 640 ms class MMA8451Q { @@ -194,6 +203,14 @@ unsigned char GetOrientationState( void); /** + * Configure the Accelerometer to generate a IRQ when a new sample is available + * + * @param pointer to the user function to execute after IRQ assertion + * @return none + */ + void DataReady( void(*fptr)(void), unsigned char ODR); + + /** * Soft Reset * @param none * @return none @@ -211,6 +228,7 @@ void Fall_IRQ( void); void Motion_IRQ( void); void Orientation_IRQ( void); + void DataReady_IRQ( void); // unsigned char OrientationState; unsigned char OrientationStateUpdated;