1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

ICM20689 Gyro Fix

This commit is contained in:
kc10kevin 2016-10-16 20:28:53 -05:00
parent c96bb34fda
commit 6dbded7071
3 changed files with 23 additions and 9 deletions

View file

@ -81,16 +81,30 @@ static void icm20689SpiInit(void)
bool icm20689SpiDetect(void) bool icm20689SpiDetect(void)
{ {
uint8_t tmp; uint8_t tmp;
uint8_t attemptsRemaining = 20;
icm20689SpiInit(); icm20689SpiInit();
spiSetDivisor(ICM20689_SPI_INSTANCE, SPI_CLOCK_INITIALIZATON); //low speed
icm20689ReadRegister(MPU_RA_WHO_AM_I, 1, &tmp); icm20689WriteRegister(MPU_RA_PWR_MGMT_1, ICM20689_BIT_RESET);
if (tmp == ICM20689_WHO_AM_I_CONST) { do {
return true; delay(150);
}
icm20689ReadRegister(MPU_RA_WHO_AM_I, 1, &tmp);
if (tmp == ICM20689_WHO_AM_I_CONST) {
break;
}
if (!attemptsRemaining) {
return false;
}
} while (attemptsRemaining--);
spiSetDivisor(ICM20689_SPI_INSTANCE, SPI_CLOCK_FAST);
return true;
return false;
} }
bool icm20689SpiAccDetect(acc_t *acc) bool icm20689SpiAccDetect(acc_t *acc)

View file

@ -241,9 +241,9 @@ static const char * const sensorTypeNames[] = {
#define SENSOR_NAMES_MASK (SENSOR_GYRO | SENSOR_ACC | SENSOR_BARO | SENSOR_MAG) #define SENSOR_NAMES_MASK (SENSOR_GYRO | SENSOR_ACC | SENSOR_BARO | SENSOR_MAG)
static const char * const sensorHardwareNames[4][13] = { static const char * const sensorHardwareNames[4][12] = {
{ "", "None", "MPU6050", "L3G4200D", "MPU3050", "L3GD20", "MPU6000", "MPU6500", "MPU9250", "ICM20689", "FAKE", NULL }, { "", "None", "MPU6050", "L3G4200D", "MPU3050", "L3GD20", "MPU6000", "MPU6500", "MPU9250", "ICM20689", "FAKE", NULL },
{ "", "None", "ADXL345", "MPU6050", "MMA845x", "BMA280", "LSM303DLHC", "MPU6000", "MPU6500", "MPU9250", "ICM20689", "FAKE", NULL }, { "", "None", "ADXL345", "MPU6050", "MMA845x", "BMA280", "LSM303DLHC", "MPU6000", "MPU6500", "ICM20689", "FAKE", NULL },
{ "", "None", "BMP085", "MS5611", "BMP280", NULL }, { "", "None", "BMP085", "MS5611", "BMP280", NULL },
{ "", "None", "HMC5883", "AK8975", "AK8963", NULL } { "", "None", "HMC5883", "AK8975", "AK8963", NULL }
}; };

View file

@ -31,7 +31,7 @@ typedef enum {
ACC_LSM303DLHC = 6, ACC_LSM303DLHC = 6,
ACC_MPU6000 = 7, ACC_MPU6000 = 7,
ACC_MPU6500 = 8, ACC_MPU6500 = 8,
ACC_ICM20689 = 9, ACC_ICM20689 = 9,
ACC_FAKE = 10, ACC_FAKE = 10,
ACC_MAX = ACC_FAKE ACC_MAX = ACC_FAKE
} accelerationSensor_e; } accelerationSensor_e;