Skip to content

Commit aa501c0

Browse files
committed
Shared PORT interrupt - check improved
- clocks must be enabled and also interrupt detected, otherwise interrupt handler is not invoked.
1 parent dc19dcb commit aa501c0

File tree

1 file changed

+6
-3
lines changed
  • libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL46Z

1 file changed

+6
-3
lines changed

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_irq_api.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,13 @@ void gpio_irqA(void) {
7373
handle_interrupt_in(PORTA, 0);
7474
}
7575

76+
/* PORTC and PORTD share same vector */
7677
void gpio_irqCD(void) {
77-
/* PORTC and PORTD share same vector */
78-
handle_interrupt_in(PORTC, 32);
79-
handle_interrupt_in(PORTD, 64);
78+
if ((SIM->SCGC5 & SIM_SCGC5_PORTC_MASK) && (PORTC->ISFR)) {
79+
handle_interrupt_in(PORTC, 32);
80+
} else if ((SIM->SCGC5 & SIM_SCGC5_PORTD_MASK) && (PORTD->ISFR)) {
81+
handle_interrupt_in(PORTD, 64);
82+
}
8083
}
8184

8285
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {

0 commit comments

Comments
 (0)