enhancing Multitech's library for some accelerometer
Fork of MMA845x by
Diff: MMA845x.h
- Revision:
- 12:92294b5ca1c1
- Parent:
- 11:8dc4f77b2f53
- Child:
- 13:77a8994b3bb2
--- a/MMA845x.h Mon Jul 02 22:52:24 2018 +0000 +++ b/MMA845x.h Mon Jul 02 23:55:31 2018 +0000 @@ -220,9 +220,10 @@ /** * @enum INTERRUPT_CFG_AND_ENABLE - * @brief used to enable interrupts for corresponding functions + * @brief used to {configure, enable, detect source of} interrupts for corresponding functions + * (INT_FIFO used only in MMA8451) */ - enum INTERRUPT_CFG_AND_ENABLE { + enum INTERRUPT_CFG_EN_SOURCE { INT_DRDY = 0x00, // 0x20 missing, INT_FF_MT = 0x04, @@ -231,16 +232,16 @@ INT_TRANS = 0x20, INT_FIFO = 0x40, INT_ASLP = 0x80 - } - + }; /** * @enum INTERRUPT_PIN * @brief chooses interrupt pin used to signal interrupt condition */ enum INTERRUPT_PIN { INT1 = 1, - INT2 = 0 - } + INT2 = 0, + INT_NONE = 2 + }; /** * @enum REGISTER @@ -328,10 +329,12 @@ uint8_t enablePulseDetect(void) const; /** Enable Orientation mode and interrupt handler + * @debounce_steps - how long a state has to last to trigger orientation change. step varies from 1.25 to 160 ms. + * @pin - an interrupt has to be attached to some pin, even this pin is left floating * @return status of command - * TODO - need to implement function + * TODO - add trip angles change (only when MMA8451) */ - uint8_t enableOrientationDetect(void) const; + uint8_t enableOrientationDetect(uint8_t debounce_steps, INTERRUPT_PIN pin = INT_NONE) const; /** Enable Transient detect mode and interrupt handler * @return status of command