Skip to content

Commit

Permalink
fix(kscan): Proper pull flag detection for inputs.
Browse files Browse the repository at this point in the history
* Check against `GPIO_ACTIVE_LOW` properly which has a non-zero
  value.
  • Loading branch information
petejohanson committed Nov 24, 2023
1 parent 4f7baf1 commit f9ffa17
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/module/drivers/kscan/kscan_gpio_charlieplex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit f9ffa17

Please sign in to comment.