From 26531d85bd34ac724c06a2ac2ace43a5c8b2396f Mon Sep 17 00:00:00 2001 From: "Peter A. Bigot" Date: Sat, 26 Jan 2019 06:27:31 -0600 Subject: [PATCH 1/2] drivers: gpio: esp32: correct constant test for interrupt trigger Interrupts default to trigger on level for historical reasons, so use of GPIO_INT_LEVEL` as a mask results in a zero value. Use a mask macro to isolate the trigger configuration. Signed-off-by: Peter A. Bigot --- drivers/gpio/gpio_esp32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio_esp32.c b/drivers/gpio/gpio_esp32.c index a4a0ead673608..092dcc38a55ce 100644 --- a/drivers/gpio/gpio_esp32.c +++ b/drivers/gpio/gpio_esp32.c @@ -64,7 +64,7 @@ static int convert_int_type(int flags) return 2; /* Defaults to falling edge. */ } - if ((flags & GPIO_INT_LEVEL) == GPIO_INT_LEVEL) { + if ((flags & GPIO_INT_EDGE) == GPIO_INT_LEVEL) { if ((flags & GPIO_INT_ACTIVE_HIGH) == GPIO_INT_ACTIVE_HIGH) { return 5; } From 5b429e56dabdf119f62b28f824b7ba0e837e9f40 Mon Sep 17 00:00:00 2001 From: "Peter A. Bigot" Date: Sat, 26 Jan 2019 06:28:23 -0600 Subject: [PATCH 2/2] tests: gpio: basic_api: correct constant test for interrupt trigger Interrupts default to trigger on level for historical reasons, so use of GPIO_INT_LEVEL` as a mask results in a zero value. Use a mask macro to isolate the trigger configuration. Signed-off-by: Peter A. Bigot --- tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c b/tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c index 70908bae230cf..28c01d941d850 100644 --- a/tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c +++ b/tests/drivers/gpio/gpio_basic_api/src/test_callback_trigger.c @@ -93,7 +93,7 @@ static int test_callback(int mode) goto pass_exit; } - if ((mode & GPIO_INT_LEVEL) == GPIO_INT_LEVEL) { + if ((mode & GPIO_INT_EDGE) == GPIO_INT_LEVEL) { if (cb_cnt != MAX_INT_CNT) { TC_ERROR("not trigger callback correctly\n"); goto err_exit;