1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-26 09:45:37 +03:00

Support MPU925x internal magnetometer over I2C

This commit is contained in:
krygacz 2020-09-02 16:16:31 +02:00
parent 1c3346bae1
commit 58ae3fdfd5
6 changed files with 116 additions and 3 deletions

View file

@ -38,8 +38,10 @@
#include "drivers/compass/compass_ak8963.h"
#include "drivers/compass/compass_fake.h"
#include "drivers/compass/compass_hmc5883l.h"
#include "drivers/compass/compass_qmc5883l.h"
#include "drivers/compass/compass_lis3mdl.h"
#include "drivers/compass/compass_mpu925x_ak8963.h"
#include "drivers/compass/compass_qmc5883l.h"
#include "drivers/io.h"
#include "drivers/light_led.h"
#include "drivers/time.h"
@ -267,6 +269,18 @@ bool compassDetect(magDev_t *dev, uint8_t *alignment)
break;
}
// MAG_MPU925X_AK8963 is an MPU925x configured as I2C passthrough to the built-in AK8963 magnetometer
// Passthrough mode disables the gyro/acc part of the MPU, so we only want to detect this sensor if mag_hardware was explicitly set to MAG_MPU925X_AK8963
#ifdef USE_MAG_MPU925X_AK8963
if(compassConfig()->mag_hardware == MAG_MPU925X_AK8963){
if (mpu925Xak8963CompassDetect(dev)) {
magHardware = MAG_MPU925X_AK8963;
} else {
return false;
}
}
#endif
if (magHardware == MAG_NONE) {
return false;
}