From d748d8a7496ea436a7e643245dbefb7b9c99d0cb Mon Sep 17 00:00:00 2001 From: innovaker <66737976+innovaker@users.noreply.github.com> Date: Sun, 25 Oct 2020 11:32:28 +0000 Subject: [PATCH] refactor: Replace superseded key names Replace deprecated key names (LCTL, NUM_0, NUM_1). Replace abbreviated names with fully qualified names (LCTL, RGUI, NUM_0, NUM_1). Follow-up to #21. --- app/src/behaviors/behavior_hold_tap.c | 3 ++- app/src/ble.c | 4 ++-- app/src/hid.c | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/behaviors/behavior_hold_tap.c b/app/src/behaviors/behavior_hold_tap.c index d1901489..c53750a8 100644 --- a/app/src/behaviors/behavior_hold_tap.c +++ b/app/src/behaviors/behavior_hold_tap.c @@ -429,7 +429,8 @@ static int position_state_changed_listener(const struct zmk_event_header *eh) { } static inline bool only_mods(struct keycode_state_changed *ev) { - return ev->usage_page == HID_USAGE_KEY && ev->keycode >= LCTL && ev->keycode <= RGUI; + return ev->usage_page == HID_USAGE_KEY && ev->keycode >= LEFT_CONTROL && + ev->keycode <= RIGHT_GUI; } static int keycode_state_changed_listener(const struct zmk_event_header *eh) { diff --git a/app/src/ble.c b/app/src/ble.c index f3962ae0..1ab61d0c 100644 --- a/app/src/ble.c +++ b/app/src/ble.c @@ -572,11 +572,11 @@ bool zmk_ble_handle_key_user(struct zmk_key_event *key_event) { return true; } - if (key < NUM_1 || key > NUM_0) { + if (key < NUMBER_1 || key > NUMBER_0) { return true; } - u32_t val = (key == NUM_0) ? 0 : (key - NUM_1 + 1); + u32_t val = (key == NUMBER_0) ? 0 : (key - NUMBER_1 + 1); passkey_entries[passkey_digit++] = val; diff --git a/app/src/hid.c b/app/src/hid.c index 1925765c..aeb1a553 100644 --- a/app/src/hid.c +++ b/app/src/hid.c @@ -78,16 +78,16 @@ int zmk_hid_implicit_modifiers_release() { } int zmk_hid_keypad_press(zmk_key code) { - if (code >= LCTL && code <= RGUI) { - return zmk_hid_register_mod(code - LCTL); + if (code >= LEFT_CONTROL && code <= RIGHT_GUI) { + return zmk_hid_register_mod(code - LEFT_CONTROL); } TOGGLE_KEYPAD(0U, code); return 0; }; int zmk_hid_keypad_release(zmk_key code) { - if (code >= LCTL && code <= RGUI) { - return zmk_hid_unregister_mod(code - LCTL); + if (code >= LEFT_CONTROL && code <= RIGHT_GUI) { + return zmk_hid_unregister_mod(code - LEFT_CONTROL); } TOGGLE_KEYPAD(code, 0U); return 0;