diff options
author | Pete Johanson <peter@peterjohanson.com> | 2020-10-26 00:30:24 -0400 |
---|---|---|
committer | Pete Johanson <peter@peterjohanson.com> | 2020-11-05 14:55:40 -0500 |
commit | eff1b8223b5010d526914530c5d1d469eff356df (patch) | |
tree | 70a7d7c603d0c384110fec9bc4b5dd7b01896a7f /app/src/hid.c | |
parent | 5f83568a93bbbf07bed6e710ba8c44e45b955ec5 (diff) |
refactor(keys): Unify usage page.
* Remove need for separate `&cp` behavior, but
keep it for now for backward compat.
* Refactor sensor inc/dec as well.
Diffstat (limited to 'app/src/hid.c')
-rw-r--r-- | app/src/hid.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/src/hid.c b/app/src/hid.c index aeb1a55..7e733d9 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -9,6 +9,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL); #include <zmk/hid.h> #include <dt-bindings/zmk/modifiers.h> +#include <dt-bindings/zmk/hid_usage_pages.h> static struct zmk_hid_keypad_report kp_report = { .report_id = 1, .body = {.modifiers = 0, ._reserved = 0, .keys = {0}}}; @@ -78,16 +79,16 @@ int zmk_hid_implicit_modifiers_release() { } int zmk_hid_keypad_press(zmk_key code) { - if (code >= LEFT_CONTROL && code <= RIGHT_GUI) { - return zmk_hid_register_mod(code - LEFT_CONTROL); + if (code >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL && code <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI) { + return zmk_hid_register_mod(code - HID_USAGE_KEY_KEYBOARD_LEFTCONTROL); } TOGGLE_KEYPAD(0U, code); return 0; }; int zmk_hid_keypad_release(zmk_key code) { - if (code >= LEFT_CONTROL && code <= RIGHT_GUI) { - return zmk_hid_unregister_mod(code - LEFT_CONTROL); + if (code >= HID_USAGE_KEY_KEYBOARD_LEFTCONTROL && code <= HID_USAGE_KEY_KEYBOARD_RIGHT_GUI) { + return zmk_hid_unregister_mod(code - HID_USAGE_KEY_KEYBOARD_LEFTCONTROL); } TOGGLE_KEYPAD(code, 0U); return 0; |