调试mpu6050模块有一段时间了,各种问题也都慢慢解决了(后续会写一个总结文档),昨天终于能获取到模块的yaw、pitch、roll三个参数了;但是现在又遇到一个新问题,程序进不了中断,仔细看了源程序,发现 set_int_enable()中控制中断的寄存器 INTERRUPT ENABLE(0x38),使能DMP时 设置值为0x02
可是0x38寄存器的第一位没有意义啊 为什么会配置成0x02??求大神解答
static int set_int_enable(unsigned char enable)
{
unsigned char tmp;
if (st.chip_cfg.dmp_on)
{
if (enable)
tmp = BIT_DMP_INT_EN;
else
tmp = 0x00;
if (i2c_write(st.hw->addr, st.reg->int_enable, 1, &tmp))
return -1;
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;
}
这是中断使能源程序,若要开中断,需调用set_int_enable(1),但是宏定义BIT_DMP_INT_EN=0x02,而寄存器INTERRUPT ENABLE(0x38)=0x02是没意义的 仔细看下图: 求解求解??
|