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:
parent
1c3346bae1
commit
58ae3fdfd5
6 changed files with 116 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ typedef enum {
|
|||
MAG_AK8975 = 3,
|
||||
MAG_AK8963 = 4,
|
||||
MAG_QMC5883 = 5,
|
||||
MAG_LIS3MDL = 6
|
||||
MAG_LIS3MDL = 6,
|
||||
MAG_MPU925X_AK8963 = 7
|
||||
} magSensor_e;
|
||||
|
||||
typedef struct mag_s {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue