Hey all,
I am trying to use the tap detection feature of MPU9150. Here is the code which I used.
dmp_enable_feature(DMP_FEATURE_TAP);
dmp_register_tap_cb(tap_cb);The callback function is not being called.
Also, In my research i found this function:
static int decode_gesture(unsigned char *gesture)
{
unsigned char tap, android_orient;
android_orient = gesture[3] & 0xC0;
tap = 0x3F & gesture[3];
if (gesture[1] & INT_SRC_TAP) {
.
.
.
}Here I printed value of gesture[1], which remains 0 while stationary, then goes to 4 and is steady there. No more changes.
Can anyone tell me what I am missing? Is there any interrupt to be enabled?? Or any condition to be matched??
Thank you in advance.
Re: Re: Problem in Tap Detection and its Callback with MPU9150
mpu_set_dmp_state(1) is what turns ON dmp, enabling the feature is not enough but is needed. Check the following comments on the motionFit example code. /* To initialize the DMP:
* 1. Call dmp_load_motion_driver_firmware(). This pushes the DMP image in
* inv_mpu_dmp_motion_driver.h into the MPU memory.
* 2. Push the gyro and accel orientation matrix to the DMP.
* 3. Register gesture callbacks. Don't worry, these callbacks won't be
* executed unless the corresponding feature is enabled.
* 4. Call dmp_enable_feature(mask) to enable different features.
* 5. Call dmp_set_interrupt_mode(mode) to select between continuous
* and event-only interrupts.
* 6. Call dmp_set_fifo_rate(freq) to select a DMP output rate.
* 7. Call any feature-specific control functions.
*
* WARNING: Any DMP related functions should only be called when the MPU is
* awake (call mpu_set_sensors() with a non-zero value).
*
* To enable the DMP, just call mpu_set_dmp_state(1). This function can
* be called repeatedly to enable and disable the DMP at runtime.
*
* The following is a short summary of the features supported in the DMP
* image provided in inv_mpu_dmp_motion_driver.c:
* DMP_FEATURE_LP_QUAT: Generate a gyro-only quaternion on the DMP at
* 200Hz. Integrating the gyro data at higher rates reduces numerical
* errors (compared to integration on the MCU at a lower sampling rate).
* DMP_FEATURE_TAP: Detect taps along the X, Y, and Z axes.
* DMP_FEATURE_ORIENT: Notify the application when the device orientation
* has changed.