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

Prevent EXTI handler from crashing when EXTI lines 16-32 are used.

Refer to "EXTI Event Input mapping" table in MCU reference manuals.
This commit is contained in:
Dominic Clifton 2019-12-24 21:05:02 +01:00
parent 4c58889915
commit 38ffacf80e

View file

@ -229,9 +229,11 @@ void EXTIEnable(IO_t io, bool enable)
#endif
}
#define EXTI_EVENT_MASK 0xFFFF // first 16 bits only, see also definition of extiChannelRecs.
void EXTI_IRQHandler(void)
{
uint32_t exti_active = EXTI_REG_IMR & EXTI_REG_PR;
uint32_t exti_active = (EXTI_REG_IMR & EXTI_REG_PR) & EXTI_EVENT_MASK;
while (exti_active) {
unsigned idx = 31 - __builtin_clz(exti_active);