From 903ad462baf2daf334314124b303363cf7b493e9 Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Fri, 24 Nov 2023 19:30:29 +0000 Subject: [PATCH] fix(kscan): Proper pull flag detection for inputs. * Check against `GPIO_ACTIVE_LOW` properly which has a non-zero value. --- app/module/drivers/kscan/kscan_gpio_charlieplex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/module/drivers/kscan/kscan_gpio_charlieplex.c b/app/module/drivers/kscan/kscan_gpio_charlieplex.c index 806455d6..f450af2b 100644 --- a/app/module/drivers/kscan/kscan_gpio_charlieplex.c +++ b/app/module/drivers/kscan/kscan_gpio_charlieplex.c @@ -110,7 +110,8 @@ static int kscan_charlieplex_set_as_input(const struct gpio_dt_spec *gpio) { return -ENODEV; } - gpio_flags_t pull_flag = (gpio->dt_flags & GPIO_ACTIVE_HIGH) ? GPIO_PULL_DOWN : GPIO_PULL_UP; + gpio_flags_t pull_flag = + ((gpio->dt_flags & GPIO_ACTIVE_LOW) == GPIO_ACTIVE_LOW) ? GPIO_PULL_UP : GPIO_PULL_DOWN; int err = gpio_pin_configure_dt(gpio, GPIO_INPUT | pull_flag); if (err) {