Update Baro driver for generic target

This commit is contained in:
MJ666 2018-10-02 23:47:04 +02:00
parent 60118da63f
commit e5f330fbf1
18 changed files with 46 additions and 58 deletions

View File

@ -37,7 +37,3 @@ typedef struct baroDev_s {
baroOpFuncPtr get_up; baroOpFuncPtr get_up;
baroCalculateFuncPtr calculate; baroCalculateFuncPtr calculate;
} baroDev_t; } baroDev_t;
#ifndef BARO_I2C_INSTANCE
#define BARO_I2C_INSTANCE I2C_DEVICE
#endif

View File

@ -95,28 +95,10 @@ void pgResetFn_barometerConfig(barometerConfig_t *barometerConfig)
#endif #endif
#endif #endif
#if defined(DEFAULT_BARO_SPI_BMP280) #if defined(DEFAULT_BARO_SPI_BMP280) || defined(DEFAULT_BARO_SPI_MS5611) || defined(DEFAULT_BARO_SPI_QMP6988) || defined(DEFAULT_BARO_SPI_LPS)
barometerConfig->baro_bustype = BUSTYPE_SPI; barometerConfig->baro_bustype = BUSTYPE_SPI;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(BMP280_SPI_INSTANCE)); barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(BARO_SPI_INSTANCE));
barometerConfig->baro_spi_csn = IO_TAG(BMP280_CS_PIN); barometerConfig->baro_spi_csn = IO_TAG(BARO_CS_PIN);
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID);
barometerConfig->baro_i2c_address = 0;
#elif defined(DEFAULT_BARO_SPI_MS5611)
barometerConfig->baro_bustype = BUSTYPE_SPI;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(MS5611_SPI_INSTANCE));
barometerConfig->baro_spi_csn = IO_TAG(MS5611_CS_PIN);
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID);
barometerConfig->baro_i2c_address = 0;
#elif defined(DEFAULT_BARO_SPI_QMP6988)
barometerConfig->baro_bustype = BUSTYPE_SPI;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(QMP6988_SPI_INSTANCE));
barometerConfig->baro_spi_csn = IO_TAG(QMP6988_CS_PIN);
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID);
barometerConfig->baro_i2c_address = 0;
#elif defined(DEFAULT_BARO_SPI_LPS)
barometerConfig->baro_bustype = BUSTYPE_SPI;
barometerConfig->baro_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(LPS_SPI_INSTANCE));
barometerConfig->baro_spi_csn = IO_TAG(LPS_CS_PIN);
barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID); barometerConfig->baro_i2c_device = I2C_DEV_TO_CFG(I2CINVALID);
barometerConfig->baro_i2c_address = 0; barometerConfig->baro_i2c_address = 0;
#elif defined(DEFAULT_BARO_MS5611) || defined(DEFAULT_BARO_BMP280) || defined(DEFAULT_BARO_BMP085)||defined(DEFAULT_BARO_QMP6988) #elif defined(DEFAULT_BARO_MS5611) || defined(DEFAULT_BARO_BMP280) || defined(DEFAULT_BARO_BMP085)||defined(DEFAULT_BARO_QMP6988)

View File

@ -72,8 +72,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define DEFAULT_BARO_SPI_BMP280 #define DEFAULT_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI2 #define BARO_SPI_INSTANCE SPI2
#define BMP280_CS_PIN PB9 #define BARO_CS_PIN PB9
#define USE_MAX7456 #define USE_MAX7456
#define MAX7456_SPI_INSTANCE SPI3 #define MAX7456_SPI_INSTANCE SPI3

View File

@ -54,8 +54,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI2 #define BARO_SPI_INSTANCE SPI2
#define BMP280_CS_PIN PB5 #define BARO_CS_PIN PB5
#define USE_UART1 #define USE_UART1
#define USE_UART2 #define USE_UART2

View File

@ -75,11 +75,8 @@
#define USE_BARO_BMP280 #define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define MS5611_CS_PIN SPI3_NSS_PIN #define BARO_CS_PIN SPI3_NSS_PIN
#define MS5611_SPI_INSTANCE SPI3 #define BARO_SPI_INSTANCE SPI3
#define BMP280_CS_PIN SPI3_NSS_PIN
#define BMP280_SPI_INSTANCE SPI3
#define USE_SDCARD #define USE_SDCARD
#define USE_SDCARD_SPI #define USE_SDCARD_SPI

View File

@ -151,8 +151,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_BMP280 #define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI3 #define BARO_SPI_INSTANCE SPI3
#define BMP280_CS_PIN SPI3_NSS_PIN #define BARO_CS_PIN SPI3_NSS_PIN
#endif #endif
/* Serial ports etc. /* Serial ports etc.

View File

@ -61,8 +61,8 @@
#define GYRO_1_SPI_INSTANCE SPI1 #define GYRO_1_SPI_INSTANCE SPI1
// tqfp48 pin 25 // tqfp48 pin 25
#define BMP280_CS_PIN SPI2_NSS_PIN #define BARO_CS_PIN SPI2_NSS_PIN
#define BMP280_SPI_INSTANCE SPI2 #define BARO_SPI_INSTANCE SPI2
#define USE_FLASHFS #define USE_FLASHFS
#define USE_FLASH_M25P16 #define USE_FLASH_M25P16

View File

@ -51,8 +51,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_BMP280 #define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI3 #define BARO_SPI_INSTANCE SPI3
#define BMP280_CS_PIN PB3 #define BARO_CS_PIN PB3
#define USE_MAX7456 #define USE_MAX7456
#define MAX7456_SPI_INSTANCE SPI3 #define MAX7456_SPI_INSTANCE SPI3

View File

@ -52,8 +52,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_BMP280 #define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI2 #define BARO_SPI_INSTANCE SPI2
#define BMP280_CS_PIN PA9 #define BARO_CS_PIN PA9
#define USE_MAX7456 #define USE_MAX7456
#define MAX7456_SPI_INSTANCE SPI2 #define MAX7456_SPI_INSTANCE SPI2

View File

@ -74,8 +74,8 @@
#define USE_ACC_SPI_MPU6000 #define USE_ACC_SPI_MPU6000
#define ACC_1_ALIGN CW90_DEG #define ACC_1_ALIGN CW90_DEG
#define BMP280_SPI_INSTANCE SPI1 #define BARO_SPI_INSTANCE SPI1
#define BMP280_CS_PIN PA13 #define BARO_CS_PIN PA13
#define USE_BARO #define USE_BARO
#define USE_BARO_BMP280 #define USE_BARO_BMP280

View File

@ -122,8 +122,8 @@
#define USE_BARO #define USE_BARO
#if defined(OMNIBUSF4SD) #if defined(OMNIBUSF4SD)
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI3 #define BARO_SPI_INSTANCE SPI3
#define BMP280_CS_PIN PB3 // v1 #define BARO_CS_PIN PB3 // v1
#endif #endif
#define USE_BARO_BMP085 #define USE_BARO_BMP085
#define USE_BARO_BMP280 #define USE_BARO_BMP280

View File

@ -80,8 +80,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI3 #define BARO_SPI_INSTANCE SPI3
#define BMP280_CS_PIN PB3 #define BARO_CS_PIN PB3
#define DEFAULT_BARO_SPI_BMP280 #define DEFAULT_BARO_SPI_BMP280
#define USE_MAX7456 #define USE_MAX7456

View File

@ -205,8 +205,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_BMP280 #define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI1 #define BARO_SPI_INSTANCE SPI1
#define BMP280_CS_PIN PA1 #define BARO_CS_PIN PA1
#define USE_MAG #define USE_MAG
#define USE_MAG_HMC5883 #define USE_MAG_HMC5883

View File

@ -82,8 +82,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_SPI_LPS #define USE_BARO_SPI_LPS
#define LPS_SPI_INSTANCE SPI2 #define BARO_SPI_INSTANCE SPI2
#define LPS_CS_PIN PA10 #define BARO_CS_PIN PA10
#define DEFAULT_BARO_SPI_LPS #define DEFAULT_BARO_SPI_LPS
#define BARO_I2C_INSTANCE (I2CDEV_1) #define BARO_I2C_INSTANCE (I2CDEV_1)

View File

@ -151,8 +151,8 @@
#if defined(AIRBOTF4) || defined(AIRBOTF4SD) #if defined(AIRBOTF4) || defined(AIRBOTF4SD)
#define USE_BARO_SPI_BMP280 #define USE_BARO_SPI_BMP280
#define BMP280_SPI_INSTANCE SPI1 #define BARO_SPI_INSTANCE SPI1
#define BMP280_CS_PIN PC13 #define BARO_CS_PIN PC13
#endif #endif
#if defined(AIRBOTF4SD) #if defined(AIRBOTF4SD)

View File

@ -58,8 +58,8 @@
#define USE_BARO #define USE_BARO
#define USE_BARO_MS5611 #define USE_BARO_MS5611
#define USE_BARO_SPI_MS5611 #define USE_BARO_SPI_MS5611
#define MS5611_CS_PIN PE1 #define BARO_CS_PIN PE1
#define MS5611_SPI_INSTANCE SPI1 #define BARO_SPI_INSTANCE SPI1
#if 0 // TODO: Enable SDCard and blackbox logging #if 0 // TODO: Enable SDCard and blackbox logging
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT #define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT

View File

@ -99,8 +99,8 @@
#if !defined(PIRXF4) #if !defined(PIRXF4)
#define USE_BARO #define USE_BARO
#define USE_BARO_SPI_LPS #define USE_BARO_SPI_LPS
#define LPS_SPI_INSTANCE SPI3 #define BARO_SPI_INSTANCE SPI3
#define LPS_CS_PIN PB8 #define BARO_CS_PIN PB8
#endif #endif
//UARTs //UARTs

View File

@ -355,3 +355,16 @@
#define RANGEFINDER_HCSR04_ECHO_PIN NONE #define RANGEFINDER_HCSR04_ECHO_PIN NONE
#endif #endif
#endif #endif
// Baro
#if defined(USE_BARO)
#ifndef BARO_SPI_INSTANCE
#define BARO_SPI_INSTANCE NULL
#endif
#ifndef BARO_CS_PIN
#define BARO_CS_PIN NONE
#endif
#ifndef BARO_I2C_INSTANCE
#define BARO_I2C_INSTANCE I2C_DEVICE
#endif
#endif