Interrupt fixes.

This commit is contained in:
Pete Johanson 2020-07-20 10:27:44 -04:00
parent 893b99d907
commit 331bfa7052
2 changed files with 9 additions and 15 deletions

View file

@ -7,17 +7,14 @@
#include "kyria.dtsi"
/ {
sensors {
encoder: encoder0 {
compatible = "alps,en11";
label = "Rotary Encoder";
a-gpios = <&pro_micro_d 5 GPIO_ACTIVE_HIGH>;
b-gpios = <&pro_micro_d 9 GPIO_ACTIVE_HIGH>;
a-gpios = <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
};
};
};
&kscan0 {
col-gpios
= <&pro_micro_a 3 GPIO_ACTIVE_HIGH>

View file

@ -152,16 +152,15 @@ int en11_init_interrupt(struct device *dev)
struct en11_data *drv_data = dev->driver_data;
const struct en11_config *drv_cfg = dev->config_info;
drv_data->dev = dev;
/* setup gpio interrupt */
LOG_DBG("A: %s %d B: %s %d", drv_cfg->a_label, drv_cfg->a_pin, drv_cfg->b_label, drv_cfg->b_pin);
gpio_pin_configure(drv_data->a, drv_cfg->a_pin,
if (gpio_pin_configure(drv_data->a, drv_cfg->a_pin,
drv_cfg->a_flags
| GPIO_INPUT);
if (gpio_pin_set(drv_data->a, drv_cfg->a_pin, 1)) {
LOG_DBG("Failed to set A active!");
| GPIO_INPUT)) {
LOG_DBG("Failed to configure B pin");
return -EIO;
}
@ -174,12 +173,10 @@ int en11_init_interrupt(struct device *dev)
return -EIO;
}
gpio_pin_configure(drv_data->b, drv_cfg->b_pin,
if (gpio_pin_configure(drv_data->b, drv_cfg->b_pin,
drv_cfg->b_flags
| GPIO_INPUT);
if (gpio_pin_set(drv_data->b, drv_cfg->b_pin, 1)) {
LOG_DBG("Failed to set B active!");
| GPIO_INPUT)) {
LOG_DBG("Failed to configure B pin");
return -EIO;
}