AP_Compass: enable LIS3MDL on I2C and RM3100 on SPI
This commit is contained in:
parent
29fe4241a8
commit
0ec3f80bbe
@ -925,12 +925,19 @@ void Compass::_detect_backends(void)
|
||||
true, HAL_COMPASS_QMC5883L_ORIENTATION_EXTERNAL));
|
||||
ADD_BACKEND(DRIVER_QMC5883, AP_Compass_QMC5883L::probe(GET_I2C_DEVICE(0, HAL_COMPASS_QMC5883L_I2C_ADDR),
|
||||
false, HAL_COMPASS_QMC5883L_ORIENTATION_INTERNAL));
|
||||
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_LIS3MDL_I2C
|
||||
FOREACH_I2C(i) {
|
||||
ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(GET_I2C_DEVICE(i, HAL_COMPASS_LIS3MDL_I2C_ADDR), true, ROTATION_NONE));
|
||||
ADD_BACKEND(DRIVER_LIS3MDL, AP_Compass_LIS3MDL::probe(GET_I2C_DEVICE(i, HAL_COMPASS_LIS3MDL_I2C_ADDR2), true, ROTATION_NONE));
|
||||
}
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_LINUX && CONFIG_HAL_BOARD_SUBTYPE != HAL_BOARD_SUBTYPE_LINUX_NONE
|
||||
ADD_BACKEND(DRIVER_HMC5843, AP_Compass_HMC5843::probe(GET_I2C_DEVICE(HAL_COMPASS_HMC5843_I2C_BUS, HAL_COMPASS_HMC5843_I2C_ADDR)));
|
||||
ADD_BACKEND(DRIVER_AK8963, AP_Compass_AK8963::probe_mpu9250(0));
|
||||
ADD_BACKEND(DRIVER_LSM9DS1, AP_Compass_LSM9DS1::probe(hal.spi->get_device("lsm9ds1_m")));
|
||||
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_BMM150_I2C
|
||||
ADD_BACKEND(DRIVER_BMM150, AP_Compass_BMM150::probe(GET_I2C_DEVICE(HAL_COMPASS_BMM150_I2C_BUS, HAL_COMPASS_BMM150_I2C_ADDR)));
|
||||
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_RM3100_SPI
|
||||
ADD_BACKEND(DRIVER_RM3100, AP_Compass_RM3100::probe(hal.spi->get_device("rm3100"), ROTATION_NONE));
|
||||
#elif HAL_COMPASS_DEFAULT == HAL_COMPASS_NONE
|
||||
// no compass
|
||||
#else
|
||||
|
@ -97,6 +97,11 @@ bool AP_Compass_RM3100::init()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (dev->bus_type() == AP_HAL::Device::BUS_TYPE_SPI) {
|
||||
// read has high bit set for SPI
|
||||
dev->set_read_flag(0x80);
|
||||
}
|
||||
|
||||
// high retries for init
|
||||
dev->set_retries(10);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user