diff options
author | fauxpark <fauxpark@gmail.com> | 2019-02-15 15:07:13 +1100 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-02-14 20:07:13 -0800 |
commit | 9e4ac6cf29e6b2ce950135c8f877c95f2d1f1d55 (patch) | |
tree | df6cfe88ce0f51ea5ca7fd6b93aae7eaed67d8a5 /keyboards/mechmini/v2 | |
parent | d5bc7fc1575543eb27cffcc465a8f0c4e11b7de7 (diff) | |
download | qmk_firmware-9e4ac6cf29e6b2ce950135c8f877c95f2d1f1d55.tar.gz qmk_firmware-9e4ac6cf29e6b2ce950135c8f877c95f2d1f1d55.zip |
Migrate fn_actions for default keymaps (#4935)
* Migrate fn_actions for default keymaps
* Rename the Grave/Escape Shift masks
* No need for shift_esc_shift_mask
* Change breaks to return false
* Right align pointers
* Add default case
* Separate cases with empty lines
Diffstat (limited to 'keyboards/mechmini/v2')
-rwxr-xr-x | keyboards/mechmini/v2/keymaps/default/keymap.c | 38 |
1 files changed, 16 insertions, 22 deletions
diff --git a/keyboards/mechmini/v2/keymaps/default/keymap.c b/keyboards/mechmini/v2/keymaps/default/keymap.c index e35f25ee40..23f61f9184 100755 --- a/keyboards/mechmini/v2/keymaps/default/keymap.c +++ b/keyboards/mechmini/v2/keymaps/default/keymap.c @@ -4,11 +4,15 @@ #define _FN1 1 #define _FN2 2 -#define MODS_CTRL_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) +enum custom_keycodes { + SFT_ESC +}; + +#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_BL] = LAYOUT_split_space( - F(0), KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + SFT_ESC,KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_ENT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_RSFT, KC_DOT, KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_SPC, KC_RCTL, MO(1), MO(2)), @@ -42,10 +46,6 @@ void matrix_init_user(void) { void matrix_scan_user(void) { } -bool process_record_user(uint16_t keycode, keyrecord_t *record) { - return true; -} - void led_set_user(uint8_t usb_led) { if (usb_led & (1 << USB_LED_NUM_LOCK)) { @@ -80,21 +80,11 @@ void led_set_user(uint8_t usb_led) { } -enum function_id { - SHIFT_ESC, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(SHIFT_ESC), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case SHIFT_ESC: - shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK; +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case SFT_ESC: if (record->event.pressed) { - if (shift_esc_shift_mask) { + if (get_mods() & MODS_SHIFT_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -102,7 +92,7 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } else { - if (shift_esc_shift_mask) { + if (get_mods() & MODS_SHIFT_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -110,6 +100,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } |