summaryrefslogtreecommitdiff
path: root/app/drivers/zephyr/ec11.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/drivers/zephyr/ec11.c')
-rw-r--r--app/drivers/zephyr/ec11.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/app/drivers/zephyr/ec11.c b/app/drivers/zephyr/ec11.c
index 74c8f9b..9d724d5 100644
--- a/app/drivers/zephyr/ec11.c
+++ b/app/drivers/zephyr/ec11.c
@@ -92,7 +92,7 @@ int ec11_init(struct device *dev)
struct ec11_data *drv_data = dev->driver_data;
const struct ec11_config *drv_cfg = dev->config_info;
- LOG_DBG("resolution %d", drv_cfg->resolution);
+ LOG_DBG("A: %s %d B: %s %d resolution %d", drv_cfg->a_label, drv_cfg->a_pin, drv_cfg->b_label, drv_cfg->b_pin, drv_cfg->resolution);
drv_data->a = device_get_binding(drv_cfg->a_label);
if (drv_data->a == NULL) {
@@ -106,6 +106,22 @@ int ec11_init(struct device *dev)
return -EINVAL;
}
+ if (gpio_pin_configure(drv_data->a, drv_cfg->a_pin,
+ drv_cfg->a_flags
+ | GPIO_INPUT)) {
+ LOG_DBG("Failed to configure A pin");
+ return -EIO;
+ }
+
+ if (gpio_pin_configure(drv_data->b, drv_cfg->b_pin,
+ drv_cfg->b_flags
+ | GPIO_INPUT)) {
+ LOG_DBG("Failed to configure B pin");
+ return -EIO;
+ }
+
+
+
#ifdef CONFIG_EC11_TRIGGER
if (ec11_init_interrupt(dev) < 0) {
LOG_DBG("Failed to initialize interrupt!");