summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJay Greco <jayv.greco@gmail.com>2020-10-27 09:39:30 -0700
committerJay Greco <jayv.greco@gmail.com>2020-10-27 12:44:59 -0700
commit8a98212a02a3a6304a1f275450264f46a60d011b (patch)
treebc411639d9d4ad197ee6ce6976051356c82fa148 /app
parent1a6fe846e4c1eb211c838f1e9635ca29d85d8341 (diff)
Update demux kscan driver as per PR feedback
- Remove kscan_gpio_irq_callback - Remove kscan_gpio_irq_callback_handler - Remove irq_callbacks + Add TODO noting timer and sleep state interactions
Diffstat (limited to 'app')
-rw-r--r--app/drivers/zephyr/kscan_gpio_demux.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/app/drivers/zephyr/kscan_gpio_demux.c b/app/drivers/zephyr/kscan_gpio_demux.c
index 98c04e6..6113d7c 100644
--- a/app/drivers/zephyr/kscan_gpio_demux.c
+++ b/app/drivers/zephyr/kscan_gpio_demux.c
@@ -52,8 +52,6 @@ struct kscan_gpio_item_config {
struct device *dev; \
}; \
\
- static struct kscan_gpio_irq_callback_##n irq_callbacks_##n[INST_MATRIX_INPUTS(n)]; \
- \
struct kscan_gpio_config_##n { \
struct kscan_gpio_item_config rows[INST_MATRIX_INPUTS(n)]; \
struct kscan_gpio_item_config cols[INST_DEMUX_GPIOS(n)]; \
@@ -149,17 +147,6 @@ struct kscan_gpio_item_config {
kscan_gpio_read_##n(data->dev); \
} \
\
- static void kscan_gpio_irq_callback_handler_##n(struct device *dev, struct gpio_callback *cb, \
- gpio_port_pins_t pin) { \
- struct kscan_gpio_irq_callback_##n *data = \
- CONTAINER_OF(cb, struct kscan_gpio_irq_callback_##n, callback); \
- CHECK_DEBOUNCE_CFG(n, ({ k_work_submit(data->work); }), ({ \
- k_delayed_work_cancel(data->work); \
- k_delayed_work_submit(data->work, \
- K_MSEC(DT_INST_PROP(n, debounce_period))); \
- })) \
- } \
- \
static struct kscan_gpio_data_##n kscan_gpio_data_##n = { \
.rows = {[INST_MATRIX_INPUTS(n) - 1] = NULL}, .cols = {[INST_DEMUX_GPIOS(n) - 1] = NULL}}; \
\
@@ -179,6 +166,8 @@ struct kscan_gpio_item_config {
static int kscan_gpio_enable_##n(struct device *dev) { \
LOG_DBG("KSCAN API enable"); \
struct kscan_gpio_data_##n *data = dev->driver_data; \
+ /* TODO: we might want a follow up to hook into the sleep state hooks in Zephyr, */ \
+ /* and disable this timer when we enter a sleep state */ \
k_timer_start(&data->poll_timer, K_MSEC(POLL_INTERVAL(n)), K_MSEC(POLL_INTERVAL(n))); \
return 0; \
}; \
@@ -212,11 +201,6 @@ struct kscan_gpio_item_config {
} else { \
LOG_DBG("Configured pin %d on %s for input", in_cfg->pin, in_cfg->label); \
} \
- irq_callbacks_##n[i].work = &data->work; \
- irq_callbacks_##n[i].dev = dev; \
- gpio_init_callback(&irq_callbacks_##n[i].callback, \
- kscan_gpio_irq_callback_handler_##n, BIT(in_cfg->pin)); \
- err = gpio_add_callback(input_devices[i], &irq_callbacks_##n[i].callback); \
if (err) { \
LOG_ERR("Error adding the callback to the column device"); \
return err; \