Browse Source

Interrupt fixes.

xmkb
Pete Johanson 4 years ago
parent
commit
331bfa7052
  1. 7
      app/boards/shields/kyria/kyria_left.overlay
  2. 17
      app/drivers/zephyr/en11_trigger.c

7
app/boards/shields/kyria/kyria_left.overlay

@ -7,17 +7,14 @@ @@ -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>

17
app/drivers/zephyr/en11_trigger.c

@ -152,16 +152,15 @@ int en11_init_interrupt(struct device *dev) @@ -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) @@ -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;
}

Loading…
Cancel
Save