AP_InertialSensor: support ICM-20689 IMU

like the 20789, but without the baro
This commit is contained in:
Andrew Tridgell 2018-04-10 21:08:52 +10:00
parent 68da3a123c
commit ca9d1a55fe
4 changed files with 16 additions and 2 deletions

View File

@ -102,7 +102,8 @@ public:
DEVTYPE_GYR_MPU9250 = 0x24,
DEVTYPE_GYR_I3G4250D = 0x25,
DEVTYPE_GYR_LSM9DS1 = 0x26,
DEVTYPE_INS_ICM20789 = 0x27
DEVTYPE_INS_ICM20789 = 0x27,
DEVTYPE_INS_ICM20689 = 0x28,
};
protected:

View File

@ -215,6 +215,10 @@ void AP_InertialSensor_Invensense::start()
gdev = DEVTYPE_INS_ICM20789;
adev = DEVTYPE_INS_ICM20789;
break;
case Invensense_ICM20689:
gdev = DEVTYPE_INS_ICM20689;
adev = DEVTYPE_INS_ICM20689;
break;
}
/*
@ -243,6 +247,10 @@ void AP_InertialSensor_Invensense::start()
temp_zero = 25;
temp_sensitivity = 0.003;
break;
case Invensense_ICM20689:
temp_zero = 25;
temp_sensitivity = 0.003;
break;
}
_gyro_instance = _imu.register_gyro(1000, _dev->get_bus_id_devtype(gdev));
@ -693,7 +701,7 @@ void AP_InertialSensor_Invensense::_set_filter_register(void)
// setup for 4kHz accels
_register_write(ICMREG_ACCEL_CONFIG2, ICM_ACC_FCHOICE_B, true);
} else {
uint8_t fifo_size = (_mpu_type == Invensense_ICM20789) ? 1:0;
uint8_t fifo_size = (_mpu_type == Invensense_ICM20789 || _mpu_type == Invensense_ICM20689) ? 1:0;
_register_write(ICMREG_ACCEL_CONFIG2, ICM_ACC_DLPF_CFG_218HZ | (fifo_size<<6), true);
}
}
@ -726,6 +734,9 @@ bool AP_InertialSensor_Invensense::_check_whoami(void)
case MPU_WHOAMI_ICM20789_R1:
_mpu_type = Invensense_ICM20789;
return true;
case MPU_WHOAMI_ICM20689:
_mpu_type = Invensense_ICM20689;
return true;
}
// not a value WHOAMI result
return false;

View File

@ -63,6 +63,7 @@ public:
Invensense_ICM20608,
Invensense_ICM20602,
Invensense_ICM20789,
Invensense_ICM20689,
};
private:

View File

@ -174,6 +174,7 @@
#define MPU_WHOAMI_MPU9255 0x73
#define MPU_WHOAMI_ICM20789 0x03
#define MPU_WHOAMI_ICM20789_R1 0x02
#define MPU_WHOAMI_ICM20689 0x98
#define BIT_READ_FLAG 0x80
#define BIT_I2C_SLVX_EN 0x80