From e5e121e5f521d9181adca9644ecf331a9443f62d Mon Sep 17 00:00:00 2001 From: Martin Budden Date: Thu, 20 Jul 2017 20:30:48 +0100 Subject: [PATCH] Move whoami constants to accgyro_mpu.h --- src/main/drivers/accgyro/accgyro_mpu.c | 4 ---- src/main/drivers/accgyro/accgyro_mpu.h | 13 +++++++++++++ src/main/drivers/accgyro/accgyro_mpu6500.h | 7 ------- src/main/drivers/accgyro/accgyro_spi_icm20689.h | 1 - src/main/drivers/accgyro/accgyro_spi_mpu6000.h | 2 -- src/main/drivers/accgyro/accgyro_spi_mpu9250.h | 3 --- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/main/drivers/accgyro/accgyro_mpu.c b/src/main/drivers/accgyro/accgyro_mpu.c index a9d3f0631..d15d4aa79 100644 --- a/src/main/drivers/accgyro/accgyro_mpu.c +++ b/src/main/drivers/accgyro/accgyro_mpu.c @@ -61,10 +61,6 @@ mpuResetFnPtr mpuResetFn; #define MPU_ADDRESS 0x68 #endif -// WHO_AM_I register contents for MPU3050, 6050 and 6500 -#define MPU6500_WHO_AM_I_CONST (0x70) -#define MPUx0x0_WHO_AM_I_CONST (0x68) - #define MPU_INQUIRY_MASK 0x7E static void mpu6050FindRevision(gyroDev_t *gyro) diff --git a/src/main/drivers/accgyro/accgyro_mpu.h b/src/main/drivers/accgyro/accgyro_mpu.h index 1cd9f5500..04d27c084 100644 --- a/src/main/drivers/accgyro/accgyro_mpu.h +++ b/src/main/drivers/accgyro/accgyro_mpu.h @@ -31,6 +31,19 @@ #define MPU_RA_WHO_AM_I 0x75 #define MPU_RA_WHO_AM_I_LEGACY 0x00 + +#define MPUx0x0_WHO_AM_I_CONST (0x68) // MPU3050, 6000 and 6050 +#define MPU6000_WHO_AM_I_CONST (0x68) +#define MPU6500_WHO_AM_I_CONST (0x70) +#define MPU9250_WHO_AM_I_CONST (0x71) +#define MPU9255_WHO_AM_I_CONST (0x73) +#define ICM20601_WHO_AM_I_CONST (0xAC) +#define ICM20602_WHO_AM_I_CONST (0x12) +#define ICM20608G_WHO_AM_I_CONST (0xAF) +#define ICM20689_WHO_AM_I_CONST (0x98) + + + // RA = Register Address #define MPU_RA_XG_OFFS_TC 0x00 //[7] PWR_MODE, [6:1] XG_OFFS_TC, [0] OTP_BNK_VLD diff --git a/src/main/drivers/accgyro/accgyro_mpu6500.h b/src/main/drivers/accgyro/accgyro_mpu6500.h index a176543e5..bdc3ccd04 100644 --- a/src/main/drivers/accgyro/accgyro_mpu6500.h +++ b/src/main/drivers/accgyro/accgyro_mpu6500.h @@ -17,13 +17,6 @@ #pragma once -#define MPU6500_WHO_AM_I_CONST (0x70) -#define MPU9250_WHO_AM_I_CONST (0x71) -#define MPU9255_WHO_AM_I_CONST (0x73) -#define ICM20601_WHO_AM_I_CONST (0xAC) -#define ICM20602_WHO_AM_I_CONST (0x12) -#define ICM20608G_WHO_AM_I_CONST (0xAF) - #define MPU6500_BIT_RESET (0x80) // Register 0x37/55 - INT_PIN_CFG / Pin Bypass Enable Configuration diff --git a/src/main/drivers/accgyro/accgyro_spi_icm20689.h b/src/main/drivers/accgyro/accgyro_spi_icm20689.h index 57cc827f8..cf10e7767 100644 --- a/src/main/drivers/accgyro/accgyro_spi_icm20689.h +++ b/src/main/drivers/accgyro/accgyro_spi_icm20689.h @@ -18,7 +18,6 @@ #include "drivers/bus.h" -#define ICM20689_WHO_AM_I_CONST (0x98) #define ICM20689_BIT_RESET (0x80) bool icm20689AccDetect(accDev_t *acc); diff --git a/src/main/drivers/accgyro/accgyro_spi_mpu6000.h b/src/main/drivers/accgyro/accgyro_spi_mpu6000.h index 7682a2872..def32573c 100644 --- a/src/main/drivers/accgyro/accgyro_spi_mpu6000.h +++ b/src/main/drivers/accgyro/accgyro_spi_mpu6000.h @@ -12,8 +12,6 @@ #define GYRO_SCALE_FACTOR 0.00053292f // (4/131) * pi/180 (32.75 LSB = 1 DPS) -#define MPU6000_WHO_AM_I_CONST (0x68) - // RF = Register Flag #define MPU_RF_DATA_RDY_EN (1 << 0) diff --git a/src/main/drivers/accgyro/accgyro_spi_mpu9250.h b/src/main/drivers/accgyro/accgyro_spi_mpu9250.h index e7d3958c6..8ddc120cc 100644 --- a/src/main/drivers/accgyro/accgyro_spi_mpu9250.h +++ b/src/main/drivers/accgyro/accgyro_spi_mpu9250.h @@ -18,9 +18,6 @@ #define GYRO_SCALE_FACTOR 0.00053292f // (4/131) * pi/180 (32.75 LSB = 1 DPS) -#define MPU9250_WHO_AM_I_CONST (0x71) -#define MPU9255_WHO_AM_I_CONST (0x73) - #define MPU9250_BIT_RESET (0x80) // RF = Register Flag