forked from kofal.net/zmk
refactor: Move to k_work_delayable API.
* Move to new `k_work_delayable` APIs introduced in Zephyr 2.6. See: https://docs.zephyrproject.org/latest/releases/release-notes-2.6.html#api-changes
This commit is contained in:
committed by
Pete Johanson
parent
28ef19488d
commit
53dae35710
@@ -22,7 +22,7 @@ struct kscan_gpio_item_config {
|
||||
};
|
||||
|
||||
union work_reference {
|
||||
struct k_delayed_work delayed;
|
||||
struct k_work_delayable delayed;
|
||||
struct k_work direct;
|
||||
};
|
||||
|
||||
@@ -55,8 +55,7 @@ static const struct kscan_gpio_item_config *kscan_gpio_input_configs(const struc
|
||||
|
||||
static void kscan_gpio_direct_queue_read(union work_reference *work, uint8_t debounce_period) {
|
||||
if (debounce_period > 0) {
|
||||
k_delayed_work_cancel(&work->delayed);
|
||||
k_delayed_work_submit(&work->delayed, K_MSEC(debounce_period));
|
||||
k_work_reschedule(&work->delayed, K_MSEC(debounce_period));
|
||||
} else {
|
||||
k_work_submit(&work->direct);
|
||||
}
|
||||
@@ -228,7 +227,7 @@ static const struct kscan_driver_api gpio_driver_api = {
|
||||
COND_CODE_1(IS_ENABLED(CONFIG_ZMK_KSCAN_DIRECT_POLLING), \
|
||||
(k_timer_init(&data->poll_timer, kscan_gpio_timer_handler, NULL);), ()) \
|
||||
if (cfg->debounce_period > 0) { \
|
||||
k_delayed_work_init(&data->work.delayed, kscan_gpio_work_handler); \
|
||||
k_work_init_delayable(&data->work.delayed, kscan_gpio_work_handler); \
|
||||
} else { \
|
||||
k_work_init(&data->work.direct, kscan_gpio_work_handler); \
|
||||
} \
|
||||
|
||||
Reference in New Issue
Block a user