aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/kona_classic/keymaps/default/keymap.c
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-02-15 15:07:13 +1100
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-02-14 20:07:13 -0800
commit9e4ac6cf29e6b2ce950135c8f877c95f2d1f1d55 (patch)
treedf6cfe88ce0f51ea5ca7fd6b93aae7eaed67d8a5 /keyboards/kona_classic/keymaps/default/keymap.c
parentd5bc7fc1575543eb27cffcc465a8f0c4e11b7de7 (diff)
downloadfirmware-9e4ac6cf29e6b2ce950135c8f877c95f2d1f1d55.tar.gz
firmware-9e4ac6cf29e6b2ce950135c8f877c95f2d1f1d55.tar.bz2
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/kona_classic/keymaps/default/keymap.c')
-rw-r--r--keyboards/kona_classic/keymaps/default/keymap.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/keyboards/kona_classic/keymaps/default/keymap.c b/keyboards/kona_classic/keymaps/default/keymap.c
index 84a2f9cbd..74f138d2c 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;
}
}