a
Fork of FRDM_MMA8451Q by
Diff: MMA8451Q.h
- Revision:
- 6:c52175d13e0a
- Parent:
- 5:695063448f2a
- Child:
- 7:ba0016258d5d
diff -r 695063448f2a -r c52175d13e0a MMA8451Q.h --- a/MMA8451Q.h Tue May 28 04:39:42 2013 +0000 +++ b/MMA8451Q.h Tue May 28 07:29:58 2013 +0000 @@ -46,6 +46,42 @@ * } * @endcode */ + +// Z-Lock Threshold Angles +#define Z_LOCKOUT_14 0 // Angle to 14° +#define Z_LOCKOUT_18 1 // Angle to 18° +#define Z_LOCKOUT_21 2 // Angle to 21° +#define Z_LOCKOUT_25 3 // Angle to 25° +#define Z_LOCKOUT_29 4 // Angle to 29° +#define Z_LOCKOUT_33 5 // Angle to 33° +#define Z_LOCKOUT_37 6 // Angle to 37° +#define Z_LOCKOUT_42 7 // Angle to 42° +// Back/Front Orientation Definition +#define Z_BKFR_80 0 // Back and Front trip angle +#define Z_BKFR_75 1 // Back and Front trip angle +#define Z_BKFR_70 2 // Back and Front trip angle +#define Z_BKFR_65 3 // Back and Front trip angle +// Threshold Angle Thresholds Lookup Table +#define PL_THS_15 0x07 // Set Threshold to 15° +#define PL_THS_20 0x09 // Set Threshold to 20° +#define PL_THS_30 0x0C // Set Threshold to 30° +#define PL_THS_35 0x0D // Set Threshold to 35° +#define PL_THS_40 0x0F // Set Threshold to 40° +#define PL_THS_45 0x10 // Set Threshold to 45° +#define PL_THS_55 0x13 // Set Threshold to 55° +#define PL_THS_60 0x14 // Set Threshold to 60° +#define PL_THS_70 0x17 // Set Threshold to 70° +#define PL_THS_75 0x19 // Set Threshold to 75° +// Trip Angles with Hysteresis for 45° Angle +#define PL_HYS_0 0x00 // Set Hysteresis to ±0° +#define PL_HYS_4 0x01 // Set Hysteresis to ±4° +#define PL_HYS_7 0x02 // Set Hysteresis to ±7° +#define PL_HYS_11 0x03 // Set Hysteresis to ±11° +#define PL_HYS_14 0x04 // Set Hysteresis to ±14° +#define PL_HYS_17 0x05 // Set Hysteresis to ±17° +#define PL_HYS_21 0x06 // Set Hysteresis to ±21° +#define PL_HYS_24 0x07 // Set Hysteresis to ±24° + class MMA8451Q { public: @@ -100,6 +136,8 @@ void FreFallDetection( void(*fptr)(void)); void MotionDetection( void(*fptr)(void)); + void OrientationDetect( unsigned int Z_LockOut, unsigned int Z_BkFr, unsigned int PL_Thsld, unsigned int PL_Hyst); + void OrientationDetect( void); private: I2C m_i2c;