AP_Compass: add support to BH hat

This commit is contained in:
Aaron Wang Shi 2015-11-28 17:37:40 +08:00 committed by Andrew Tridgell
parent 3a31970056
commit 5a085b1610

View File

@ -427,9 +427,15 @@ void Compass::_detect_backends(void)
#if CONFIG_HAL_BOARD == HAL_BOARD_LINUX && CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_RASPILOT
_add_backend(AP_Compass_HMC5843::detect_i2c(*this, hal.i2c));
_add_backend(AP_Compass_LSM303D::detect_spi(*this));
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX && \
CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_NONE && \
CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_BEBOP && \
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_BH
// detect_mpu9250() failed will cause panic if no actual mpu9250 backend,
// in BH, only one compass should be detected
AP_Compass_Backend *backend = AP_Compass_HMC5843::detect_i2c(*this, hal.i2c);
backend ? _add_backend(backend)
: _add_backend(AP_Compass_AK8963::detect_mpu9250(*this, 0));
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX && \
CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_NONE && \
CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_BEBOP && \
CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_MINLURE
_add_backend(AP_Compass_HMC5843::detect_i2c(*this, hal.i2c));
_add_backend(AP_Compass_AK8963::detect_mpu9250(*this, 0));