这是我的mpu9150代码
int main(void)
{
my_putstr("\nhello\n");
my_put_int(i2c_master_write_simple(MPU9150_ADDRESS,MPU9150_SLEEP_CONFIG,0));
my_putchar('\n');
my_put_int(i2c_master_write_simple(MPU9150_ADDRESS,MPU9150_USER_CONTROL,0x00));//disable i2c master
my_putchar('\n');
my_put_int(i2c_master_write_simple(MPU9150_ADDRESS,MPU9150_USER_CONTROL,0x02));//enable i2c aux
my_putchar('\n');
my_put_int(i2c_master_write_simple(0x0F,MPU9150_MAGNO_CNTRL,0x01));//single
my_putchar('\n');
my_put_int(i2c_master_read_simple_1Byte(0x0F,0));//single
//IntcLowLevelExample(INTC_BASEADDR);
my_put_int(i2c_master_read_simple_1Byte(i,0));//single
delay_ms(10);
while(1){
}
return 0;
}
如您所见。首先我打开mpu9150 然后禁用i2c master 然后启用旁路模式 然后我写指南针 但是指南针甚至不会向我发送任何东西给我 我该怎么办 ? 我的i2c库已经过全面测试,还可以