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/kona_classic/keymaps | |
parent | d5bc7fc1575543eb27cffcc465a8f0c4e11b7de7 (diff) |
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/kona_classic/keymaps')
-rw-r--r-- | keyboards/kona_classic/keymaps/ansi/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/ansi_arrows/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/ansi_arrows_lcap/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/ansi_split/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/ansi_split_arrows/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/default/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/iso/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/iso_arrows/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/iso_split/keymap.c | 38 | ||||
-rw-r--r-- | keyboards/kona_classic/keymaps/iso_split_arrows/keymap.c | 38 |
10 files changed, 160 insertions, 220 deletions
diff --git a/keyboards/kona_classic/keymaps/ansi/keymap.c b/keyboards/kona_classic/keymaps/ansi/keymap.c index 3d2061e80d..3eba76d633 100644 --- a/keyboards/kona_classic/keymaps/ansi/keymap.c +++ b/keyboards/kona_classic/keymaps/ansi/keymap.c @@ -15,9 +15,13 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + // Helpful defines #define _______ KC_TRNS #define XXXXXXX KC_NO @@ -29,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_ansi( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/ansi_arrows/keymap.c b/keyboards/kona_classic/keymaps/ansi_arrows/keymap.c index 6e281f9511..43c27c5031 100644 --- a/keyboards/kona_classic/keymaps/ansi_arrows/keymap.c +++ b/keyboards/kona_classic/keymaps/ansi_arrows/keymap.c @@ -15,9 +15,13 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + // Helpful defines #define _______ KC_TRNS #define XXXXXXX KC_NO @@ -29,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_ansi_arrows( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, MO(_FN), \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/ansi_arrows_lcap/keymap.c b/keyboards/kona_classic/keymaps/ansi_arrows_lcap/keymap.c index b74a6c3d70..47f8d625b3 100644 --- a/keyboards/kona_classic/keymaps/ansi_arrows_lcap/keymap.c +++ b/keyboards/kona_classic/keymaps/ansi_arrows_lcap/keymap.c @@ -15,9 +15,13 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + // Helpful defines #define _______ KC_TRNS #define XXXXXXX KC_NO @@ -29,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_ansi_arrows( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ KC_F5, KC_F6, KC_LCAP, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, MO(_FN), \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/ansi_split/keymap.c b/keyboards/kona_classic/keymaps/ansi_split/keymap.c index d60e162f6b..f3c0dd707a 100644 --- a/keyboards/kona_classic/keymaps/ansi_split/keymap.c +++ b/keyboards/kona_classic/keymaps/ansi_split/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) // Helpful defines @@ -25,11 +25,15 @@ #define _DEFAULT 0 #define _FN 1 +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + //RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_ansi_split( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/ansi_split_arrows/keymap.c b/keyboards/kona_classic/keymaps/ansi_split_arrows/keymap.c index 181f2f14cc..9a6f7421c6 100644 --- a/keyboards/kona_classic/keymaps/ansi_split_arrows/keymap.c +++ b/keyboards/kona_classic/keymaps/ansi_split_arrows/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) // Helpful defines @@ -25,11 +25,15 @@ #define _DEFAULT 0 #define _FN 1 +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + //RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_ansi_split_arrows( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ KC_F7, KC_F8, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, MO(_FN), \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/default/keymap.c b/keyboards/kona_classic/keymaps/default/keymap.c index 84a2f9cbd7..74f138d2cc 100644 --- a/keyboards/kona_classic/keymaps/default/keymap.c +++ b/keyboards/kona_classic/keymaps/default/keymap.c @@ -15,9 +15,13 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + // Helpful defines #define _______ KC_TRNS #define XXXXXXX KC_NO @@ -29,7 +33,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_all( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, \ KC_F5, KC_F6, MO(_FN), KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, \ KC_F7, KC_F8, KC_LSFT, _______, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, MO(_FN), \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/iso/keymap.c b/keyboards/kona_classic/keymaps/iso/keymap.c index ff9d3dcb8f..3ce8255e8f 100644 --- a/keyboards/kona_classic/keymaps/iso/keymap.c +++ b/keyboards/kona_classic/keymaps/iso/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) // Helpful defines @@ -25,11 +25,15 @@ #define _DEFAULT 0 #define _FN 1 +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + //RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_iso( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, \ KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, \ KC_F7, KC_F8, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/iso_arrows/keymap.c b/keyboards/kona_classic/keymaps/iso_arrows/keymap.c index 79e52360ca..44fb94fd9e 100644 --- a/keyboards/kona_classic/keymaps/iso_arrows/keymap.c +++ b/keyboards/kona_classic/keymaps/iso_arrows/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) // Helpful defines @@ -25,11 +25,15 @@ #define _DEFAULT 0 #define _FN 1 +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + //RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_iso_arrows( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, \ KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, \ KC_F7, KC_F8, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, MO(_FN), \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/iso_split/keymap.c b/keyboards/kona_classic/keymaps/iso_split/keymap.c index 51d3297736..425a4c9808 100644 --- a/keyboards/kona_classic/keymaps/iso_split/keymap.c +++ b/keyboards/kona_classic/keymaps/iso_split/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) // Helpful defines @@ -25,11 +25,15 @@ #define _DEFAULT 0 #define _FN 1 +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + //RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_iso_split( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, \ KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, \ KC_F7, KC_F8, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } diff --git a/keyboards/kona_classic/keymaps/iso_split_arrows/keymap.c b/keyboards/kona_classic/keymaps/iso_split_arrows/keymap.c index ea81de4bcc..ba74a25124 100644 --- a/keyboards/kona_classic/keymaps/iso_split_arrows/keymap.c +++ b/keyboards/kona_classic/keymaps/iso_split_arrows/keymap.c @@ -15,7 +15,7 @@ */ #include QMK_KEYBOARD_H -#define MODS_SHFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) +#define MODS_SHIFT_GUI_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT)|MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) #define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) // Helpful defines @@ -25,11 +25,15 @@ #define _DEFAULT 0 #define _FN 1 +enum custom_keycodes { + SFT_ESC = SAFE_RANGE +}; + //RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { [_DEFAULT] = LAYOUT_iso_split_arrows( - KC_F1, KC_F2, F(0), KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ + KC_F1, KC_F2, SFT_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ KC_F3, KC_F4, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_ENT, \ KC_F5, KC_F6, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, \ KC_F7, KC_F8, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_UP, MO(_FN), \ @@ -55,29 +59,15 @@ 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) { } -enum function_id { - ESCAPE, -}; - -const uint16_t PROGMEM fn_actions[] = { - [0] = ACTION_FUNCTION(ESCAPE), -}; - -void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { - static uint8_t shift_esc_shift_mask; - switch (id) { - case ESCAPE: - shift_esc_shift_mask = get_mods()&MODS_SHFT_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_GUI_MASK) { add_key(KC_GRV); send_keyboard_report(); } else { @@ -85,7 +75,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_GUI_MASK) { del_key(KC_GRV); send_keyboard_report(); } else { @@ -93,6 +83,10 @@ void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { send_keyboard_report(); } } - break; + + return false; + + default: + return true; } } |