|
|
发表于 2014-3-18 16:44:25
|
显示全部楼层
目前在调试MPU6050的DMP时,发觉得INT没有中断信号,程序已设置中断能使了。但INT脚仍然没有中断,不知为什么?
set_int_enable(1);
代码如下:
/**
* @brief Enable/disable data ready interrupt.
* If the DMP is on, the DMP interrupt is enabled. Otherwise, the data ready
* interrupt is used.
* @param[in] enable 1 to enable interrupt.
* @return 0 if successful.
*/
static int set_int_enable(unsigned char enable)
{
unsigned char tmp;
short status;
if (st.chip_cfg.dmp_on) {
if (enable)
tmp =BIT_DMP_INT_EN;// ;//gason BIT_FIFO_OVERFLOW
else
tmp = 0x00;
if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
return -1;
// mpu_set_int_latched(1);
// mpu_set_int_level(1);
//mpu_get_int_status(&status); //gason
st.chip_cfg.int_enable = tmp;
} else {
if (!st.chip_cfg.sensors)
return -1;
if (enable && st.chip_cfg.int_enable)
return 0;
if (enable)
tmp = BIT_DATA_RDY_EN;
else
tmp = 0x00;
if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
return -1;
st.chip_cfg.int_enable = tmp;
}
return 0;
}
|
|