aboutsummaryrefslogtreecommitdiff
path: root/keyboards/meira/keymaps/default/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/meira/keymaps/default/keymap.c')
-rw-r--r--keyboards/meira/keymaps/default/keymap.c320
1 files changed, 320 insertions, 0 deletions
diff --git a/keyboards/meira/keymaps/default/keymap.c b/keyboards/meira/keymaps/default/keymap.c
new file mode 100644
index 000000000..acde30afc
--- /dev/null
+++ b/keyboards/meira/keymaps/default/keymap.c
@@ -0,0 +1,320 @@
1/* Copyright 2017 Cole Markham
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#include "meira.h"
17#include "issi.h"
18#include "lighting.h"
19
20#ifdef RGBLIGHT_ENABLE
21//Following line allows macro to read current RGB settings
22extern rgblight_config_t rgblight_config;
23#endif
24
25#define _QWERTY 0
26#define _COLEMAK 1
27#define _DVORAK 2
28#define _LOWER 3
29#define _RAISE 4
30#define _ADJUST 16
31
32enum custom_keycodes {
33 QWERTY = SAFE_RANGE,
34 COLEMAK,
35 DVORAK,
36 LOWER,
37 RAISE,
38 ADJUST,
39};
40
41// define variables for reactive RGB
42bool TOG_STATUS = false;
43int RGB_current_mode;
44
45const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
46 /* Qwerty
47 * ,-----------------------------------------------------------------------------------.
48 * | Esc | Q | W | E | R | T | Y | U | I | O | P | Bksp |
49 * |------+------+------+------+------+-------------+------+------+------+------+------|
50 * | Tab | A | S | D | F | G | H | J | K | L | ; | ' |
51 * |------+------+------+------+------+------|------+------+------+------+------+------|
52 * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
53 * |------+------+------+------+------+------+------+------+------+------+------+------|
54 * |Adjust| Ctrl | Ctrl | Alt |Lower | Cmd |Space |Raise | Left | Down | Up |Right |
55 * `-----------------------------------------------------------------------------------'
56 */
57 [_QWERTY] = KEYMAP( \
58 KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
59 KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
60 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, \
61 ADJUST, KC_LCTL, KC_LALT, KC_LALT, LOWER, KC_LGUI, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
62 ),
63
64 /* Colemak
65 * ,-----------------------------------------------------------------------------------.
66 * | Tab | Q | W | F | P | G | J | L | U | Y | ; | Bksp |
67 * |------+------+------+------+------+-------------+------+------+------+------+------|
68 * | Esc | A | R | S | T | D | H | N | E | I | O | " |
69 * |------+------+------+------+------+------|------+------+------+------+------+------|
70 * | Shift| Z | X | C | V | B | K | M | , | . | / |Enter |
71 * |------+------+------+------+------+------+------+------+------+------+------+------|
72 * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
73 * `-----------------------------------------------------------------------------------'
74 */
75 [_COLEMAK] = KEYMAP( \
76 KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
77 KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
78 KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
79 ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
80 ),
81
82 /* Dvorak
83 * ,-----------------------------------------------------------------------------------.
84 * | Tab | " | , | . | P | Y | F | G | C | R | L | Bksp |
85 * |------+------+------+------+------+-------------+------+------+------+------+------|
86 * | Esc | A | O | E | U | I | D | H | T | N | S | / |
87 * |------+------+------+------+------+------|------+------+------+------+------+------|
88 * | Shift| ; | Q | J | K | X | B | M | W | V | Z |Enter |
89 * |------+------+------+------+------+------+------+------+------+------+------+------|
90 * |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
91 * `-----------------------------------------------------------------------------------'
92 */
93 [_DVORAK] = KEYMAP( \
94 KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
95 KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
96 KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
97 ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
98 ),
99
100 /* Lower
101 * ,-----------------------------------------------------------------------------------.
102 * | | ! | @ | # | $ | % | ^ | & | * | ( | ) | Bksp |
103 * |------+------+------+------+------+-------------+------+------+------+------+------|
104 * | ~ | F1 | F2 | F3 | F4 | F5 | F6 | _ | + | | \ | | |
105 * |------+------+------+------+------+------|------+------+------+------+------+------|
106 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter |
107 * |------+------+------+------+------+------+------+------+------+------+------+------|
108 * | | | | | | | | Next | Vol- | Vol+ | Play |
109 * `-----------------------------------------------------------------------------------'
110 */
111 [_LOWER] = KEYMAP( \
112 _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
113 KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
114 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, KC_QUOT, \
115 _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END \
116 ),
117
118 /* Raise
119 * ,-----------------------------------------------------------------------------------.
120 * | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | Bksp |
121 * |------+------+------+------+------+-------------+------+------+------+------+------|
122 * | ` | F1 | F2 | F3 | F4 | F5 | F6 | - | = | [ | ] | \ |
123 * |------+------+------+------+------+------|------+------+------+------+------+------|
124 * | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter |
125 * |------+------+------+------+------+------+------+------+------+------+------+------|
126 * | | | | | | | | Home | PgUp | PgDn | End |
127 * `-----------------------------------------------------------------------------------'
128 */
129 [_RAISE] = KEYMAP( \
130 _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
131 KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
132 _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
133 _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END \
134 ),
135
136 /* Adjust (Lower + Raise)
137 * ,-----------------------------------------------------------------------------------.
138 * | | Reset| | | | | | | | | | Del |
139 * |------+------+------+------+------+-------------+------+------+------+------+------|
140 * | | | |Aud on|Audoff|AGnorm|AGswap|Qwerty|Colemk|Dvorak| | |
141 * |------+------+------+------+------+------|------+------+------+------+------+------|
142 * | | | | | | | | | | | | |
143 * |------+------+------+------+------+------+------+------+------+------+------+------|
144 * | | | | | | | | | | | |
145 * `-----------------------------------------------------------------------------------'
146 */
147 [_ADJUST] = KEYMAP( \
148 BL_TOGG, RESET, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_PSCR, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, \
149 BL_STEP, RGB_MOD, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
150 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
151 _______, KC_PSCR, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \
152 )
153};
154
155const uint16_t PROGMEM fn_actions[] = {
156
157};
158
159// Setting ADJUST layer RGB back to default
160void update_tri_layer_RGB(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
161 if (IS_LAYER_ON(layer1) && IS_LAYER_ON(layer2)) {
162#ifdef RGBLIGHT_ENABLE
163 rgblight_mode(RGB_current_mode);
164#endif
165 layer_on(layer3);
166 } else {
167 layer_off(layer3);
168 }
169}
170
171const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
172{
173 // MACRODOWN only works in this function
174 switch(id) {
175 case 0:
176 if (record->event.pressed) {
177 register_code(KC_RSFT);
178 } else {
179 unregister_code(KC_RSFT);
180 }
181 break;
182 }
183 return MACRO_NONE;
184};
185
186
187void matrix_init_user(void) {
188
189}
190
191void matrix_scan_user(void) {
192
193}
194
195bool process_record_user(uint16_t keycode, keyrecord_t *record) {
196 switch (keycode) {
197 case QWERTY:
198 if (record->event.pressed) {
199 #ifdef AUDIO_ENABLE
200 PLAY_NOTE_ARRAY(tone_qwerty, false, 0);
201 #endif
202// persistent_default_layer_set(1UL<<_QWERTY);
203 }
204 return false;
205 break;
206 case COLEMAK:
207 if (record->event.pressed) {
208 #ifdef AUDIO_ENABLE
209 PLAY_NOTE_ARRAY(tone_colemak, false, 0);
210 #endif
211// persistent_default_layer_set(1UL<<_COLEMAK);
212 }
213 return false;
214 break;
215 case DVORAK:
216 if (record->event.pressed) {
217 #ifdef AUDIO_ENABLE
218 PLAY_NOTE_ARRAY(tone_dvorak, false, 0);
219 #endif
220// persistent_default_layer_set(1UL<<_DVORAK);
221 }
222 return false;
223 break;
224 case LOWER:
225 if (record->event.pressed) {
226 //not sure how to have keyboard check mode and set it to a variable, so my work around
227 //uses another variable that would be set to true after the first time a reactive key is pressed.
228 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
229 } else {
230 TOG_STATUS = !TOG_STATUS;
231#ifdef RGBLIGHT_ENABLE
232 rgblight_mode(16);
233#endif
234 }
235 layer_on(_LOWER);
236 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
237 } else {
238#ifdef RGBLIGHT_ENABLE
239 rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
240#endif
241 TOG_STATUS = false;
242 layer_off(_LOWER);
243 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
244 }
245 return false;
246 break;
247 case RAISE:
248 if (record->event.pressed) {
249 //not sure how to have keyboard check mode and set it to a variable, so my work around
250 //uses another variable that would be set to true after the first time a reactive key is pressed.
251 if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
252 } else {
253 TOG_STATUS = !TOG_STATUS;
254#ifdef RGBLIGHT_ENABLE
255 rgblight_mode(15);
256#endif
257 }
258 layer_on(_RAISE);
259 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
260 } else {
261#ifdef RGBLIGHT_ENABLE
262 rgblight_mode(RGB_current_mode); // revert RGB to initial mode prior to RGB mode change
263#endif
264 layer_off(_RAISE);
265 TOG_STATUS = false;
266 update_tri_layer_RGB(_LOWER, _RAISE, _ADJUST);
267 }
268 return false;
269 break;
270 case ADJUST:
271 // FIXME add RGB feedback
272 if (record->event.pressed) {
273 layer_on(_ADJUST);
274 } else {
275 layer_off(_ADJUST);
276 }
277 return false;
278 break;
279 case BL_TOGG:
280#ifdef ISSI_ENABLE
281 if (record->event.pressed) {
282 print("Enabling backlight\n");
283 issi_init();
284 }
285#endif
286 return false;
287 break;
288 case BL_STEP:
289 if (record->event.pressed) {
290 print("Stepping backlight\n");
291#ifdef BACKLIGHT_ENABLE
292 print("Really stepping backlight\n");
293 backlight_step();
294#endif
295
296 }
297 return false;
298 break;
299 //led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
300#ifdef RGBLIGHT_ENABLE
301 case RGB_MOD:
302 if (record->event.pressed) {
303 rgblight_mode(RGB_current_mode);
304 rgblight_step();
305 RGB_current_mode = rgblight_config.mode;
306 }
307 return false;
308 break;
309#endif
310// case BL_INC:
311// meira_inc_backlight_level();
312// return false;
313// break;
314 }
315 return true;
316}
317
318void led_set_user(uint8_t usb_led) {
319
320}