fix(kscan): Proper pull flag detection for inputs.

* Check against `GPIO_ACTIVE_LOW` properly which has a non-zero
  value.
This commit is contained in:
Peter Johanson 2023-11-24 19:30:29 +00:00
parent 32e7ac4782
commit 903ad462ba

View file

@ -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) {