mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 01:05:27 +03:00
Fix MPU6500 Detect
This commit is contained in:
parent
9ddc12d257
commit
1fc4f8601f
2 changed files with 5 additions and 2 deletions
|
@ -27,6 +27,7 @@
|
|||
#include "system.h"
|
||||
#include "exti.h"
|
||||
#include "gpio.h"
|
||||
#include "gyro_sync.h"
|
||||
|
||||
#include "sensor.h"
|
||||
#include "accgyro.h"
|
||||
|
@ -55,6 +56,7 @@ bool mpu6500GyroDetect(gyro_t *gyro)
|
|||
|
||||
gyro->init = mpu6500GyroInit;
|
||||
gyro->read = mpuGyroRead;
|
||||
gyro->intStatus = checkMPUDataReady;
|
||||
|
||||
// 16.4 dps/lsb scalefactor
|
||||
gyro->scale = 1.0f / 16.4f;
|
||||
|
@ -94,7 +96,7 @@ void mpu6500GyroInit(uint16_t lpf)
|
|||
mpuConfiguration.write(MPU6500_RA_GYRO_CFG, INV_FSR_2000DPS << 3);
|
||||
mpuConfiguration.write(MPU6500_RA_ACCEL_CFG, INV_FSR_8G << 3);
|
||||
mpuConfiguration.write(MPU6500_RA_LPF, mpuLowPassFilter);
|
||||
mpuConfiguration.write(MPU6500_RA_RATE_DIV, 0); // 1kHz S/R
|
||||
mpuConfiguration.write(MPU6500_RA_RATE_DIV, gyroMPU6xxxGetDividerDrops()); // 1kHz S/R
|
||||
|
||||
// Data ready interrupt configuration
|
||||
mpuConfiguration.write(MPU6500_RA_INT_PIN_CFG, 0 << 7 | 0 << 6 | 0 << 5 | 1 << 4 | 0 << 3 | 0 << 2 | 1 << 1 | 0 << 0); // INT_ANYRD_2CLEAR, BYPASS_EN
|
||||
|
|
|
@ -133,9 +133,10 @@ bool mpu6500SpiGyroDetect(gyro_t *gyro)
|
|||
|
||||
gyro->init = mpu6500GyroInit;
|
||||
gyro->read = mpuGyroRead;
|
||||
gyro->intStatus = checkMPUDataReady;
|
||||
|
||||
// 16.4 dps/lsb scalefactor
|
||||
gyro->scale = 1.0f / 16.4f;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue