Path: blob/master/libraries/AP_Compass/AP_Compass_config.h
9608 views
#pragma once12#include <AP_HAL/AP_HAL_Boards.h>3#include <AP_ExternalAHRS/AP_ExternalAHRS_config.h>4#include <AP_MSP/msp.h>5#include <AP_AHRS/AP_AHRS_config.h>6#include <AP_GPS/AP_GPS_config.h>7#include <AP_InertialSensor/AP_InertialSensor_config.h>89#ifndef AP_COMPASS_ENABLED10#define AP_COMPASS_ENABLED 111#endif1213#ifndef AP_COMPASS_DIAGONALS_ENABLED14#define AP_COMPASS_DIAGONALS_ENABLED 115#endif1617#ifndef COMPASS_CAL_ENABLED18#define COMPASS_CAL_ENABLED AP_COMPASS_ENABLED && AP_AHRS_DCM_ENABLED19#endif2021#ifndef AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED22#define AP_COMPASS_CALIBRATION_FIXED_YAW_ENABLED AP_COMPASS_ENABLED && AP_GPS_ENABLED && AP_AHRS_ENABLED23#endif2425#define COMPASS_MAX_SCALE_FACTOR 1.526#define COMPASS_MIN_SCALE_FACTOR (1.0/COMPASS_MAX_SCALE_FACTOR)2728// Backend support29#ifndef AP_COMPASS_BACKEND_DEFAULT_ENABLED30#define AP_COMPASS_BACKEND_DEFAULT_ENABLED AP_COMPASS_ENABLED31#endif3233#ifndef AP_COMPASS_EXTERNALAHRS_ENABLED34#define AP_COMPASS_EXTERNALAHRS_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && AP_EXTERNAL_AHRS_ENABLED)35#endif3637#ifndef AP_COMPASS_MSP_ENABLED38#define AP_COMPASS_MSP_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && HAL_MSP_SENSORS_ENABLED)39#endif4041#ifndef AP_COMPASS_SITL_ENABLED42#define AP_COMPASS_SITL_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && AP_SIM_ENABLED)43#endif4445#ifndef AP_COMPASS_DRONECAN_ENABLED46#define AP_COMPASS_DRONECAN_ENABLED (AP_COMPASS_BACKEND_DEFAULT_ENABLED && HAL_ENABLE_DRONECAN_DRIVERS)47#endif4849#ifndef AP_COMPASS_DRONECAN_HIRES_ENABLED50#define AP_COMPASS_DRONECAN_HIRES_ENABLED 051#endif5253// i2c-based compasses:54#ifndef AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED55#define AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED AP_COMPASS_BACKEND_DEFAULT_ENABLED56#endif5758#ifndef AP_COMPASS_AK09916_ENABLED59#define AP_COMPASS_AK09916_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED60#endif6162#ifndef AP_COMPASS_AK8963_ENABLED63#define AP_COMPASS_AK8963_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED64#endif6566#ifndef AP_COMPASS_BMM150_ENABLED67#define AP_COMPASS_BMM150_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED68#endif6970#ifndef AP_COMPASS_BMM350_ENABLED71#define AP_COMPASS_BMM350_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED72#endif7374#ifndef AP_COMPASS_HMC5843_ENABLED75#define AP_COMPASS_HMC5843_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED76#endif7778#ifndef AP_COMPASS_ICM20948_ENABLED79#define AP_COMPASS_ICM20948_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && AP_INERTIALSENSOR_ENABLED80#endif8182#ifndef AP_COMPASS_IIS2MDC_ENABLED83#define AP_COMPASS_IIS2MDC_ENABLED 084#endif8586#ifndef AP_COMPASS_IST8308_ENABLED87#define AP_COMPASS_IST8308_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED88#endif8990#ifndef AP_COMPASS_IST8310_ENABLED91#define AP_COMPASS_IST8310_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED92#endif9394#ifndef AP_COMPASS_LIS3MDL_ENABLED95#define AP_COMPASS_LIS3MDL_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED96#endif9798#ifndef AP_COMPASS_LIS2MDL_ENABLED99#define AP_COMPASS_LIS2MDL_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && (HAL_PROGRAM_SIZE_LIMIT_KB > 1024)100#endif101102#ifndef AP_COMPASS_LSM303D_ENABLED103#define AP_COMPASS_LSM303D_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED104#endif105106#ifndef AP_COMPASS_LSM9DS1_ENABLED107#define AP_COMPASS_LSM9DS1_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED108#endif109110#ifndef AP_COMPASS_MAG3110_ENABLED111#define AP_COMPASS_MAG3110_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED112#endif113114#ifndef AP_COMPASS_MMC3416_ENABLED115#define AP_COMPASS_MMC3416_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED116#endif117118#ifndef AP_COMPASS_MMC5XX3_ENABLED119#define AP_COMPASS_MMC5XX3_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && (HAL_PROGRAM_SIZE_LIMIT_KB > 1024)120#endif121122#ifndef AP_COMPASS_QMC5883P_ENABLED123#define AP_COMPASS_QMC5883P_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED && (HAL_PROGRAM_SIZE_LIMIT_KB > 1024)124#endif125126#ifndef AP_COMPASS_QMC5883L_ENABLED127#define AP_COMPASS_QMC5883L_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED128#endif129130#ifndef AP_COMPASS_RM3100_ENABLED131#define AP_COMPASS_RM3100_ENABLED AP_COMPASS_I2C_BACKEND_DEFAULT_ENABLED132#endif133134#ifndef AP_COMPASS_PROBING_ENABLED135// FIXME: vast majority of boards define this to 1!136#define AP_COMPASS_PROBING_ENABLED 0137#endif138139// boards can specify that they do not want their internal buses140// probed for compasses - we default to probing them if we are probing141// any buses:142#ifndef AP_COMPASS_INTERNAL_BUS_PROBING_ENABLED143#define AP_COMPASS_INTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_PROBING_ENABLED || AP_FEATURE_BOARD_DETECT)144#endif145146// some boards do not want to probe the internal buses for IS8310 but147// *do* want to probe internal buses for other compasses:148#ifndef AP_COMPASS_IST8310_INTERNAL_BUS_PROBING_ENABLED149#define AP_COMPASS_IST8310_INTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_IST8310_ENABLED && AP_COMPASS_INTERNAL_BUS_PROBING_ENABLED)150#endif151152// fmuv5 boards didn't want to probe external buses for IS8310 -153// possibly one of their internal buses is marked external so don't154// want onboard IST8310 detected before *actual* external compasses?155#ifndef AP_COMPASS_IST8310_EXTERNAL_BUS_PROBING_ENABLED156#define AP_COMPASS_IST8310_EXTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_IST8310_ENABLED && AP_COMPASS_PROBING_ENABLED)157#endif // AP_COMPASS_IST8310_EXTERNAL_BUS_PROBING_ENABLED158159#ifndef AP_COMPASS_LIS2MDL_EXTERNAL_BUS_PROBING_ENABLED160#define AP_COMPASS_LIS2MDL_EXTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_LIS2MDL_ENABLED && AP_COMPASS_PROBING_ENABLED)161#endif // AP_COMPASS_LIS2MDL_EXTERNAL_BUS_PROBING_ENABLED162163#ifndef AP_COMPASS_HMC5843_INTERNAL_BUS_PROBING_ENABLED164#define AP_COMPASS_HMC5843_INTERNAL_BUS_PROBING_ENABLED (AP_COMPASS_HMC5843_ENABLED && AP_COMPASS_INTERNAL_BUS_PROBING_ENABLED)165#endif // AP_COMPASS_HMC5843_INTERNAL_BUS_PROBING_ENABLED166167168169