diff --git a/make/source.mk b/make/source.mk index 267d577a0..55c754a20 100644 --- a/make/source.mk +++ b/make/source.mk @@ -195,22 +195,22 @@ SPEED_OPTIMISED_SRC := $(SPEED_OPTIMISED_SRC) \ common/filter.c \ common/maths.c \ common/typeconversion.c \ - drivers/accgyro/accgyro_adxl345.c \ - drivers/accgyro/accgyro_bma280.c \ drivers/accgyro/accgyro_fake.c \ - drivers/accgyro/accgyro_l3g4200d.c \ - drivers/accgyro/accgyro_l3gd20.c \ - drivers/accgyro/accgyro_lsm303dlhc.c \ - drivers/accgyro/accgyro_mma845x.c \ + drivers/accgyro/accgyro_mpu.c \ drivers/accgyro/accgyro_mpu3050.c \ drivers/accgyro/accgyro_mpu6050.c \ drivers/accgyro/accgyro_mpu6500.c \ - drivers/accgyro/accgyro_mpu.c \ drivers/accgyro/accgyro_spi_bmi160.c \ drivers/accgyro/accgyro_spi_icm20689.c \ drivers/accgyro/accgyro_spi_mpu6000.c \ drivers/accgyro/accgyro_spi_mpu6500.c \ drivers/accgyro/accgyro_spi_mpu9250.c \ + drivers/accgyro_legacy/accgyro_adxl345.c \ + drivers/accgyro_legacy/accgyro_bma280.c \ + drivers/accgyro_legacy/accgyro_l3g4200d.c \ + drivers/accgyro_legacy/accgyro_l3gd20.c \ + drivers/accgyro_legacy/accgyro_lsm303dlhc.c \ + drivers/accgyro_legacy/accgyro_mma845x.c \ drivers/adc.c \ drivers/buf_writer.c \ drivers/bus.c \ diff --git a/src/main/drivers/accgyro/accgyro_mpu.c b/src/main/drivers/accgyro/accgyro_mpu.c index a9030e1f1..9ae8fbfdd 100644 --- a/src/main/drivers/accgyro/accgyro_mpu.c +++ b/src/main/drivers/accgyro/accgyro_mpu.c @@ -54,7 +54,6 @@ #include "drivers/accgyro/accgyro_spi_mpu9250.h" #include "drivers/accgyro/accgyro_mpu.h" - mpuResetFnPtr mpuResetFn; #ifndef MPU_I2C_INSTANCE diff --git a/src/main/drivers/accgyro/accgyro_adxl345.c b/src/main/drivers/accgyro_legacy/accgyro_adxl345.c similarity index 99% rename from src/main/drivers/accgyro/accgyro_adxl345.c rename to src/main/drivers/accgyro_legacy/accgyro_adxl345.c index d0235253f..bcd97fc1f 100644 --- a/src/main/drivers/accgyro/accgyro_adxl345.c +++ b/src/main/drivers/accgyro_legacy/accgyro_adxl345.c @@ -26,7 +26,7 @@ #include "drivers/bus_i2c.h" #include "drivers/sensor.h" -#include "accgyro.h" +#include "drivers/accgyro/accgyro.h" #include "accgyro_adxl345.h" // ADXL345, Alternative address mode 0x53 diff --git a/src/main/drivers/accgyro/accgyro_adxl345.h b/src/main/drivers/accgyro_legacy/accgyro_adxl345.h similarity index 100% rename from src/main/drivers/accgyro/accgyro_adxl345.h rename to src/main/drivers/accgyro_legacy/accgyro_adxl345.h diff --git a/src/main/drivers/accgyro/accgyro_bma280.c b/src/main/drivers/accgyro_legacy/accgyro_bma280.c similarity index 98% rename from src/main/drivers/accgyro/accgyro_bma280.c rename to src/main/drivers/accgyro_legacy/accgyro_bma280.c index 13954341e..cccf3ecd6 100644 --- a/src/main/drivers/accgyro/accgyro_bma280.c +++ b/src/main/drivers/accgyro_legacy/accgyro_bma280.c @@ -26,7 +26,7 @@ #include "drivers/bus_i2c.h" #include "drivers/sensor.h" -#include "accgyro.h" +#include "drivers/accgyro/accgyro.h" #include "accgyro_bma280.h" // BMA280, default I2C address mode 0x18 diff --git a/src/main/drivers/accgyro/accgyro_bma280.h b/src/main/drivers/accgyro_legacy/accgyro_bma280.h similarity index 100% rename from src/main/drivers/accgyro/accgyro_bma280.h rename to src/main/drivers/accgyro_legacy/accgyro_bma280.h diff --git a/src/main/drivers/accgyro/accgyro_l3g4200d.c b/src/main/drivers/accgyro_legacy/accgyro_l3g4200d.c similarity index 98% rename from src/main/drivers/accgyro/accgyro_l3g4200d.c rename to src/main/drivers/accgyro_legacy/accgyro_l3g4200d.c index ee62da37e..161ad5511 100644 --- a/src/main/drivers/accgyro/accgyro_l3g4200d.c +++ b/src/main/drivers/accgyro_legacy/accgyro_l3g4200d.c @@ -25,7 +25,7 @@ #include -#include "accgyro.h" +#include "drivers/accgyro/accgyro.h" #include "accgyro_l3g4200d.h" #include "common/maths.h" diff --git a/src/main/drivers/accgyro/accgyro_l3g4200d.h b/src/main/drivers/accgyro_legacy/accgyro_l3g4200d.h similarity index 100% rename from src/main/drivers/accgyro/accgyro_l3g4200d.h rename to src/main/drivers/accgyro_legacy/accgyro_l3g4200d.h diff --git a/src/main/drivers/accgyro/accgyro_l3gd20.c b/src/main/drivers/accgyro_legacy/accgyro_l3gd20.c similarity index 99% rename from src/main/drivers/accgyro/accgyro_l3gd20.c rename to src/main/drivers/accgyro_legacy/accgyro_l3gd20.c index fdd836a47..d78944cb3 100644 --- a/src/main/drivers/accgyro/accgyro_l3gd20.c +++ b/src/main/drivers/accgyro_legacy/accgyro_l3gd20.c @@ -35,7 +35,7 @@ #include "drivers/bus_spi.h" #include "drivers/sensor.h" -#include "accgyro.h" +#include "drivers/accgyro/accgyro.h" #include "accgyro_l3gd20.h" #define READ_CMD ((uint8_t)0x80) diff --git a/src/main/drivers/accgyro/accgyro_l3gd20.h b/src/main/drivers/accgyro_legacy/accgyro_l3gd20.h similarity index 100% rename from src/main/drivers/accgyro/accgyro_l3gd20.h rename to src/main/drivers/accgyro_legacy/accgyro_l3gd20.h diff --git a/src/main/drivers/accgyro/accgyro_lsm303dlhc.c b/src/main/drivers/accgyro_legacy/accgyro_lsm303dlhc.c similarity index 99% rename from src/main/drivers/accgyro/accgyro_lsm303dlhc.c rename to src/main/drivers/accgyro_legacy/accgyro_lsm303dlhc.c index 6ad317dff..0c7504d19 100644 --- a/src/main/drivers/accgyro/accgyro_lsm303dlhc.c +++ b/src/main/drivers/accgyro_legacy/accgyro_lsm303dlhc.c @@ -35,7 +35,7 @@ #include "drivers/bus_i2c.h" #include "drivers/sensor.h" -#include "accgyro.h" +#include "drivers/accgyro/accgyro.h" #include "accgyro_lsm303dlhc.h" // Addresses (7 bit address format) diff --git a/src/main/drivers/accgyro/accgyro_lsm303dlhc.h b/src/main/drivers/accgyro_legacy/accgyro_lsm303dlhc.h similarity index 100% rename from src/main/drivers/accgyro/accgyro_lsm303dlhc.h rename to src/main/drivers/accgyro_legacy/accgyro_lsm303dlhc.h diff --git a/src/main/drivers/accgyro/accgyro_mma845x.c b/src/main/drivers/accgyro_legacy/accgyro_mma845x.c similarity index 99% rename from src/main/drivers/accgyro/accgyro_mma845x.c rename to src/main/drivers/accgyro_legacy/accgyro_mma845x.c index 35021beff..25c869b6c 100644 --- a/src/main/drivers/accgyro/accgyro_mma845x.c +++ b/src/main/drivers/accgyro_legacy/accgyro_mma845x.c @@ -27,7 +27,7 @@ #include "drivers/bus_i2c.h" #include "drivers/sensor.h" -#include "accgyro.h" +#include "drivers/accgyro/accgyro.h" #include "accgyro_mma845x.h" #ifndef MMA8452_I2C_INSTANCE diff --git a/src/main/drivers/accgyro/accgyro_mma845x.h b/src/main/drivers/accgyro_legacy/accgyro_mma845x.h similarity index 100% rename from src/main/drivers/accgyro/accgyro_mma845x.h rename to src/main/drivers/accgyro_legacy/accgyro_mma845x.h diff --git a/src/main/sensors/acceleration.c b/src/main/sensors/acceleration.c index 8cb2c8ae4..ea2e589bc 100644 --- a/src/main/sensors/acceleration.c +++ b/src/main/sensors/acceleration.c @@ -37,13 +37,7 @@ #include "pg/pg_ids.h" #include "drivers/accgyro/accgyro.h" -#include "drivers/accgyro/accgyro_adxl345.h" -#include "drivers/accgyro/accgyro_bma280.h" #include "drivers/accgyro/accgyro_fake.h" -#include "drivers/accgyro/accgyro_l3g4200d.h" -#include "drivers/accgyro/accgyro_l3gd20.h" -#include "drivers/accgyro/accgyro_lsm303dlhc.h" -#include "drivers/accgyro/accgyro_mma845x.h" #include "drivers/accgyro/accgyro_mpu.h" #include "drivers/accgyro/accgyro_mpu3050.h" #include "drivers/accgyro/accgyro_mpu6050.h" @@ -54,6 +48,23 @@ #include "drivers/accgyro/accgyro_spi_mpu6000.h" #include "drivers/accgyro/accgyro_spi_mpu6500.h" #include "drivers/accgyro/accgyro_spi_mpu9250.h" + +#ifdef USE_ACC_ADXL345 +#include "drivers/accgyro_legacy/accgyro_adxl345.h" +#endif + +#ifdef USE_ACC_BMA280 +#include "drivers/accgyro_legacy/accgyro_bma280.h" +#endif + +#ifdef USE_ACC_LSM303DLHC +#include "drivers/accgyro_legacy/accgyro_lsm303dlhc.h" +#endif + +#ifdef USE_ACC_MMA8452 +#include "drivers/accgyro_legacy/accgyro_mma845x.h" +#endif + #include "drivers/bus_spi.h" #include "fc/config.h" diff --git a/src/main/sensors/gyro.c b/src/main/sensors/gyro.c index 4b4a987ef..dcb466c3a 100644 --- a/src/main/sensors/gyro.c +++ b/src/main/sensors/gyro.c @@ -38,13 +38,7 @@ #include "pg/pg_ids.h" #include "drivers/accgyro/accgyro.h" -#include "drivers/accgyro/accgyro_adxl345.h" -#include "drivers/accgyro/accgyro_bma280.h" #include "drivers/accgyro/accgyro_fake.h" -#include "drivers/accgyro/accgyro_l3g4200d.h" -#include "drivers/accgyro/accgyro_l3gd20.h" -#include "drivers/accgyro/accgyro_lsm303dlhc.h" -#include "drivers/accgyro/accgyro_mma845x.h" #include "drivers/accgyro/accgyro_mpu.h" #include "drivers/accgyro/accgyro_mpu3050.h" #include "drivers/accgyro/accgyro_mpu6050.h" @@ -55,6 +49,15 @@ #include "drivers/accgyro/accgyro_spi_mpu6000.h" #include "drivers/accgyro/accgyro_spi_mpu6500.h" #include "drivers/accgyro/accgyro_spi_mpu9250.h" + +#ifdef USE_GYRO_L3G4200D +#include "drivers/accgyro_legacy/accgyro_l3g4200d.h" +#endif + +#ifdef USE_GYRO_L3GD20 +#include "drivers/accgyro_legacy/accgyro_l3gd20.h" +#endif + #include "drivers/accgyro/gyro_sync.h" #include "drivers/bus_spi.h" #include "drivers/io.h" diff --git a/src/main/target/CHEBUZZF3/target.h b/src/main/target/CHEBUZZF3/target.h index 2eda94105..c54d7d1d9 100644 --- a/src/main/target/CHEBUZZF3/target.h +++ b/src/main/target/CHEBUZZF3/target.h @@ -61,26 +61,26 @@ #define SDCARD_DMA_CHANNEL_TX DMA1_Channel5 #define USE_GYRO -#define USE_GYRO_L3GD20 +//#define USE_GYRO_L3GD20 #define USE_GYRO_MPU6050 -#define L3GD20_SPI SPI1 -#define L3GD20_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOE -#define L3GD20_CS_GPIO GPIOE -#define L3GD20_CS_PIN PE3 +//#define L3GD20_SPI SPI1 +//#define L3GD20_CS_GPIO_CLK_PERIPHERAL RCC_AHBPeriph_GPIOE +//#define L3GD20_CS_GPIO GPIOE +//#define L3GD20_CS_PIN PE3 -#define GYRO_L3GD20_ALIGN CW270_DEG +//#define GYRO_L3GD20_ALIGN CW270_DEG #define GYRO_MPU6050_ALIGN CW0_DEG #define USE_ACC #define USE_ACC_MPU6050 -#define USE_ACC_LSM303DLHC -#define LSM303DLHC_I2C I2C1 -#define LSM303DLHC_I2C_SCK_PIN PB6 -#define LSM303DLHC_I2C_SDA_PIN PB7 -#define LSM303DLHC_DRDY_PIN PE2 -#define LSM303DLHC_I2C_INT1_PIN PE4 -#define LSM303DLHC_I2C_INT2_PIN PE5 +//#define USE_ACC_LSM303DLHC +//#define LSM303DLHC_I2C I2C1 +//#define LSM303DLHC_I2C_SCK_PIN PB6 +//#define LSM303DLHC_I2C_SDA_PIN PB7 +//#define LSM303DLHC_DRDY_PIN PE2 +//#define LSM303DLHC_I2C_INT1_PIN PE4 +//#define LSM303DLHC_I2C_INT2_PIN PE5 #define ACC_MPU6050_ALIGN CW0_DEG diff --git a/src/main/target/CHEBUZZF3/target.mk b/src/main/target/CHEBUZZF3/target.mk index a21c11602..cdf3c6d26 100644 --- a/src/main/target/CHEBUZZF3/target.mk +++ b/src/main/target/CHEBUZZF3/target.mk @@ -2,16 +2,16 @@ F3_TARGETS += $(TARGET) FEATURES = VCP SDCARD TARGET_SRC = \ - drivers/accgyro/accgyro_l3gd20.c \ - drivers/accgyro/accgyro_lsm303dlhc.c \ drivers/compass/compass_hmc5883l.c \ - drivers/accgyro/accgyro_adxl345.c \ - drivers/accgyro/accgyro_bma280.c \ - drivers/accgyro/accgyro_mma845x.c \ drivers/accgyro/accgyro_mpu.c \ drivers/accgyro/accgyro_mpu3050.c \ drivers/accgyro/accgyro_mpu6050.c \ - drivers/accgyro/accgyro_l3g4200d.c \ + drivers/accgyro_legacy/accgyro_l3gd20.c \ + drivers/accgyro_legacy/accgyro_lsm303dlhc.c \ + drivers/accgyro_legacy/accgyro_adxl345.c \ + drivers/accgyro_legacy/accgyro_bma280.c \ + drivers/accgyro_legacy/accgyro_mma845x.c \ + drivers/accgyro_legacy/accgyro_l3g4200d.c \ drivers/barometer/barometer_ms5611.c \ drivers/barometer/barometer_bmp280.c \ drivers/compass/compass_ak8975.c diff --git a/src/main/target/NAZE/target.h b/src/main/target/NAZE/target.h index 28659bb36..d583e1d16 100644 --- a/src/main/target/NAZE/target.h +++ b/src/main/target/NAZE/target.h @@ -91,17 +91,17 @@ #define GYRO_MPU6500_ALIGN CW0_DEG #define USE_ACC -#define USE_ACC_ADXL345 -#define USE_ACC_BMA280 -#define USE_ACC_MMA8452 +//#define USE_ACC_ADXL345 +//#define USE_ACC_BMA280 +//#define USE_ACC_MMA8452 #define USE_ACC_MPU6050 #define USE_ACC_MPU6500 #define USE_ACC_SPI_MPU6500 -#define ACC_ADXL345_ALIGN CW270_DEG +//#define ACC_ADXL345_ALIGN CW270_DEG #define ACC_MPU6050_ALIGN CW0_DEG -#define ACC_MMA8452_ALIGN CW90_DEG -#define ACC_BMA280_ALIGN CW0_DEG +//#define ACC_MMA8452_ALIGN CW90_DEG +//#define ACC_BMA280_ALIGN CW0_DEG #define ACC_MPU6500_ALIGN CW0_DEG #define USE_BARO diff --git a/src/main/target/NAZE/target.mk b/src/main/target/NAZE/target.mk index 22c510c8c..bbe55d189 100644 --- a/src/main/target/NAZE/target.mk +++ b/src/main/target/NAZE/target.mk @@ -2,10 +2,10 @@ F1_TARGETS += $(TARGET) FEATURES = ONBOARDFLASH TARGET_SRC = \ - drivers/accgyro/accgyro_adxl345.c \ - drivers/accgyro/accgyro_bma280.c \ - drivers/accgyro/accgyro_l3g4200d.c \ - drivers/accgyro/accgyro_mma845x.c \ + drivers/accgyro_legacy/accgyro_adxl345.c \ + drivers/accgyro_legacy/accgyro_bma280.c \ + drivers/accgyro_legacy/accgyro_l3g4200d.c \ + drivers/accgyro_legacy/accgyro_mma845x.c \ drivers/accgyro/accgyro_mpu.c \ drivers/accgyro/accgyro_mpu3050.c \ drivers/accgyro/accgyro_mpu6050.c \ diff --git a/src/main/target/STM32F3DISCOVERY/target.h b/src/main/target/STM32F3DISCOVERY/target.h index 6b524c9ed..e8768ff1b 100644 --- a/src/main/target/STM32F3DISCOVERY/target.h +++ b/src/main/target/STM32F3DISCOVERY/target.h @@ -85,11 +85,11 @@ #define USE_GYRO #define USE_FAKE_GYRO -#define USE_GYRO_L3GD20 -#define L3GD20_SPI SPI1 -#define L3GD20_CS_PIN PE3 -#define GYRO_L3GD20_ALIGN CW270_DEG -#define USE_GYRO_L3G4200D +//#define USE_GYRO_L3GD20 +//#define L3GD20_SPI SPI1 +//#define L3GD20_CS_PIN PE3 +//#define GYRO_L3GD20_ALIGN CW270_DEG +//#define USE_GYRO_L3G4200D #define USE_GYRO_MPU3050 #define USE_GYRO_MPU6050 #define USE_GYRO_SPI_MPU6000 @@ -105,7 +105,7 @@ #define MPU9250_CS_PIN SPI2_NSS_PIN #define MPU9250_SPI_INSTANCE SPI2 // BMI160 gyro support -//#define USE_ACCGYRO_BMI160 +#define USE_ACCGYRO_BMI160 #ifdef USE_ACCGYRO_BMI160 #define BMI160_CS_PIN SPI2_NSS_PIN #define BMI160_SPI_INSTANCE SPI2 @@ -117,11 +117,11 @@ #define USE_ACC #define USE_FAKE_ACC -#define USE_ACC_ADXL345 -#define USE_ACC_BMA280 -#define USE_ACC_MMA8452 +//#define USE_ACC_ADXL345 +//#define USE_ACC_BMA280 +//#define USE_ACC_MMA8452 #define USE_ACC_MPU6050 -#define USE_ACC_LSM303DLHC +//#define USE_ACC_LSM303DLHC #define USE_ACC_MPU6000 #define USE_ACC_SPI_MPU6000 #define USE_ACC_MPU6500 diff --git a/src/main/target/STM32F3DISCOVERY/target.mk b/src/main/target/STM32F3DISCOVERY/target.mk index 7e589a45a..a455a47c8 100644 --- a/src/main/target/STM32F3DISCOVERY/target.mk +++ b/src/main/target/STM32F3DISCOVERY/target.mk @@ -2,15 +2,7 @@ F3_TARGETS += $(TARGET) FEATURES = VCP SDCARD ONBOARDFLASH TARGET_SRC = \ - drivers/accgyro/accgyro_adxl345.c \ - drivers/accgyro/accgyro_bma280.c \ - drivers/accgyro/accgyro_l3gd20.c \ - drivers/accgyro/accgyro_l3g4200d.c \ - drivers/accgyro/accgyro_lsm303dlhc.c \ - drivers/accgyro/accgyro_adxl345.c \ drivers/accgyro/accgyro_fake.c \ - drivers/accgyro/accgyro_bma280.c \ - drivers/accgyro/accgyro_mma845x.c \ drivers/accgyro/accgyro_mpu.c \ drivers/accgyro/accgyro_mpu3050.c \ drivers/accgyro/accgyro_mpu6050.c \ @@ -19,6 +11,14 @@ TARGET_SRC = \ drivers/accgyro/accgyro_spi_mpu6000.c \ drivers/accgyro/accgyro_spi_mpu6500.c \ drivers/accgyro/accgyro_spi_mpu9250.c \ + drivers/accgyro_legacy/accgyro_adxl345.c \ + drivers/accgyro_legacy/accgyro_bma280.c \ + drivers/accgyro_legacy/accgyro_l3gd20.c \ + drivers/accgyro_legacy/accgyro_l3g4200d.c \ + drivers/accgyro_legacy/accgyro_lsm303dlhc.c \ + drivers/accgyro_legacy/accgyro_adxl345.c \ + drivers/accgyro_legacy/accgyro_bma280.c \ + drivers/accgyro_legacy/accgyro_mma845x.c \ drivers/barometer/barometer_bmp085.c \ drivers/barometer/barometer_bmp280.c \ drivers/barometer/barometer_fake.c \