Skip to content

Commit 28495bb

Browse files
committed
M2351: Refine gpio_irq_set(...) with inconsistent GPIO_EnableInt(...) implementations
No logic change
1 parent 582c08c commit 28495bb

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

targets/TARGET_NUVOTON/TARGET_M2351/gpio_irq_api.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,13 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable)
182182
obj->irq_types &= ~irq_type;
183183
}
184184

185-
/* Update irq types */
185+
/* Update irq types:
186+
*
187+
* Implementations of GPIO_EnableInt(...) are inconsistent: disable or not irq type not enabled.
188+
* For consistency, disable GPIO_INT_BOTH_EDGE and then enable OR'ed irq types, GPIO_INT_RISING,
189+
* GPIO_INT_FALLING, or both.
190+
*/
191+
GPIO_DisableInt(gpio_base, pin_index);
186192
GPIO_EnableInt(gpio_base, pin_index, obj->irq_types);
187193
}
188194

0 commit comments

Comments
 (0)