1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 06:15:16 +03:00

Merge pull request #4865 from martinbudden/bfa_gyro_9250_init

Allow setting of FCHOICE_B in 9250 gyro
This commit is contained in:
Michael Keller 2017-12-30 12:01:06 +13:00 committed by GitHub
commit 88f70c678a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -143,7 +143,16 @@ static void mpu9250AccAndGyroInit(gyroDev_t *gyro) {
mpu9250SpiWriteRegisterVerify(&gyro->bus, MPU_RA_PWR_MGMT_1, INV_CLK_PLL);
//Fchoice_b defaults to 00 which makes fchoice 11
const uint8_t raGyroConfigData = gyro->gyroRateKHz > GYRO_RATE_8_kHz ? (INV_FSR_2000DPS << 3 | FCB_3600_32) : (INV_FSR_2000DPS << 3 | FCB_DISABLED);
uint8_t raGyroConfigData = INV_FSR_2000DPS << 3;
if (gyro->gyroRateKHz > GYRO_RATE_8_kHz) {
// use otherwise redundant LPF value to configure FCHOICE_B
// see REGISTER 27 GYROSCOPE CONFIGURATION in datasheet
if (gyro->lpf==GYRO_LPF_NONE) {
raGyroConfigData |= FCB_8800_32;
} else {
raGyroConfigData |= FCB_3600_32;
}
}
mpu9250SpiWriteRegisterVerify(&gyro->bus, MPU_RA_GYRO_CONFIG, raGyroConfigData);
if (gyro->lpf == 4) {