diff options
Diffstat (limited to 'keyboards/handwired/kbod/keymaps/default/keymap.c')
| -rw-r--r-- | keyboards/handwired/kbod/keymaps/default/keymap.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/keyboards/handwired/kbod/keymaps/default/keymap.c b/keyboards/handwired/kbod/keymaps/default/keymap.c index 063a94b4d..49083820a 100644 --- a/keyboards/handwired/kbod/keymaps/default/keymap.c +++ b/keyboards/handwired/kbod/keymaps/default/keymap.c | |||
| @@ -2,6 +2,11 @@ | |||
| 2 | 2 | ||
| 3 | #define MODS_PRESSED(btn) (get_mods() & (MOD_BIT(KC_L##btn)|MOD_BIT(KC_R##btn))) | 3 | #define MODS_PRESSED(btn) (get_mods() & (MOD_BIT(KC_L##btn)|MOD_BIT(KC_R##btn))) |
| 4 | 4 | ||
| 5 | enum custom_keycodes { | ||
| 6 | SFT_ESC = SAFE_RANGE, | ||
| 7 | ALT_F4 | ||
| 8 | }; | ||
| 9 | |||
| 5 | #define SET_WHETHER(mask, btn1, btn2) \ | 10 | #define SET_WHETHER(mask, btn1, btn2) \ |
| 6 | if (record->event.pressed) { \ | 11 | if (record->event.pressed) { \ |
| 7 | if (mask) { \ | 12 | if (mask) { \ |
| @@ -24,7 +29,7 @@ if (record->event.pressed) { \ | |||
| 24 | 29 | ||
| 25 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 30 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 26 | LAYOUT( /* Base */ | 31 | LAYOUT( /* Base */ |
| 27 | F(0), KC_1, KC_2, KC_3, F(1), KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ | 32 | SFT_ESC, KC_1, KC_2, KC_3, ALT_F4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, \ |
| 28 | 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, \ | 33 | 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, \ |
| 29 | 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, \ | 34 | 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, \ |
| 30 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ | 35 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ |
| @@ -38,7 +43,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 38 | _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT \ | 43 | _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_RGHT \ |
| 39 | ), | 44 | ), |
| 40 | LAYOUT( /* Keypad layer */ | 45 | LAYOUT( /* Keypad layer */ |
| 41 | TO(0), KC_1, KC_2, KC_3, F(1), KC_5, KC_6, KC_P7, KC_P8, KC_P9, KC_P0, KC_PMNS, KC_PPLS, KC_BSPC, \ | 46 | TO(0), KC_1, KC_2, KC_3, ALT_F4, KC_5, KC_6, KC_P7, KC_P8, KC_P9, KC_P0, KC_PMNS, KC_PPLS, KC_BSPC, \ |
| 42 | _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______, \ | 47 | _______, _______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, _______, _______, _______, _______, \ |
| 43 | _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______, _______, _______, \ | 48 | _______, _______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, _______, _______, _______, \ |
| 44 | _______, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_BTN1, KC_MS_U, KC_BTN2, \ | 49 | _______, _______, _______, _______, _______, _______, _______, KC_P0, KC_PDOT, KC_BTN1, KC_MS_U, KC_BTN2, \ |
| @@ -53,24 +58,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 53 | ), | 58 | ), |
| 54 | }; | 59 | }; |
| 55 | 60 | ||
| 56 | const uint16_t PROGMEM fn_actions[] = { | 61 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 57 | [0] = ACTION_FUNCTION(0), | 62 | switch (keycode) { |
| 58 | [1] = ACTION_FUNCTION(1), | 63 | case SFT_ESC: |
| 59 | }; | 64 | SET_WHETHER(MODS_PRESSED(SHIFT), KC_ESC, KC_GRAVE); |
| 65 | |||
| 66 | return false; | ||
| 67 | |||
| 68 | case ALT_F4: | ||
| 69 | SET_WHETHER(MODS_PRESSED(ALT), KC_4, KC_F4); | ||
| 60 | 70 | ||
| 71 | return false; | ||
| 61 | 72 | ||
| 62 | void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) { | 73 | default: |
| 63 | static uint8_t shift_esc_mask; | 74 | return true; |
| 64 | static uint8_t alt_mask; | ||
| 65 | switch (id) { | ||
| 66 | case 0: | ||
| 67 | shift_esc_mask = MODS_PRESSED(SHIFT); | ||
| 68 | SET_WHETHER(shift_esc_mask, KC_ESC, KC_GRAVE); | ||
| 69 | break; | ||
| 70 | case 1: | ||
| 71 | alt_mask = MODS_PRESSED(ALT); | ||
| 72 | SET_WHETHER(alt_mask, KC_4, KC_F4); | ||
| 73 | break; | ||
| 74 | } | 75 | } |
| 75 | } | 76 | } |
| 76 | 77 | ||
