Skip to content

Commit cea9130

Browse files
committed
STM32: Raise error in case of spurious interrupt
In case we've run through the entire GPIOs loop, withouth finding a matching interrupt, we're in the case of a spurious interrupt, let's raise an error to track it down.
1 parent ade981d commit cea9130

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

targets/TARGET_STM/gpio_irq_api.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,18 +90,21 @@ static void handle_interrupt_in(uint32_t irq_index, uint32_t max_num_pin_line)
9090
if (__HAL_GPIO_EXTI_GET_FLAG(pin) != RESET) {
9191
__HAL_GPIO_EXTI_CLEAR_FLAG(pin);
9292

93-
if (gpio_channel->channel_ids[gpio_idx] == 0)
93+
if (gpio_channel->channel_ids[gpio_idx] == 0) {
9494
continue;
95+
}
9596

9697
// Check which edge has generated the irq
9798
if ((gpio->IDR & pin) == 0) {
9899
irq_handler(gpio_channel->channel_ids[gpio_idx], IRQ_FALL);
99100
} else {
100101
irq_handler(gpio_channel->channel_ids[gpio_idx], IRQ_RISE);
101102
}
103+
return;
102104
}
103105
}
104106
}
107+
error("Unexpected Spurious interrupt, index %d\r\n", irq_index);
105108
}
106109

107110

0 commit comments

Comments
 (0)