Update Baro driver for generic target
This commit is contained in:
parent
60118da63f
commit
e5f330fbf1
|
@ -37,7 +37,3 @@ typedef struct baroDev_s {
|
|||
baroOpFuncPtr get_up;
|
||||
baroCalculateFuncPtr calculate;
|
||||
} baroDev_t;
|
||||
|
||||
#ifndef BARO_I2C_INSTANCE
|
||||
#define BARO_I2C_INSTANCE I2C_DEVICE
|
||||
#endif
|
||||
|
|
|
@ -95,28 +95,10 @@ void pgResetFn_barometerConfig(barometerConfig_t *barometerConfig)
|
|||
#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_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(BMP280_SPI_INSTANCE));
|
||||
barometerConfig->baro_spi_csn = IO_TAG(BMP280_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_spi_device = SPI_DEV_TO_CFG(spiDeviceByInstance(BARO_SPI_INSTANCE));
|
||||
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_MS5611) || defined(DEFAULT_BARO_BMP280) || defined(DEFAULT_BARO_BMP085)||defined(DEFAULT_BARO_QMP6988)
|
||||
|
|
|
@ -72,8 +72,8 @@
|
|||
#define USE_BARO
|
||||
#define USE_BARO_SPI_BMP280
|
||||
#define DEFAULT_BARO_SPI_BMP280
|
||||
#define BMP280_SPI_INSTANCE SPI2
|
||||
#define BMP280_CS_PIN PB9
|
||||
#define BARO_SPI_INSTANCE SPI2
|
||||
#define BARO_CS_PIN PB9
|
||||
|
||||
#define USE_MAX7456
|
||||
#define MAX7456_SPI_INSTANCE SPI3
|
||||
|
|
|
@ -54,8 +54,8 @@
|
|||
#define USE_BARO
|
||||
#define USE_BARO_SPI_BMP280
|
||||
|
||||
#define BMP280_SPI_INSTANCE SPI2
|
||||
#define BMP280_CS_PIN PB5
|
||||
#define BARO_SPI_INSTANCE SPI2
|
||||
#define BARO_CS_PIN PB5
|
||||
|
||||
#define USE_UART1
|
||||
#define USE_UART2
|
||||
|
|
|
@ -75,11 +75,8 @@
|
|||
#define USE_BARO_BMP280
|
||||
#define USE_BARO_SPI_BMP280
|
||||
|
||||
#define MS5611_CS_PIN SPI3_NSS_PIN
|
||||
#define MS5611_SPI_INSTANCE SPI3
|
||||
|
||||
#define BMP280_CS_PIN SPI3_NSS_PIN
|
||||
#define BMP280_SPI_INSTANCE SPI3
|
||||
#define BARO_CS_PIN SPI3_NSS_PIN
|
||||
#define BARO_SPI_INSTANCE SPI3
|
||||
|
||||
#define USE_SDCARD
|
||||
#define USE_SDCARD_SPI
|
||||
|
|
|
@ -151,8 +151,8 @@
|
|||
#define USE_BARO
|
||||
#define USE_BARO_BMP280
|
||||
#define USE_BARO_SPI_BMP280
|
||||
#define BMP280_SPI_INSTANCE SPI3
|
||||
#define BMP280_CS_PIN SPI3_NSS_PIN
|
||||
#define BARO_SPI_INSTANCE SPI3
|
||||
#define BARO_CS_PIN SPI3_NSS_PIN
|
||||
#endif
|
||||
|
||||
/* Serial ports etc.
|
||||
|
|
|
@ -61,8 +61,8 @@
|
|||
#define GYRO_1_SPI_INSTANCE SPI1
|
||||
|
||||
// tqfp48 pin 25
|
||||
#define BMP280_CS_PIN SPI2_NSS_PIN
|
||||
#define BMP280_SPI_INSTANCE SPI2
|
||||
#define BARO_CS_PIN SPI2_NSS_PIN
|
||||
#define BARO_SPI_INSTANCE SPI2
|
||||
|
||||
#define USE_FLASHFS
|
||||
#define USE_FLASH_M25P16
|
||||
|
|
|
@ -51,8 +51,8 @@
|
|||
#define USE_BARO
|
||||
#define USE_BARO_BMP280
|
||||
#define USE_BARO_SPI_BMP280
|
||||
#define BMP280_SPI_INSTANCE SPI3
|
||||
#define BMP280_CS_PIN PB3
|
||||
#define BARO_SPI_INSTANCE SPI3
|
||||
#define BARO_CS_PIN PB3
|
||||
|
||||
#define USE_MAX7456
|
||||
#define MAX7456_SPI_INSTANCE SPI3
|
||||
|
|
|
@ -52,8 +52,8 @@
|
|||
#define USE_BARO
|
||||
#define USE_BARO_BMP280
|
||||
#define USE_BARO_SPI_BMP280
|
||||
#define BMP280_SPI_INSTANCE SPI2
|
||||
#define BMP280_CS_PIN PA9
|
||||
#define BARO_SPI_INSTANCE SPI2
|
||||
#define BARO_CS_PIN PA9
|
||||
|
||||
#define USE_MAX7456
|
||||
#define MAX7456_SPI_INSTANCE SPI2
|
||||
|
|
|
@ -74,8 +74,8 @@
|
|||
#define USE_ACC_SPI_MPU6000
|
||||
#define ACC_1_ALIGN CW90_DEG
|
||||
|
||||
#define BMP280_SPI_INSTANCE SPI1
|
||||
#define BMP280_CS_PIN PA13
|
||||
#define BARO_SPI_INSTANCE SPI1
|
||||
#define BARO_CS_PIN PA13
|
||||
|
||||
#define USE_BARO
|
||||
#define USE_BARO_BMP280
|
||||
|
|
|
@ -122,8 +122,8 @@
|
|||
#define USE_BARO
|
||||
#if defined(OMNIBUSF4SD)
|
||||
#define USE_BARO_SPI_BMP280
|
||||
#define BMP280_SPI_INSTANCE SPI3
|
||||
#define BMP280_CS_PIN PB3 // v1
|
||||
#define BARO_SPI_INSTANCE SPI3
|
||||
#define BARO_CS_PIN PB3 // v1
|
||||
#endif
|
||||
#define USE_BARO_BMP085
|
||||
#define USE_BARO_BMP280
|
||||
|
|
|
@ -80,8 +80,8 @@
|
|||
|
||||
#define USE_BARO
|
||||
#define USE_BARO_SPI_BMP280
|
||||
#define BMP280_SPI_INSTANCE SPI3
|
||||
#define BMP280_CS_PIN PB3
|
||||
#define BARO_SPI_INSTANCE SPI3
|
||||
#define BARO_CS_PIN PB3
|
||||
#define DEFAULT_BARO_SPI_BMP280
|
||||
|
||||
#define USE_MAX7456
|
||||
|
|
|
@ -205,8 +205,8 @@
|
|||
#define USE_BARO
|
||||
#define USE_BARO_BMP280
|
||||
#define USE_BARO_SPI_BMP280
|
||||
#define BMP280_SPI_INSTANCE SPI1
|
||||
#define BMP280_CS_PIN PA1
|
||||
#define BARO_SPI_INSTANCE SPI1
|
||||
#define BARO_CS_PIN PA1
|
||||
|
||||
#define USE_MAG
|
||||
#define USE_MAG_HMC5883
|
||||
|
|
|
@ -82,8 +82,8 @@
|
|||
|
||||
#define USE_BARO
|
||||
#define USE_BARO_SPI_LPS
|
||||
#define LPS_SPI_INSTANCE SPI2
|
||||
#define LPS_CS_PIN PA10
|
||||
#define BARO_SPI_INSTANCE SPI2
|
||||
#define BARO_CS_PIN PA10
|
||||
#define DEFAULT_BARO_SPI_LPS
|
||||
|
||||
#define BARO_I2C_INSTANCE (I2CDEV_1)
|
||||
|
|
|
@ -151,8 +151,8 @@
|
|||
|
||||
#if defined(AIRBOTF4) || defined(AIRBOTF4SD)
|
||||
#define USE_BARO_SPI_BMP280
|
||||
#define BMP280_SPI_INSTANCE SPI1
|
||||
#define BMP280_CS_PIN PC13
|
||||
#define BARO_SPI_INSTANCE SPI1
|
||||
#define BARO_CS_PIN PC13
|
||||
#endif
|
||||
|
||||
#if defined(AIRBOTF4SD)
|
||||
|
|
|
@ -58,8 +58,8 @@
|
|||
#define USE_BARO
|
||||
#define USE_BARO_MS5611
|
||||
#define USE_BARO_SPI_MS5611
|
||||
#define MS5611_CS_PIN PE1
|
||||
#define MS5611_SPI_INSTANCE SPI1
|
||||
#define BARO_CS_PIN PE1
|
||||
#define BARO_SPI_INSTANCE SPI1
|
||||
|
||||
#if 0 // TODO: Enable SDCard and blackbox logging
|
||||
#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT
|
||||
|
|
|
@ -99,8 +99,8 @@
|
|||
#if !defined(PIRXF4)
|
||||
#define USE_BARO
|
||||
#define USE_BARO_SPI_LPS
|
||||
#define LPS_SPI_INSTANCE SPI3
|
||||
#define LPS_CS_PIN PB8
|
||||
#define BARO_SPI_INSTANCE SPI3
|
||||
#define BARO_CS_PIN PB8
|
||||
#endif
|
||||
|
||||
//UARTs
|
||||
|
|
|
@ -355,3 +355,16 @@
|
|||
#define RANGEFINDER_HCSR04_ECHO_PIN NONE
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue