Prevent EXTI handler from crashing when EXTI lines 16-32 are us… (#9311)

Prevent EXTI handler from crashing when EXTI lines 16-32 are used.
This commit is contained in:
Michael Keller 2019-12-26 12:49:04 +13:00 committed by GitHub
commit e3c9cea554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

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);