refactor: Handle HID macro/API changes in Zephyr.

This commit is contained in:
Peter Johanson
2021-11-05 04:14:44 +00:00
committed by Pete Johanson
parent 53dae35710
commit 40d8470664
6 changed files with 444 additions and 527 deletions

View File

@@ -162,8 +162,8 @@ static int behavior_caps_word_init(const struct device *dev) {
#define CAPS_WORD_LABEL(i, _n) DT_INST_LABEL(i)
#define PARSE_BREAK(i) \
{.page = (HID_USAGE_PAGE(i) & 0xFF), \
.id = HID_USAGE_ID(i), \
{.page = (ZMK_HID_USAGE_PAGE(i) & 0xFF), \
.id = ZMK_HID_USAGE_ID(i), \
.implicit_modifiers = SELECT_MODS(i)},
#define BREAK_ITEM(i, n) PARSE_BREAK(DT_INST_PROP_BY_IDX(n, continue_list, i))

View File

@@ -198,8 +198,8 @@ static int sticky_key_keycode_state_changed_listener(const zmk_event_t *eh) {
}
if (strcmp(sticky_key->config->behavior.behavior_dev, "KEY_PRESS") == 0 &&
HID_USAGE_ID(sticky_key->param1) == ev->keycode &&
(HID_USAGE_PAGE(sticky_key->param1) & 0xFF) == ev->usage_page &&
ZMK_HID_USAGE_ID(sticky_key->param1) == ev->keycode &&
(ZMK_HID_USAGE_PAGE(sticky_key->param1) & 0xFF) == ev->usage_page &&
SELECT_MODS(sticky_key->param1) == ev->implicit_modifiers) {
// don't catch key down events generated by the sticky key behavior itself
continue;