Browse Source

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.
xmkb
innovaker 4 years ago committed by Pete Johanson
parent
commit
d748d8a749
  1. 3
      app/src/behaviors/behavior_hold_tap.c
  2. 4
      app/src/ble.c
  3. 8
      app/src/hid.c

3
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) { 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) {

4
app/src/ble.c

@ -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;

8
app/src/hid.c

@ -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;

Loading…
Cancel
Save