diff options
Diffstat (limited to 'keyboards/contra/keymaps/maxr1998/keymap.c')
-rw-r--r-- | keyboards/contra/keymaps/maxr1998/keymap.c | 185 |
1 files changed, 185 insertions, 0 deletions
diff --git a/keyboards/contra/keymaps/maxr1998/keymap.c b/keyboards/contra/keymaps/maxr1998/keymap.c new file mode 100644 index 000000000..044ed0c0c --- /dev/null +++ b/keyboards/contra/keymaps/maxr1998/keymap.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /* Copyright 2015-2017 Jack Humbert | ||
2 | * | ||
3 | * This program is free software: you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation, either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include "contra.h" | ||
18 | #include "keymap_german.h" | ||
19 | |||
20 | enum contra_layers { | ||
21 | _QWERTZ, | ||
22 | _FN, | ||
23 | _NR, | ||
24 | _NR_L3, | ||
25 | _FX, | ||
26 | _GAMING | ||
27 | }; | ||
28 | |||
29 | #define KC_I3 LM(_NR, MOD_LALT) | ||
30 | #define KC_NR SAFE_RANGE | ||
31 | #define KC_N3 (SAFE_RANGE + 1) | ||
32 | #define KC_FN MO(_FN) | ||
33 | #define G_1 TO(_GAMING) | ||
34 | #define G_0 TG(_GAMING) | ||
35 | |||
36 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
37 | |||
38 | /* Qwertz | ||
39 | * ,-----------------------------------------------------------------------------------. | ||
40 | * | Esc | Q | W | E | R | T | Z | U | I | O | P | Bksp | | ||
41 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
42 | * | Tab | A | S | D | F | G | H | J | K | L | +* ~ | Enter| | ||
43 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
44 | * | Shift| Y | X | C | V | B | N | M | , | . | Up | Shift| | ||
45 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
46 | * | Ctrl | Sup | Alt | i3 | NumR | Space | Spec | Fun | Left | Down | Right| | ||
47 | * `-----------------------------------------------------------------------------------' | ||
48 | */ | ||
49 | [_QWERTZ] = { | ||
50 | {KC_GESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC}, | ||
51 | {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, DE_PLUS, KC_ENT }, | ||
52 | {KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_UP, KC_RSFT}, | ||
53 | {KC_LCTL, KC_LGUI, KC_LALT, KC_I3, KC_NR, KC_SPC, KC_SPC, KC_N3, KC_FN, KC_LEFT, KC_DOWN, KC_RGHT} | ||
54 | }, | ||
55 | |||
56 | /* Function layer | ||
57 | * ,-----------------------------------------------------------------------------------. | ||
58 | * | | | | | | | | Ü | | Ö | | Del | | ||
59 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
60 | * | Lock | Ä | ß | | | GAME | | RGBS | RGBB | RGBS | | | | ||
61 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
62 | * | | | | | | | | RGBH-| RGBT | RGBH+| PgUp | | | ||
63 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
64 | * | | | | ---- | ---- | | ---- | ---- | Home | PgDn | End | | ||
65 | * `-----------------------------------------------------------------------------------' | ||
66 | */ | ||
67 | [_FN] = { | ||
68 | {_______, _______, _______, _______, _______, _______, _______, DE_UDIA, _______, DE_ODIA, _______, KC_DEL }, | ||
69 | {KC_LOCK, DE_ADIA, DE_SS, _______, _______, G_1, _______, RGB_M_P, RGB_M_B, RGB_M_SW,_______, _______}, | ||
70 | {_______, _______, _______, _______, _______, _______, _______, RGB_HUD, RGB_TOG, RGB_HUI, KC_PGUP, _______}, | ||
71 | {_______, _______, _______, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, XXXXXXX, KC_HOME, KC_PGDN, KC_END } | ||
72 | }, | ||
73 | |||
74 | /* Numrow layer (special characters with Shift and ISO_L3_Shift) | ||
75 | * ,-----------------------------------------------------------------------------------. | ||
76 | * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | \ | | ||
77 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
78 | * | | | | | | | | | | | #' | | | ||
79 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
80 | * | | <> | | | | | | | | | | -_ | | | ||
81 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
82 | * | | | | ---- | ---- | | ---- | ---- | | | | | ||
83 | * `-----------------------------------------------------------------------------------' | ||
84 | */ | ||
85 | [_NR] = { | ||
86 | {_______, DE_1, DE_2, DE_3, DE_4, DE_5, DE_6, DE_7, DE_8, DE_9, DE_0, _______}, | ||
87 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, DE_HASH, _______}, | ||
88 | {_______, DE_LABK, _______, _______, _______, _______, _______, _______, _______, _______, DE_MINS, _______}, | ||
89 | {_______, _______, _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______} | ||
90 | }, | ||
91 | [_NR_L3] = { | ||
92 | {_______, DE_1, DE_2, DE_3, DE_4, DE_5, DE_6, DE_7, DE_8, DE_9, DE_0, DE_SS }, | ||
93 | {_______, DE_Q, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, | ||
94 | {_______, DE_LABK, _______, _______, _______, _______, _______, _______, _______, _______, DE_MINS, _______}, | ||
95 | {_______, _______, _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______} | ||
96 | }, | ||
97 | |||
98 | /* Function keys | ||
99 | * ,-----------------------------------------------------------------------------------. | ||
100 | * | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | ||
101 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
102 | * | | | | | | | | | | | | | | ||
103 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
104 | * | | | | | | | | | | | | | | ||
105 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
106 | * | | | | | | | | | | | | | ||
107 | * `-----------------------------------------------------------------------------------' | ||
108 | */ | ||
109 | [_FX] = { | ||
110 | {KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12 }, | ||
111 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, | ||
112 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, | ||
113 | {_______, _______, _______, XXXXXXX, _______, _______, _______, _______, XXXXXXX, _______, _______, _______} | ||
114 | }, | ||
115 | |||
116 | /* Gaming | ||
117 | * ,-----------------------------------------------------------------------------------. | ||
118 | * | | | | | | | | | | | | | | ||
119 | * |------+------+------+------+------+-------------+------+------+------+------+------| | ||
120 | * | | | | | | | | | | | | | | ||
121 | * |------+------+------+------+------+------|------+------+------+------+------+------| | ||
122 | * | | | | | | | | | | | | | | ||
123 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
124 | * | Space| | | | | | | Leave| | | | | ||
125 | * `-----------------------------------------------------------------------------------' | ||
126 | */ | ||
127 | [_GAMING] = { | ||
128 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, | ||
129 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, | ||
130 | {_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______}, | ||
131 | {KC_SPC, XXXXXXX, _______, _______, _______, KC_LCTL, KC_LCTL, _______, G_0, _______, _______, _______} | ||
132 | } | ||
133 | }; | ||
134 | |||
135 | void update_tri_layer_user(void); | ||
136 | |||
137 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
138 | switch(keycode) { | ||
139 | case KC_BSPC: | ||
140 | if (record->event.pressed) { | ||
141 | if (get_mods() & (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT))) { | ||
142 | register_code(DE_SS); | ||
143 | return false; | ||
144 | } | ||
145 | } else { | ||
146 | unregister_code(DE_SS); | ||
147 | } | ||
148 | return true; | ||
149 | case KC_NR: | ||
150 | if (record->event.pressed) { | ||
151 | layer_on(_NR); | ||
152 | } else { | ||
153 | layer_off(_NR); | ||
154 | } | ||
155 | update_tri_layer_user(); | ||
156 | return false; | ||
157 | case KC_N3: | ||
158 | if (record->event.pressed) { | ||
159 | layer_on(_NR_L3); | ||
160 | } else { | ||
161 | layer_off(_NR_L3); | ||
162 | } | ||
163 | update_tri_layer_user(); | ||
164 | return false; | ||
165 | default: | ||
166 | return true; | ||
167 | } | ||
168 | } | ||
169 | |||
170 | void update_tri_layer_user(void) { | ||
171 | update_tri_layer(_NR, _NR_L3, _FX); | ||
172 | if (layer_state_is(_NR_L3) && !layer_state_is(_FX)) { | ||
173 | register_code(KC_ALGR); | ||
174 | } else { | ||
175 | unregister_code(KC_ALGR); | ||
176 | } | ||
177 | } | ||
178 | |||
179 | void led_set_user(uint8_t usb_led) { | ||
180 | // Force-enable Numlock | ||
181 | if (!(usb_led & (1<<USB_LED_NUM_LOCK))) { | ||
182 | register_code(KC_NUMLOCK); | ||
183 | unregister_code(KC_NUMLOCK); | ||
184 | } | ||
185 | } | ||