drivers: gpio: stm32: Implement enable/disable pin interrupt

Implement the GPIO_INT_MODE_ENABLE_ONLY and GPIO_INT_MODE_DISABLE_ONLY
on stm32 GPIO driver.

Signed-off-by: Sung-Chi Li <lschyi@google.com>
This commit is contained in:
Sung-Chi Li 2023-02-01 16:07:06 +08:00 committed by Christopher Friedt
parent 1f7b0c440d
commit ab77ce0cb8

View file

@ -590,6 +590,16 @@ static int gpio_stm32_pin_interrupt_configure(const struct device *dev,
int edge = 0;
int err = 0;
#ifdef CONFIG_GPIO_ENABLE_DISABLE_INTERRUPT
if (mode == GPIO_INT_MODE_DISABLE_ONLY) {
stm32_exti_disable(pin);
goto exit;
} else if (mode == GPIO_INT_MODE_ENABLE_ONLY) {
stm32_exti_enable(pin);
goto exit;
}
#endif /* CONFIG_GPIO_ENABLE_DISABLE_INTERRUPT */
if (mode == GPIO_INT_MODE_DISABLED) {
if (gpio_stm32_get_exti_source(pin) == cfg->port) {
stm32_exti_disable(pin);