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

17
app/drivers/zephyr/en11_trigger.c

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

Loading…
Cancel
Save