I have been having great success so far using this MMA8652 part in my project. My remaining issue is the following ... all works well and interrupts fire as expected. However when I move my device in one or two orientations, and hold it still ... the Motion interrupt fires continuously, and I can't clear it using all the Read registers mentioned, only after I tilt the device back to a different orientation does it stop. INT_SOURCE register will always read 0x04 when in the orientation that indicating that the Motion interrupt has triggered, and nothing can clear it till I rotate the device in a different orientation.
Background and config:
I am only using the Portrait/Landscape interrupt mode and Motion interrupt mode. I am routing the PL Interrupt to INT1 and the motion interrupt to INT2.
Here are the commands in the order I send them, with the part in standby mode....
accel.write(MMA8652_CTRL_REG1, 0xF8);
accel.write(MMA8652_CTRL_REG2, 0x03);
accel.write(MMA8652_CTRL_REG3, 0x28);
accel.write(MMA8652_CTRL_REG4, 0x14);
accel.write(MMA8652_CTRL_REG5, 0x10);
accel.write(MMA8652_PL_CFG, 0x40);
accel.write(MMA8652_PL_COUNT, 0x1);
accel.write(MMA8652_FF_MT_CFG, 0x78);
accel.write(MMA8652_FF_MT_THS, 0x92);
accel.write(MMA8652_FF_MT_COUNT, 0x03);
Again all works with the PL interrupts as I can display returned position each time I get an interrupt, and the motion interrupt will trigger if I move the device fast as expected, but when I hold the device on it's left side, the motion interrupt continuously fires, turning it to the Right side all is well, or on it's belly, back all is well.
Thanks for any help or pointing out my mistake, as I am sure I am making one. :-)
Scott