From 00d3c158db47c6e63762a5de77b7268093007e0d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 19 Jan 2018 16:06:34 +1100 Subject: [PATCH] AP_Baro: use generic defines for 20789 --- libraries/AP_Baro/AP_Baro.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libraries/AP_Baro/AP_Baro.cpp b/libraries/AP_Baro/AP_Baro.cpp index 369c118829..25c392a62f 100644 --- a/libraries/AP_Baro/AP_Baro.cpp +++ b/libraries/AP_Baro/AP_Baro.cpp @@ -521,10 +521,14 @@ void AP_Baro::init(void) #elif HAL_BARO_DEFAULT == HAL_BARO_LPS25H ADD_BACKEND(AP_Baro_LPS25H::probe(*this, std::move(hal.i2c_mgr->get_device(HAL_BARO_LPS25H_I2C_BUS, HAL_BARO_LPS25H_I2C_ADDR)))); -#elif CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_CHIBIOS_SKYVIPER_F412 +#elif HAL_BARO_DEFAULT == HAL_BARO_20789_I2C_I2C ADD_BACKEND(AP_Baro_ICM20789::probe(*this, - std::move(hal.i2c_mgr->get_device(1, 0x63)), - std::move(hal.i2c_mgr->get_device(1, 0x68)))); + std::move(hal.i2c_mgr->get_device(HAL_BARO_20789_I2C_BUS, HAL_BARO_20789_I2C_ADDR_PRESS)), + std::move(hal.i2c_mgr->get_device(HAL_BARO_20789_I2C_BUS, HAL_BARO_20789_I2C_ADDR_ICM)))); +#elif HAL_BARO_DEFAULT == HAL_BARO_20789_I2C_SPI + ADD_BACKEND(AP_Baro_ICM20789::probe(*this, + std::move(hal.i2c_mgr->get_device(HAL_BARO_20789_I2C_BUS, HAL_BARO_20789_I2C_ADDR_PRESS)), + std::move(hal.spi->get_device("icm20789")))); #endif // can optionally have baro on I2C too