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.
This commit is contained in:
innovaker 2020-10-25 11:32:28 +00:00 committed by Pete Johanson
parent a65295c2a7
commit d748d8a749
3 changed files with 8 additions and 7 deletions

View file

@ -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) { 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) { static int keycode_state_changed_listener(const struct zmk_event_header *eh) {

View file

@ -572,11 +572,11 @@ bool zmk_ble_handle_key_user(struct zmk_key_event *key_event) {
return true; return true;
} }
if (key < NUM_1 || key > NUM_0) { if (key < NUMBER_1 || key > NUMBER_0) {
return true; 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; passkey_entries[passkey_digit++] = val;

View file

@ -78,16 +78,16 @@ int zmk_hid_implicit_modifiers_release() {
} }
int zmk_hid_keypad_press(zmk_key code) { int zmk_hid_keypad_press(zmk_key code) {
if (code >= LCTL && code <= RGUI) { if (code >= LEFT_CONTROL && code <= RIGHT_GUI) {
return zmk_hid_register_mod(code - LCTL); return zmk_hid_register_mod(code - LEFT_CONTROL);
} }
TOGGLE_KEYPAD(0U, code); TOGGLE_KEYPAD(0U, code);
return 0; return 0;
}; };
int zmk_hid_keypad_release(zmk_key code) { int zmk_hid_keypad_release(zmk_key code) {
if (code >= LCTL && code <= RGUI) { if (code >= LEFT_CONTROL && code <= RIGHT_GUI) {
return zmk_hid_unregister_mod(code - LCTL); return zmk_hid_unregister_mod(code - LEFT_CONTROL);
} }
TOGGLE_KEYPAD(code, 0U); TOGGLE_KEYPAD(code, 0U);
return 0; return 0;