]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/amjpad/keymaps/max/keymap.c
Merge branch 'master' of github.com:qmk/qmk_firmware into hf/shinydox
[qmk_firmware.git] / keyboards / amjpad / keymaps / max / keymap.c
1 #include QMK_KEYBOARD_H
2
3 #ifdef RGBLIGHT_ENABLE
4 #include "rgblight.h"
5 #endif
6
7 // Used for SHIFT_ESC
8 #define MODS_CTRL_MASK  (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
9
10 // Each layer gets a name for readability, which is then used in the keymap matrix below.
11 // The underscores don't mean anything - you can have a layer called STUFF or any other name.
12 // Layer names don't all need to be of the same length, obviously, and you can also skip them
13 // entirely and just use numbers.
14 #define _BL 0
15 #define _FL 1
16
17 #define _______ KC_TRNS
18
19 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20   /* Keymap _BL: (Base Layer) Default Layer
21    * ,-------------------.
22    * |Esc |Setp| -  | =  |
23    * |----|----|----|----|
24    * | F1 | F2 | F3 | F4 |
25    * |----|----|----|----|
26    * | 7  | 8  | 9  |  - |
27    * |----|----|----|----|
28    * | 4  | 5  | 6  | LF |
29    * |----|----|----|----|
30    * | 1  | 2  | 3  | \  |
31    * |----|----|----|----|
32    * |Left|Down| Up |Rght|
33    * `-------------------'
34    */
35
36   [_BL] = LAYOUT_ortho_6x4(
37     KC_ESC,  KC_TAB,  KC_MINS,KC_EQL,  \
38     KC_F1,   KC_F2,   KC_F3,  KC_F4,   \
39     KC_P7,   KC_P8,   KC_P9,  KC_PMNS, \
40     KC_P4,   KC_P5,   KC_P6,  KC_PENT, \
41     KC_P1,   KC_P2,   KC_P3,  KC_BSLS, \
42     KC_LEFT, KC_DOWN, KC_UP,  KC_RIGHT
43   ),
44
45   /* Keymap _FL: Function Layer
46    * ,-------------------.
47    * |Esc |TAB |BS  | =  |
48    * |----|----|----|----|
49    * | NL | /  | *  | -  |
50    * |----|----|----|----|
51    * | 7  | 8  | 9  |    |
52    * |----|----|----|RST |
53    * | 4  | 5  | 6  |    |
54    * |----|----|----|----|
55    * | 1  | 2  | 3  |    |
56    * |----|----|----| En |
57    * |   0     |./FN|    |
58    * `-------------------'
59    */
60   [_FL] = LAYOUT_ortho_6x4(
61     KC_ESC,  KC_TAB,  KC_BSPC, KC_PEQL, \
62     KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, \
63     KC_P7,   KC_P8,   KC_P9,   RESET,   \
64     KC_P4,   KC_P5,   KC_P6,   KC_PENT, \
65     KC_P1,   KC_P2,   KC_P3,   KC_PENT, \
66     KC_LEFT, KC_DOWN, KC_UP,   KC_RIGHT
67   ),
68 };
69
70 enum function_id {
71     SHIFT_ESC,
72 };
73
74 const uint16_t PROGMEM fn_actions[] = {
75   [0]  = ACTION_FUNCTION(SHIFT_ESC),
76 };
77
78 void action_function(keyrecord_t *record, uint8_t id, uint8_t opt) {
79   static uint8_t shift_esc_shift_mask;
80   switch (id) {
81     case SHIFT_ESC:
82       shift_esc_shift_mask = get_mods()&MODS_CTRL_MASK;
83       if (record->event.pressed) {
84         if (shift_esc_shift_mask) {
85           add_key(KC_GRV);
86           send_keyboard_report();
87         } else {
88           add_key(KC_ESC);
89           send_keyboard_report();
90         }
91       } else {
92         if (shift_esc_shift_mask) {
93           del_key(KC_GRV);
94           send_keyboard_report();
95         } else {
96           del_key(KC_ESC);
97           send_keyboard_report();
98         }
99       }
100       break;
101   }
102 }