Skip to content

Commit

Permalink
[stm32] Fix spurious EXTI interrupt with shared IRQ
Browse files Browse the repository at this point in the history
In case of multiple event lines with a shared IRQ all enabled handlers
were always called even when the respective event was not triggered.
  • Loading branch information
chris-durand committed Jul 20, 2023
1 parent 6fc0009 commit 368677b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modm/platform/extint/stm32/exti.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ Exti::handlers[Exti::Lines] modm_fastdata;
void Exti::irq(uint32_t mask)
{
uint32_t flags = EXTI->IMR{{"1" if (extended or separate_flags) else ""}} & mask;
%% if separate_flags
flags &= (EXTI->FPR1 & EXTI->FTSR1) | (EXTI->RPR1 & EXTI->RTSR1);
%% else
flags &= EXTI->PR{{"1" if extended else ""}};
%% endif
while(flags)
{
const uint8_t lmb = 31ul - __builtin_clz(flags);
Expand Down

0 comments on commit 368677b

Please sign in to comment.