1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-18 05:45:31 +03:00

Set F1 target i2c to 800khz

Still 200us spare time left in luxfloat
This commit is contained in:
borisbstyle 2015-10-08 15:38:49 +02:00
parent fa2ac7fe86
commit 8d8d57a1f4
2 changed files with 4 additions and 38 deletions

View file

@ -31,7 +31,7 @@
#ifndef SOFT_I2C #ifndef SOFT_I2C
#define CLOCKSPEED 1200000 // i2c clockspeed 400kHz default (conform specs), 800kHz and 1200kHz (Betaflight default) #define CLOCKSPEED 800000 // i2c clockspeed 400kHz default (conform specs), 800kHz and 1200kHz (Betaflight default)
// I2C2 // I2C2
// SCL PB10 // SCL PB10

View file

@ -50,9 +50,6 @@
//#define DEBUG_IMU //#define DEBUG_IMU
//#define DEBUG_IMU_SPEED //#define DEBUG_IMU_SPEED
#define MAX_ACC_PROCESSING 360 // Anti jitter equal acc processing each cycle
#define MAX_GYRO_PROCESSING 100 // Anti jitter equal gyro processing each cycle
int16_t accSmooth[XYZ_AXIS_COUNT]; int16_t accSmooth[XYZ_AXIS_COUNT];
int32_t accSum[XYZ_AXIS_COUNT]; int32_t accSum[XYZ_AXIS_COUNT];
@ -192,32 +189,17 @@ void imuUpdate(rollAndPitchTrims_t *accelerometerTrims, uint8_t imuUpdateSensors
#if defined(NAZE) || defined(DEBUG_IMU_SPEED) #if defined(NAZE) || defined(DEBUG_IMU_SPEED)
uint32_t time = micros(); uint32_t time = micros();
#endif #endif
#if defined(NAZE)
uint32_t accProcessTime, gyroProcessTime;
#endif
if (imuUpdateSensors == ONLY_GYRO || imuUpdateSensors == ACC_AND_GYRO) { if (imuUpdateSensors == ONLY_GYRO || imuUpdateSensors == ACC_AND_GYRO) {
gyroUpdate(); gyroUpdate();
#if defined(NAZE)
while (gyroProcessTime < MAX_GYRO_PROCESSING ) {
gyroProcessTime = micros() - time;
}
#endif
#ifdef DEBUG_IMU_SPEED #ifdef DEBUG_IMU_SPEED
debug[0] = micros() - time; // gyro read time debug[0] = micros() - time; // gyro read time
#endif #endif
} }
if (sensors(SENSOR_ACC) && (!imuUpdateSensors == ONLY_GYRO)) { if (sensors(SENSOR_ACC) && (!imuUpdateSensors == ONLY_GYRO)) {
#if defined(NAZE) || defined(DEBUG_IMU_SPEED) #ifdef DEBUG_IMU_SPEED
time = micros(); time = micros();
#endif #endif
qAccProcessingStateMachine(accelerometerTrims); qAccProcessingStateMachine(accelerometerTrims);
#if defined(NAZE)
while (accProcessTime < MAX_ACC_PROCESSING) {
accProcessTime = micros() - time;
}
#endif
} else { } else {
accADC[X] = 0; accADC[X] = 0;
accADC[Y] = 0; accADC[Y] = 0;
@ -230,40 +212,24 @@ void imuUpdate(rollAndPitchTrims_t *accelerometerTrims, uint8_t imuUpdateSensors
} }
#endif #endif
} }
#else #else
void imuUpdate(rollAndPitchTrims_t *accelerometerTrims, uint8_t imuUpdateSensors) void imuUpdate(rollAndPitchTrims_t *accelerometerTrims, uint8_t imuUpdateSensors)
{ {
#if defined(NAZE) || defined(DEBUG_IMU_SPEED) #ifdef DEBUG_IMU_SPEED
uint32_t time = micros(); uint32_t time = micros();
#endif #endif
#if defined(NAZE)
uint32_t accProcessTime, gyroProcessTime;
#endif
if (imuUpdateSensors == ONLY_GYRO || imuUpdateSensors == ACC_AND_GYRO) { if (imuUpdateSensors == ONLY_GYRO || imuUpdateSensors == ACC_AND_GYRO) {
gyroUpdate(); gyroUpdate();
#if defined(NAZE)
while (gyroProcessTime < MAX_GYRO_PROCESSING ) {
gyroProcessTime = micros() - time;
}
#endif
#ifdef DEBUG_IMU_SPEED #ifdef DEBUG_IMU_SPEED
debug[0] = micros() - time; // gyro read time debug[0] = micros() - time; // gyro read time
#endif #endif
} }
if (sensors(SENSOR_ACC) && (!imuUpdateSensors == ONLY_GYRO)) { if (sensors(SENSOR_ACC) && (!imuUpdateSensors == ONLY_GYRO)) {
#if defined(NAZE) || defined(DEBUG_IMU_SPEED) #ifdef DEBUG_IMU_SPEED
time = micros(); time = micros();
#endif #endif
qAccProcessingStateMachine(accelerometerTrims); qAccProcessingStateMachine(accelerometerTrims);
#if defined(NAZE)
while (accProcessTime < MAX_ACC_PROCESSING) {
accProcessTime = micros() - time;
}
#endif
} else { } else {
accADC[X] = 0; accADC[X] = 0;
accADC[Y] = 0; accADC[Y] = 0;