diff options
Diffstat (limited to 'app/drivers/zephyr')
-rw-r--r-- | app/drivers/zephyr/Kconfig | 5 | ||||
-rw-r--r-- | app/drivers/zephyr/ec11_trigger.c | 2 | ||||
-rw-r--r-- | app/drivers/zephyr/kscan_gpio_direct.c | 4 | ||||
-rw-r--r-- | app/drivers/zephyr/kscan_gpio_matrix.c | 12 |
4 files changed, 16 insertions, 7 deletions
diff --git a/app/drivers/zephyr/Kconfig b/app/drivers/zephyr/Kconfig index b22c4b1..0237846 100644 --- a/app/drivers/zephyr/Kconfig +++ b/app/drivers/zephyr/Kconfig @@ -25,7 +25,7 @@ menuconfig EC11 if EC11 -choice EC11_TRIGGER +choice prompt "Trigger mode" default EC11_TRIGGER_NONE help @@ -46,6 +46,9 @@ config EC11_TRIGGER_OWN_THREAD endchoice +config EC11_TRIGGER + bool + config EC11_THREAD_PRIORITY int "Thread priority" depends on EC11_TRIGGER_OWN_THREAD diff --git a/app/drivers/zephyr/ec11_trigger.c b/app/drivers/zephyr/ec11_trigger.c index 55acf45..709d1fb 100644 --- a/app/drivers/zephyr/ec11_trigger.c +++ b/app/drivers/zephyr/ec11_trigger.c @@ -1,7 +1,7 @@ /* * Copyright (c) 2016 Intel Corporation * - * SPDX-License-Identifier: Apache-2.0 + * SPDX-License-Identifier: MIT */ #define DT_DRV_COMPAT alps_ec11 diff --git a/app/drivers/zephyr/kscan_gpio_direct.c b/app/drivers/zephyr/kscan_gpio_direct.c index 6e0beb0..a3aa8c4 100644 --- a/app/drivers/zephyr/kscan_gpio_direct.c +++ b/app/drivers/zephyr/kscan_gpio_direct.c @@ -156,7 +156,6 @@ static int kscan_gpio_read(struct device *dev) struct kscan_gpio_data *data = dev->driver_data; const struct kscan_gpio_config *cfg = dev->config_info; u32_t read_state = data->pin_state; - LOG_DBG("Scanning the pins for updated state"); for (int i = 0; i < cfg->num_of_inputs; i++) { struct device *in_dev = kscan_gpio_input_devices(dev)[i]; @@ -165,8 +164,9 @@ static int kscan_gpio_read(struct device *dev) } for (int i = 0; i < cfg->num_of_inputs; i++) { + bool prev_pressed = BIT(i) & data->pin_state; bool pressed = BIT(i) & read_state; - if (pressed != (BIT(i) & data->pin_state)) + if (pressed != prev_pressed) { LOG_DBG("Sending event at %d,%d state %s", 0, i, (pressed ? "on" : "off")); diff --git a/app/drivers/zephyr/kscan_gpio_matrix.c b/app/drivers/zephyr/kscan_gpio_matrix.c index 8e27712..b19c492 100644 --- a/app/drivers/zephyr/kscan_gpio_matrix.c +++ b/app/drivers/zephyr/kscan_gpio_matrix.c @@ -171,7 +171,7 @@ static int kscan_gpio_config_interrupts(struct device **devices, ({ k_work_submit(&data->work); }), \ ({ \ k_delayed_work_cancel(&data->work); \ - k_delayed_work_submit(&data->work, K_MSEC(1)); })) \ + k_delayed_work_submit(&data->work, K_MSEC(5)); })) \ } \ return 0; \ } \ @@ -205,7 +205,13 @@ static int kscan_gpio_config_interrupts(struct device **devices, } \ data->callback = callback; \ return 0; \ - } \ + }; \ + static int kscan_gpio_enable_##n(struct device *dev) \ + { \ + int err = kscan_gpio_enable_interrupts_##n(dev); \ + if (err) { return err; } \ + return kscan_gpio_read_##n(dev); \ + }; \ static int kscan_gpio_init_##n(struct device *dev) \ { \ struct kscan_gpio_data_##n *data = dev->driver_data; \ @@ -258,7 +264,7 @@ static int kscan_gpio_config_interrupts(struct device **devices, } \ static const struct kscan_driver_api gpio_driver_api_##n = { \ .config = kscan_gpio_configure_##n, \ - .enable_callback = kscan_gpio_enable_interrupts_##n, \ + .enable_callback = kscan_gpio_enable_##n, \ .disable_callback = kscan_gpio_disable_interrupts_##n, \ }; \ static const struct kscan_gpio_config_##n kscan_gpio_config_##n = { \ |