mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 12:03:34 +08:00
mpu6000: check WHOAMI register
this prevents a mpu9250 being seen as a mpu6000
This commit is contained in:
committed by
Lorenz Meier
parent
0e6cdecfad
commit
f77620c3f4
@@ -147,6 +147,8 @@
|
|||||||
#define BIT_I2C_IF_DIS 0x10
|
#define BIT_I2C_IF_DIS 0x10
|
||||||
#define BIT_INT_STATUS_DATA 0x01
|
#define BIT_INT_STATUS_DATA 0x01
|
||||||
|
|
||||||
|
#define MPU_WHOAMI_6000 0x68
|
||||||
|
|
||||||
// Product ID Description for MPU6000
|
// Product ID Description for MPU6000
|
||||||
// high 4 bits low 4 bits
|
// high 4 bits low 4 bits
|
||||||
// Product Name Product Revision
|
// Product Name Product Revision
|
||||||
@@ -755,6 +757,13 @@ int MPU6000::reset()
|
|||||||
int
|
int
|
||||||
MPU6000::probe()
|
MPU6000::probe()
|
||||||
{
|
{
|
||||||
|
uint8_t whoami;
|
||||||
|
whoami = read_reg(MPUREG_WHOAMI);
|
||||||
|
if (whoami != MPU_WHOAMI_6000) {
|
||||||
|
DEVICE_DEBUG("unexpected WHOAMI 0x%02x", whoami);
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* look for a product ID we recognise */
|
/* look for a product ID we recognise */
|
||||||
_product = read_reg(MPUREG_PRODUCT_ID);
|
_product = read_reg(MPUREG_PRODUCT_ID);
|
||||||
|
|||||||
Reference in New Issue
Block a user