drivers: sensors: mpu6050: add support for mpu9250
mpu9250 is a single package that contains both an mpu6050 6-axis motion sensor and an ak8963 magnetometer. The two parts have separate i2c addresses, yet despite the common mpu6050 component, it has a different value in the "WHOAMI" register -- 0x71 instead of 0x68. This adds the additional chip id value in order to enable the use of mpu9250. Signed-off-by: Adam Serbinski <adam@serbinski.com>
This commit is contained in:
parent
0ba9437938
commit
c70fc85909
2 changed files with 2 additions and 1 deletions
|
@ -161,7 +161,7 @@ int mpu6050_init(const struct device *dev)
|
|||
return -EIO;
|
||||
}
|
||||
|
||||
if (id != MPU6050_CHIP_ID) {
|
||||
if (id != MPU6050_CHIP_ID && id != MPU9250_CHIP_ID) {
|
||||
LOG_ERR("Invalid chip ID.");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#define MPU6050_REG_CHIP_ID 0x75
|
||||
#define MPU6050_CHIP_ID 0x68
|
||||
#define MPU9250_CHIP_ID 0x71
|
||||
|
||||
#define MPU6050_REG_GYRO_CFG 0x1B
|
||||
#define MPU6050_GYRO_FS_SHIFT 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue