Fix boot failure on Flip32+ Deluxe Acro.
The problem was the MPU6050 EXTI handler was not registered due to baro detection taking the only callback handler slot. When the MPU6050 EXTI was configured the interrupt flag was never cleared which results in the CPU being starved.
This commit is contained in:
parent
7f42149c30
commit
6d5b44df7a
|
@ -225,6 +225,13 @@ void configureMPUDataReadyInterruptHandling(void)
|
||||||
gpioExtiLineConfig(mpu6050Config->exti_port_source, mpu6050Config->exti_pin_source);
|
gpioExtiLineConfig(mpu6050Config->exti_port_source, mpu6050Config->exti_pin_source);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef ENSURE_MPU_DATA_READY_IS_LOW
|
||||||
|
uint8_t status = GPIO_ReadInputDataBit(mpu6050Config->gpioPort, mpu6050Config->gpioPin);
|
||||||
|
if (status) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
registerExti15_10_CallbackHandler(MPU_DATA_READY_EXTI_Handler);
|
registerExti15_10_CallbackHandler(MPU_DATA_READY_EXTI_Handler);
|
||||||
|
|
||||||
EXTI_ClearITPendingBit(mpu6050Config->exti_line);
|
EXTI_ClearITPendingBit(mpu6050Config->exti_line);
|
||||||
|
|
|
@ -209,6 +209,7 @@ bool bmp085Detect(const bmp085Config_t *config, baro_t *baro)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unregisterExti15_10_CallbackHandler(BMP085_EOC_EXTI_Handler);
|
||||||
BMP085_OFF;
|
BMP085_OFF;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -44,7 +44,19 @@ void registerExti15_10_CallbackHandler(extiCallbackHandler *fn)
|
||||||
extiCallbackHandler *candidate = exti15_10_handlers[index];
|
extiCallbackHandler *candidate = exti15_10_handlers[index];
|
||||||
if (!candidate) {
|
if (!candidate) {
|
||||||
exti15_10_handlers[index] = fn;
|
exti15_10_handlers[index] = fn;
|
||||||
break;
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
failureMode(15); // EXTI15_10_CALLBACK_HANDLER_COUNT is too low for the amount of handlers required.
|
||||||
|
}
|
||||||
|
|
||||||
|
void unregisterExti15_10_CallbackHandler(extiCallbackHandler *fn)
|
||||||
|
{
|
||||||
|
for (int index = 0; index < EXTI15_10_CALLBACK_HANDLER_COUNT; index++) {
|
||||||
|
extiCallbackHandler *candidate = exti15_10_handlers[index];
|
||||||
|
if (candidate == fn) {
|
||||||
|
exti15_10_handlers[index] = 0;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,3 +39,4 @@ extern uint32_t hse_value;
|
||||||
typedef void extiCallbackHandler(void);
|
typedef void extiCallbackHandler(void);
|
||||||
|
|
||||||
void registerExti15_10_CallbackHandler(extiCallbackHandler *fn);
|
void registerExti15_10_CallbackHandler(extiCallbackHandler *fn);
|
||||||
|
void unregisterExti15_10_CallbackHandler(extiCallbackHandler *fn);
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#define LED1_PIN Pin_4 // PB4 (LED)
|
#define LED1_PIN Pin_4 // PB4 (LED)
|
||||||
#define LED1_PERIPHERAL RCC_APB2Periph_GPIOB
|
#define LED1_PERIPHERAL RCC_APB2Periph_GPIOB
|
||||||
|
|
||||||
|
|
||||||
#define BEEP_GPIO GPIOA
|
#define BEEP_GPIO GPIOA
|
||||||
#define BEEP_PIN Pin_12 // PA12 (Beeper)
|
#define BEEP_PIN Pin_12 // PA12 (Beeper)
|
||||||
#define BEEP_PERIPHERAL RCC_APB2Periph_GPIOA
|
#define BEEP_PERIPHERAL RCC_APB2Periph_GPIOA
|
||||||
|
@ -71,6 +70,7 @@
|
||||||
|
|
||||||
#define USE_FLASH_M25P16
|
#define USE_FLASH_M25P16
|
||||||
|
|
||||||
|
#define EXTI15_10_CALLBACK_HANDLER_COUNT 2 // MPU data ready and BMP085 EOC
|
||||||
#define USE_MPU_DATA_READY_SIGNAL
|
#define USE_MPU_DATA_READY_SIGNAL
|
||||||
|
|
||||||
#define GYRO
|
#define GYRO
|
||||||
|
|
Loading…
Reference in New Issue