HAL_ChibiOS: probe for external compasses on several boards

boards that have no internal compass will now probe for all external
compass types
This commit is contained in:
Andrew Tridgell 2018-07-13 20:14:03 +10:00
parent ff6d639ed7
commit 9ab55f6838
7 changed files with 39 additions and 34 deletions

View File

@ -120,14 +120,14 @@ FLASH_RESERVE_START_KB 64
define HAL_INS_DEFAULT HAL_INS_MPU60XX_SPI define HAL_INS_DEFAULT HAL_INS_MPU60XX_SPI
define HAL_INS_DEFAULT_ROTATION ROTATION_YAW_180 define HAL_INS_DEFAULT_ROTATION ROTATION_YAW_180
# there is no compass fitted by default # no built-in compass, but probe the i2c bus for all possible
# external compass types
define ALLOW_ARM_NO_COMPASS define ALLOW_ARM_NO_COMPASS
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_I2C_INTERNAL_MASK 0
define HAL_COMPASS_DEFAULT HAL_COMPASS_HMC5843 # baro is a bmp280 on i2c
define HAL_COMPASS_HMC5843_I2C_BUS 0
define HAL_COMPASS_HMC5843_I2C_ADDR 0x1E
define HAL_COMPASS_HMC5843_ROTATION ROTATION_YAW_90
define HAL_BARO_DEFAULT HAL_BARO_BMP280_I2C define HAL_BARO_DEFAULT HAL_BARO_BMP280_I2C
define HAL_BARO_BMP280_BUS 0 define HAL_BARO_BMP280_BUS 0
define HAL_BARO_BMP280_I2C_ADDR 0x76 define HAL_BARO_BMP280_I2C_ADDR 0x76

View File

@ -117,16 +117,14 @@ define HAL_BARO_DEFAULT HAL_BARO_BMP280_I2C
define HAL_BARO_BMP280_BUS 0 define HAL_BARO_BMP280_BUS 0
define HAL_BARO_BMP280_I2C_ADDR 0x76 define HAL_BARO_BMP280_I2C_ADDR 0x76
# no built-in compass, but probe the i2c bus for all possible
# external compass types
define ALLOW_ARM_NO_COMPASS define ALLOW_ARM_NO_COMPASS
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_I2C_INTERNAL_MASK 0
define HAL_COMPASS_DEFAULT HAL_COMPASS_BMM150_I2C # probe for an invensense IMU
define HAL_COMPASS_BMM150_I2C_BUS 0
define HAL_COMPASS_BMM150_I2C_ADDR 0x10
define HAL_COMPASS_HMC5843_I2C_BUS 0
define HAL_COMPASS_HMC5843_I2C_ADDR 0x1E
define HAL_COMPASS_HMC5843_ROTATION ROTATION_YAW_90
define HAL_INS_DEFAULT HAL_INS_MPU60XX_SPI define HAL_INS_DEFAULT HAL_INS_MPU60XX_SPI
define HAL_INS_DEFAULT_ROTATION ROTATION_YAW_180 define HAL_INS_DEFAULT_ROTATION ROTATION_YAW_180

View File

@ -163,12 +163,12 @@ define HAL_BATT_CURR_PIN 11
define HAL_BATT_VOLT_SCALE 11 define HAL_BATT_VOLT_SCALE 11
define HAL_BATT_CURR_SCALE 31.7 define HAL_BATT_CURR_SCALE 31.7
define HAL_COMPASS_DEFAULT HAL_COMPASS_HMC5843 # no built-in compass, but probe the i2c bus for all possible
define HAL_COMPASS_HMC5843_I2C_BUS 1 # external compass types
define HAL_COMPASS_HMC5843_I2C_ADDR 0x1E
define HAL_COMPASS_HMC5843_ROTATION ROTATION_NONE
define ALLOW_ARM_NO_COMPASS define ALLOW_ARM_NO_COMPASS
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_I2C_INTERNAL_MASK 0
define OSD_ENABLED ENABLED define OSD_ENABLED ENABLED
ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin ROMFS_WILDCARD libraries/AP_OSD/fonts/font*.bin

View File

@ -130,13 +130,12 @@ FLASH_RESERVE_START_KB 64
define HAL_INS_DEFAULT HAL_INS_MPU60XX_SPI define HAL_INS_DEFAULT HAL_INS_MPU60XX_SPI
define HAL_INS_DEFAULT_ROTATION ROTATION_YAW_180 define HAL_INS_DEFAULT_ROTATION ROTATION_YAW_180
# there is no compass fitted by default # no built-in compass, but probe the i2c bus for all possible
# external compass types
define ALLOW_ARM_NO_COMPASS define ALLOW_ARM_NO_COMPASS
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
define HAL_COMPASS_DEFAULT HAL_COMPASS_HMC5843 define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_COMPASS_HMC5843_I2C_BUS 0 define HAL_I2C_INTERNAL_MASK 0
define HAL_COMPASS_HMC5843_I2C_ADDR 0x1E
define HAL_COMPASS_HMC5843_ROTATION ROTATION_YAW_90
define HAL_BARO_DEFAULT HAL_BARO_BMP280_I2C define HAL_BARO_DEFAULT HAL_BARO_BMP280_I2C
define HAL_BARO_BMP280_BUS 0 define HAL_BARO_BMP280_BUS 0

View File

@ -120,7 +120,14 @@ SPIDEV sdcard SPI4 DEVID1 SDCARD_CS MODE0 400*KHZ 25*MHZ
SPIDEV osd SPI2 DEVID1 MAX7456_CS MODE0 10*MHZ 10*MHZ SPIDEV osd SPI2 DEVID1 MAX7456_CS MODE0 10*MHZ 10*MHZ
define HAL_OS_FATFS_IO 1 define HAL_OS_FATFS_IO 1
# no built-in compass, but probe the i2c bus for all possible
# external compass types
define ALLOW_ARM_NO_COMPASS define ALLOW_ARM_NO_COMPASS
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_I2C_INTERNAL_MASK 0
define HAL_BARO_DEFAULT HAL_BARO_BMP280_SPI define HAL_BARO_DEFAULT HAL_BARO_BMP280_SPI
define OSD_ENABLED ENABLED define OSD_ENABLED ENABLED

View File

@ -113,10 +113,11 @@ define HAL_BARO_LPS25H_I2C_BUS 0
define HAL_BARO_LPS25H_I2C_ADDR 0x5D define HAL_BARO_LPS25H_I2C_ADDR 0x5D
define HAL_BARO_LPS25H_I2C_IMU_ADDR HAL_INS_MPU60x0_I2C_ADDR define HAL_BARO_LPS25H_I2C_IMU_ADDR HAL_INS_MPU60x0_I2C_ADDR
define HAL_COMPASS_DEFAULT HAL_COMPASS_AK8963_I2C # no built-in compass, but probe the i2c bus for all possible
define HAL_COMPASS_AK8963_I2C_BUS 0 # external compass types
define HAL_COMPASS_AK8963_I2C_ADDR 0x0c
define ALLOW_ARM_NO_COMPASS define ALLOW_ARM_NO_COMPASS
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_I2C_INTERNAL_MASK 0
define MAG_BOARD_ORIENTATION ROTATION_YAW_180 define MAG_BOARD_ORIENTATION ROTATION_YAW_180

View File

@ -100,12 +100,12 @@ define HAL_INS_DEFAULT_ROTATION ROTATION_YAW_180
define HAL_BARO_DEFAULT HAL_BARO_BMP280_SPI define HAL_BARO_DEFAULT HAL_BARO_BMP280_SPI
define HAL_BARO_BMP280_NAME "bmp280" define HAL_BARO_BMP280_NAME "bmp280"
define HAL_COMPASS_DEFAULT HAL_COMPASS_HMC5843 # no built-in compass, but probe the i2c bus for all possible
define HAL_COMPASS_HMC5843_I2C_BUS 0 # external compass types
define HAL_COMPASS_HMC5843_I2C_ADDR 0x1E
# there is no compass fitted by default
define ALLOW_ARM_NO_COMPASS define ALLOW_ARM_NO_COMPASS
define HAL_COMPASS_DEFAULT HAL_COMPASS_NONE
define HAL_PROBE_EXTERNAL_I2C_COMPASSES
define HAL_I2C_INTERNAL_MASK 0
define STORAGE_FLASH_PAGE 1 define STORAGE_FLASH_PAGE 1
define HAL_STORAGE_SIZE 15360 define HAL_STORAGE_SIZE 15360