summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Rascher <jon@bcat.name>2021-10-06 21:53:39 -0500
committerPete Johanson <peter@peterjohanson.com>2021-10-20 23:36:31 -0400
commite3eb77dfc6c48b3f8bcf72101973d6342d6fc3f4 (patch)
tree3dd559fc211eca0bced71c59c01e6a59ecd489eb
parent503bb0ec2f91ee6c500cc688e04a339184dd9a3a (diff)
refactor(combos): Use ZMK_KEYMAP_EXTRACT_BINDING
Now that PR #506 is merged, we can address this TODO.
-rw-r--r--app/src/combo.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/app/src/combo.c b/app/src/combo.c
index 16091cd..bcdaac0 100644
--- a/app/src/combo.c
+++ b/app/src/combo.c
@@ -469,22 +469,12 @@ static int position_state_changed_listener(const zmk_event_t *ev) {
ZMK_LISTENER(combo, position_state_changed_listener);
ZMK_SUBSCRIPTION(combo, zmk_position_state_changed);
-// todo: remove this once #506 is merged and #include <zmk/keymap.h>
-#define KEY_BINDING_TO_STRUCT(idx, drv_inst) \
- { \
- .behavior_dev = DT_LABEL(DT_PHANDLE_BY_IDX(drv_inst, bindings, idx)), \
- .param1 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(drv_inst, bindings, idx, param1), (0), \
- (DT_PHA_BY_IDX(drv_inst, bindings, idx, param1))), \
- .param2 = COND_CODE_0(DT_PHA_HAS_CELL_AT_IDX(drv_inst, bindings, idx, param2), (0), \
- (DT_PHA_BY_IDX(drv_inst, bindings, idx, param2))), \
- }
-
#define COMBO_INST(n) \
static struct combo_cfg combo_config_##n = { \
.timeout_ms = DT_PROP(n, timeout_ms), \
.key_positions = DT_PROP(n, key_positions), \
.key_position_len = DT_PROP_LEN(n, key_positions), \
- .behavior = KEY_BINDING_TO_STRUCT(0, n), \
+ .behavior = ZMK_KEYMAP_EXTRACT_BINDING(0, n), \
.virtual_key_position = ZMK_KEYMAP_LEN + __COUNTER__, \
.slow_release = DT_PROP(n, slow_release), \
.layers = DT_PROP(n, layers), \