aboutsummaryrefslogtreecommitdiff
path: root/users/drashna/drashna.c
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-03-01 07:46:57 -0800
committerskullydazed <skullydazed@users.noreply.github.com>2018-03-01 07:46:57 -0800
commit452d23da5267899933ca336ae91e7b297d5dfb0b (patch)
treebe1a454d387ee339a5b581239224fdaf5eeaac39 /users/drashna/drashna.c
parent7f7f763598b7be7b2081a73be2124f40349d8032 (diff)
downloadqmk_firmware-452d23da5267899933ca336ae91e7b297d5dfb0b.tar.gz
qmk_firmware-452d23da5267899933ca336ae91e7b297d5dfb0b.zip
Update to drashna keymaps and userspace (#2450)
* Add OSL keycodes and macro handling * Re-add AVRDUDE target * Userspace document cleanup and commenting * Fix Orthodox keymap layout (cosmetic) * Add caveat for KEYMAP Macros * Minor tweaks * Enable Bootmagic in Ergodox EZ * Minor tweaks
Diffstat (limited to 'users/drashna/drashna.c')
-rw-r--r--users/drashna/drashna.c350
1 files changed, 163 insertions, 187 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 0bf83cb9f..678570958 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -32,14 +32,27 @@ PROGMEM const char secret[][64] = {
32}; 32};
33#endif 33#endif
34 34
35#ifdef AUDIO_ENABLE
36float tone_qwerty[][2] = SONG(QWERTY_SOUND);
37float tone_dvorak[][2] = SONG(DVORAK_SOUND);
38float tone_colemak[][2] = SONG(COLEMAK_SOUND);
39float tone_workman[][2] = SONG(PLOVER_SOUND);
40float tone_hackstartup[][2] = SONG(ONE_UP_SOUND);
41#endif
42
35#ifdef FAUXCLICKY_ENABLE 43#ifdef FAUXCLICKY_ENABLE
36float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); 44float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25);
37float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); 45float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125);
38#else 46#else
39float fauxclicky_pressed[][2] = SONG(E__NOTE(_A6)); // change to your tastes 47float fauxclicky_pressed[][2] = SONG(E__NOTE(_A6)); // change to your tastes
40float fauxclicky_released[][2] = SONG(E__NOTE(_A6)); // change to your tastes 48float fauxclicky_released[][2] = SONG(E__NOTE(_A6)); // change to your tastes
41#endif 49#endif
42bool faux_click_enabled = true; 50
51bool faux_click_enabled = false;
52bool is_overwatch = false;
53#ifdef RGBLIGHT_ENABLE
54bool rgb_layer_change = true;
55#endif
43 56
44#ifdef TAP_DANCE_ENABLE 57#ifdef TAP_DANCE_ENABLE
45//define diablo macro timer variables 58//define diablo macro timer variables
@@ -47,15 +60,11 @@ static uint16_t diablo_timer[4];
47static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 }; 60static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
48static uint8_t diablo_key_time[4]; 61static uint8_t diablo_key_time[4];
49 62
50
51bool check_dtimer(uint8_t dtimer) { 63bool check_dtimer(uint8_t dtimer) {
52 // has the correct number of seconds elapsed (as defined by diablo_times) 64 // has the correct number of seconds elapsed (as defined by diablo_times)
53 return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; 65 return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
54}; 66};
55 67
56
57
58
59// Cycle through the times for the macro, starting at 0, for disabled. 68// Cycle through the times for the macro, starting at 0, for disabled.
60// Max of six values, so don't exceed 69// Max of six values, so don't exceed
61void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) { 70void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
@@ -68,26 +77,20 @@ void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_
68 } 77 }
69} 78}
70 79
71
72// Would rather have one function for all of this, but no idea how to do that... 80// Would rather have one function for all of this, but no idea how to do that...
73void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { 81void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
74 diablo_tapdance_master(state, user_data, 0); 82 diablo_tapdance_master(state, user_data, 0);
75} 83}
76
77void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { 84void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
78 diablo_tapdance_master(state, user_data, 1); 85 diablo_tapdance_master(state, user_data, 1);
79} 86}
80
81void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { 87void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
82 diablo_tapdance_master(state, user_data, 2); 88 diablo_tapdance_master(state, user_data, 2);
83} 89}
84
85void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { 90void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
86 diablo_tapdance_master(state, user_data, 3); 91 diablo_tapdance_master(state, user_data, 3);
87} 92}
88 93
89
90
91//Tap Dance Definitions 94//Tap Dance Definitions
92qk_tap_dance_action_t tap_dance_actions[] = { 95qk_tap_dance_action_t tap_dance_actions[] = {
93 // tap once to disable, and more to enable timed micros 96 // tap once to disable, and more to enable timed micros
@@ -97,14 +100,40 @@ qk_tap_dance_action_t tap_dance_actions[] = {
97 [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), 100 [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
98 101
99}; 102};
100#endif
101 103
102#ifdef AUDIO_ENABLE 104// Sends the key press to system, but only if on the Diablo layer
103float tone_qwerty[][2] = SONG(QWERTY_SOUND); 105void send_diablo_keystroke(uint8_t diablo_key) {
104float tone_dvorak[][2] = SONG(DVORAK_SOUND); 106 if (biton32(layer_state) == _DIABLO) {
105float tone_colemak[][2] = SONG(COLEMAK_SOUND); 107 switch (diablo_key) {
106float tone_workman[][2] = SONG(PLOVER_SOUND); 108 case 0:
107float tone_hackstartup[][2] = SONG(ONE_UP_SOUND); 109 SEND_STRING("1");
110 break;
111 case 1:
112 SEND_STRING("2");
113 break;
114 case 2:
115 SEND_STRING("3");
116 break;
117 case 3:
118 SEND_STRING("4");
119 break;
120 }
121 }
122}
123
124// Checks each of the 4 timers/keys to see if enough time has elapsed
125// Runs the "send string" command if enough time has passed, and resets the timer.
126void run_diablo_macro_check(void) {
127 uint8_t dtime;
128
129 for (dtime = 0; dtime < 4; dtime++) {
130 if (check_dtimer(dtime) && diablo_key_time[dtime]) {
131 diablo_timer[dtime] = timer_read();
132 send_diablo_keystroke(dtime);
133 }
134 }
135}
136
108#endif 137#endif
109 138
110 139
@@ -131,13 +160,6 @@ uint32_t layer_state_set_keymap (uint32_t state) {
131__attribute__ ((weak)) 160__attribute__ ((weak))
132void led_set_keymap(uint8_t usb_led) {} 161void led_set_keymap(uint8_t usb_led) {}
133 162
134bool is_overwatch = false;
135#ifdef RGBLIGHT_ENABLE
136bool rgb_layer_change = true;
137#endif
138
139
140
141 163
142// Call user matrix init, set default RGB colors and then 164// Call user matrix init, set default RGB colors and then
143// call the keymap's init function 165// call the keymap's init function
@@ -167,49 +189,8 @@ void matrix_init_user(void) {
167 rgblight_mode(5); 189 rgblight_mode(5);
168 } 190 }
169#endif 191#endif
170#ifdef AUDIO_ENABLE
171// wait_ms(21); // gets rid of tick
172// stop_all_notes();
173// PLAY_SONG(tone_hackstartup);
174#endif
175 matrix_init_keymap(); 192 matrix_init_keymap();
176} 193}
177#ifdef TAP_DANCE_ENABLE
178
179// Sends the key press to system, but only if on the Diablo layer
180void send_diablo_keystroke(uint8_t diablo_key) {
181 if (biton32(layer_state) == _DIABLO) {
182 switch (diablo_key) {
183 case 0:
184 SEND_STRING("1");
185 break;
186 case 1:
187 SEND_STRING("2");
188 break;
189 case 2:
190 SEND_STRING("3");
191 break;
192 case 3:
193 SEND_STRING("4");
194 break;
195 }
196 }
197}
198
199// Checks each of the 4 timers/keys to see if enough time has elapsed
200// Runs the "send string" command if enough time has passed, and resets the timer.
201void run_diablo_macro_check(void) {
202 uint8_t dtime;
203
204 for (dtime = 0; dtime < 4; dtime++) {
205 if (check_dtimer(dtime) && diablo_key_time[dtime]) {
206 diablo_timer[dtime] = timer_read();
207 send_diablo_keystroke(dtime);
208 }
209 }
210
211}
212#endif
213// No global matrix scan code, so just run keymap's matix 194// No global matrix scan code, so just run keymap's matix
214// scan function 195// scan function
215void matrix_scan_user(void) { 196void matrix_scan_user(void) {
@@ -219,11 +200,10 @@ void matrix_scan_user(void) {
219 matrix_scan_keymap(); 200 matrix_scan_keymap();
220} 201}
221 202
222void led_set_user(uint8_t usb_led) { 203// This block is for all of the gaming macros, as they were all doing
223 led_set_keymap(usb_led); 204// the same thing, but with differring text sent.
224}
225
226void send_game_macro(const char *str) { 205void send_game_macro(const char *str) {
206 clear_keyboard();
227 register_code(is_overwatch ? KC_BSPC : KC_ENTER); 207 register_code(is_overwatch ? KC_BSPC : KC_ENTER);
228 unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); 208 unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
229 wait_ms(50); 209 wait_ms(50);
@@ -232,21 +212,26 @@ void send_game_macro(const char *str) {
232 unregister_code(KC_ENTER); 212 unregister_code(KC_ENTER);
233} 213}
234 214
215
216// Sent the default layer
235void persistent_default_layer_set(uint16_t default_layer) { 217void persistent_default_layer_set(uint16_t default_layer) {
236 eeconfig_update_default_layer(default_layer); 218 eeconfig_update_default_layer(default_layer);
237 default_layer_set(default_layer); 219 default_layer_set(default_layer);
238} 220}
239 221
222
240// Defines actions tor my global custom keycodes. Defined in drashna.h file 223// Defines actions tor my global custom keycodes. Defined in drashna.h file
241// Then runs the _keymap's recod handier if not processed here 224// Then runs the _keymap's recod handier if not processed here
242bool process_record_user(uint16_t keycode, keyrecord_t *record) { 225bool process_record_user(uint16_t keycode, keyrecord_t *record) {
243 226
227// If console is enabled, it will print the matrix position and status of each key pressed
244#ifdef CONSOLE_ENABLE 228#ifdef CONSOLE_ENABLE
245 xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); 229 xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
246#endif 230#endif //CONSOLE_ENABLE
247 231
248#ifdef AUDIO_ENABLE 232// Run custom faux click code, but only if faux clicky is enabled
249 if (faux_click_enabled) { 233#ifdef AUDIO_ENABLE
234 if ( (faux_click_enabled && keycode != KC_FXCL) || (!faux_click_enabled && keycode == KC_FXCL) ) {
250 if (record->event.pressed) { 235 if (record->event.pressed) {
251 PLAY_SONG(fauxclicky_pressed); 236 PLAY_SONG(fauxclicky_pressed);
252 } else { 237 } else {
@@ -254,14 +239,15 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
254 PLAY_SONG(fauxclicky_released); 239 PLAY_SONG(fauxclicky_released);
255 } 240 }
256 } 241 }
257#endif 242#endif //AUDIO_ENABLE
243
258 244
259 switch (keycode) { 245 switch (keycode) {
260 case KC_QWERTY: 246 case KC_QWERTY:
261 if (record->event.pressed) { 247 if (record->event.pressed) {
262#ifdef AUDIO_ENABLE 248#ifdef AUDIO_ENABLE
263 PLAY_SONG(tone_qwerty); 249 PLAY_SONG(tone_qwerty);
264#endif 250#endif //AUDIO_ENABLE
265 persistent_default_layer_set(1UL << _QWERTY); 251 persistent_default_layer_set(1UL << _QWERTY);
266 } 252 }
267 return false; 253 return false;
@@ -270,7 +256,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
270 if (record->event.pressed) { 256 if (record->event.pressed) {
271#ifdef AUDIO_ENABLE 257#ifdef AUDIO_ENABLE
272 PLAY_SONG(tone_colemak); 258 PLAY_SONG(tone_colemak);
273#endif 259#endif //AUDIO_ENABLE
274 persistent_default_layer_set(1UL << _COLEMAK); 260 persistent_default_layer_set(1UL << _COLEMAK);
275 } 261 }
276 return false; 262 return false;
@@ -279,7 +265,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
279 if (record->event.pressed) { 265 if (record->event.pressed) {
280#ifdef AUDIO_ENABLE 266#ifdef AUDIO_ENABLE
281 PLAY_SONG(tone_dvorak); 267 PLAY_SONG(tone_dvorak);
282#endif 268#endif //AUDIO_ENABLE
283 persistent_default_layer_set(1UL << _DVORAK); 269 persistent_default_layer_set(1UL << _DVORAK);
284 } 270 }
285 return false; 271 return false;
@@ -288,11 +274,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
288 if (record->event.pressed) { 274 if (record->event.pressed) {
289#ifdef AUDIO_ENABLE 275#ifdef AUDIO_ENABLE
290 PLAY_SONG(tone_workman); 276 PLAY_SONG(tone_workman);
291#endif 277#endif //AUDIO_ENABLE
292 persistent_default_layer_set(1UL << _WORKMAN); 278 persistent_default_layer_set(1UL << _WORKMAN);
293 } 279 }
294 return false; 280 return false;
295 break; 281 break;
282
283
296 case LOWER: 284 case LOWER:
297 if (record->event.pressed) { 285 if (record->event.pressed) {
298 layer_on(_LOWER); 286 layer_on(_LOWER);
@@ -324,85 +312,108 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
324 } 312 }
325 return false; 313 return false;
326 break; 314 break;
327#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) 315
328 case KC_OVERWATCH: 316
329 if (record->event.pressed) { 317 case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
330 is_overwatch = !is_overwatch;
331 }
332#ifdef RGBLIGHT_ENABLE
333 is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
334#endif
335 return false;
336 break;
337 case KC_SALT:
338 if (!record->event.pressed) { 318 if (!record->event.pressed) {
339 send_game_macro("Salt, salt, salt..."); 319 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
320#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
321 ":dfu"
322#elif defined(BOOTLOADER_HALFKAY)
323 ":teensy"
324#elif defined(BOOTLOADER_CATERINA)
325 ":avrdude"
326#endif
327 SS_TAP(X_ENTER));
340 } 328 }
341 return false; 329 return false;
342 break; 330 break;
343 case KC_MORESALT: 331 case KC_RESET: // Custom RESET code that setr RGBLights to RED
344 if (!record->event.pressed) { 332 if (!record->event.pressed) {
345 send_game_macro("Please sir, can I have some more salt?!"); 333#ifdef RGBLIGHT_ENABLE
334 rgblight_enable();
335 rgblight_mode(1);
336 rgblight_setrgb(0xff, 0x00, 0x00);
337#endif
338 reset_keyboard();
346 } 339 }
347 return false; 340 return false;
348 break; 341 break;
349 case KC_SALTHARD: 342 case EPRM: // Resets EEPROM
350 if (!record->event.pressed) { 343 if (record->event.pressed) {
351 send_game_macro("Your salt only makes me harder, and even more aggressive!"); 344 eeconfig_init();
352 } 345 }
353 return false; 346 return false;
354 break; 347 break;
355 case KC_GOODGAME: 348 case VRSN: // Prints firmware version
356 if (!record->event.pressed) { 349 if (record->event.pressed) {
357 send_game_macro("Good game, everyone!"); 350 SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
358 } 351 }
359 return false; 352 return false;
360 break; 353 break;
361 case KC_GLHF: 354 case KC_SECRET_1 ... KC_SECRET_5: // Custom
362 if (!record->event.pressed) { 355 if (!record->event.pressed) {
363 send_game_macro("Good luck, have fun!!!"); 356 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
357 send_string_P(secret[keycode - KC_SECRET_1]);
364 } 358 }
365 return false; 359 return false;
366 break; 360 break;
367 case KC_SYMM: 361
368 if (!record->event.pressed) { 362
369 send_game_macro("Left click to win!"); 363// These are a serious of gaming macros.
370 } 364// Only enables for the viterbi, basically,
365// to save on firmware space, since it's limited.
366#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez))
367
368
369 case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros
370 if (record->event.pressed) { is_overwatch = !is_overwatch; }
371#ifdef RGBLIGHT_ENABLE
372 is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
373#endif //RGBLIGHT_ENABLE
371 return false; 374 return false;
372 break; 375 break;
376
377 case KC_SALT:
378 if (!record->event.pressed) { send_game_macro("Salt, salt, salt..."); }
379 return false; break;
380 case KC_MORESALT:
381 if (!record->event.pressed) { send_game_macro("Please sir, can I have some more salt?!"); }
382 return false; break;
383 case KC_SALTHARD:
384 if (!record->event.pressed) { send_game_macro("Your salt only makes me harder, and even more aggressive!"); }
385 return false; break;
386 case KC_GOODGAME:
387 if (!record->event.pressed) { send_game_macro("Good game, everyone!"); }
388 return false; break;
389 case KC_GLHF:
390 if (!record->event.pressed) { send_game_macro("Good luck, have fun!!!"); }
391 return false; break;
392 case KC_SYMM:
393 if (!record->event.pressed) { send_game_macro("Left click to win!"); }
394 return false; break;
373 case KC_JUSTGAME: 395 case KC_JUSTGAME:
374 if (!record->event.pressed) { 396 if (!record->event.pressed) { send_game_macro("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games."); }
375 send_game_macro("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games."); 397 return false; break;
376 }
377 return false;
378 break;
379 case KC_TORB: 398 case KC_TORB:
380 if (!record->event.pressed) { 399 if (!record->event.pressed) { send_game_macro("That was positively riveting!"); }
381 send_game_macro("That was positively riveting!"); 400 return false; break;
382 }
383 return false;
384 break;
385 case KC_AIM: 401 case KC_AIM:
386 if (!record->event.pressed) { 402 if (!record->event.pressed) {
387 send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!"); 403 send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!");
388 wait_ms(3000); 404 wait_ms(3000);
389 send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!"); 405 send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!");
390 } 406 }
391 return false; 407 return false; break;
392 break;
393 case KC_C9: 408 case KC_C9:
394 if (!record->event.pressed) { 409 if (!record->event.pressed) { send_game_macro("OMG!!! C9!!!"); }
395 send_game_macro("OMG!!! C9!!!"); 410 return false; break;
396 }
397 return false;
398 break;
399 case KC_GGEZ: 411 case KC_GGEZ:
400 if (!record->event.pressed) { 412 if (!record->event.pressed) { send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!"); }
401 send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!"); 413 return false; break;
402 } 414#endif // !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez))
403 return false; 415
404 break; 416
405#endif
406#ifdef TAP_DANCE_ENABLE 417#ifdef TAP_DANCE_ENABLE
407 case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them 418 case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them
408 if (record->event.pressed) { 419 if (record->event.pressed) {
@@ -412,78 +423,37 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
412 diablo_key_time[dtime] = diablo_times[0]; 423 diablo_key_time[dtime] = diablo_times[0];
413 } 424 }
414 } 425 }
415 return false; 426 return false; break;
416 break; 427#endif // TAP_DANCE_ENABLE
417#endif 428
418 case KC_MAKE: 429
419 if (!record->event.pressed) {
420 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
421#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
422 ":dfu"
423#elif defined(BOOTLOADER_HALFKAY)
424 ":teensy"
425//#elif defined(BOOTLOADER_CATERINA)
426// ":avrdude"
427#endif
428 SS_TAP(X_ENTER));
429 }
430 return false;
431 break;
432 case KC_RESET:
433 if (!record->event.pressed) {
434#ifdef RGBLIGHT_ENABLE
435 rgblight_enable();
436 rgblight_mode(1);
437 rgblight_setrgb(0xff, 0x00, 0x00);
438#endif
439 reset_keyboard();
440 }
441 return false;
442 break;
443 case EPRM:
444 if (record->event.pressed) {
445 eeconfig_init();
446 }
447 return false;
448 break;
449 case VRSN:
450 if (record->event.pressed) {
451 SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
452 }
453 return false;
454 break;
455 case KC_SECRET_1 ... KC_SECRET_5:
456 if (!record->event.pressed) {
457 send_string_P(secret[keycode - KC_SECRET_1]);
458 }
459 return false;
460 break;
461 case KC_FXCL: 430 case KC_FXCL:
462 if (!record->event.pressed) { 431 if (!record->event.pressed) { // Toggles the custom faux click code
463 faux_click_enabled = !faux_click_enabled; 432 faux_click_enabled = !faux_click_enabled;
464 } 433 }
465 return false; 434 return false; break;
466 break; 435 case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
467 case KC_RGB_T: // Because I want the option to go back to normal RGB mode rather than always layer indication
468#ifdef RGBLIGHT_ENABLE 436#ifdef RGBLIGHT_ENABLE
469 if (record->event.pressed) { 437 if (record->event.pressed) {
470 rgb_layer_change = !rgb_layer_change; 438 rgb_layer_change = !rgb_layer_change;
439 if (rgb_layer_change) {
440 layer_state_set(layer_state); // This is needed to immediately set the layer color (looks beetter)
441 }
471 } 442 }
472#endif 443#endif // RGBLIGHT_ENABLE
473 return false; 444 return false; break;
474 break;
475#ifdef RGBLIGHT_ENABLE 445#ifdef RGBLIGHT_ENABLE
476 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions 446 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
477 if (record->event.pressed) { //This disrables layer indication, as it's assumed that if you're changing this ... you want that disabled 447 if (record->event.pressed) { //This disrables layer indication, as it's assumed that if you're changing this ... you want that disabled
478 rgb_layer_change = false; 448 rgb_layer_change = false;
479 } 449 }
480 return true; 450 return true; break;
481 break; 451#endif // RGBLIGHT_ENABLE
482#endif
483 } 452 }
484 return process_record_keymap(keycode, record); 453 return process_record_keymap(keycode, record);
485} 454}
486 455
456
487// Runs state check and changes underglow color and animation 457// Runs state check and changes underglow color and animation
488// on layer change, no matter where the change was initiated 458// on layer change, no matter where the change was initiated
489// Then runs keymap's layer change check 459// Then runs keymap's layer change check
@@ -536,7 +506,7 @@ uint32_t layer_state_set_user(uint32_t state) {
536 rgblight_set_green; 506 rgblight_set_green;
537 rgblight_mode(2); 507 rgblight_mode(2);
538 break; 508 break;
539 default: 509 default: // for any other layers, or the default layer
540 if (default_layer & (1UL << _COLEMAK)) { 510 if (default_layer & (1UL << _COLEMAK)) {
541 rgblight_set_magenta; 511 rgblight_set_magenta;
542 } 512 }
@@ -549,9 +519,9 @@ uint32_t layer_state_set_user(uint32_t state) {
549 else { 519 else {
550 rgblight_set_teal; 520 rgblight_set_teal;
551 } 521 }
552 if (biton32(state) == _MODS) { 522 if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe
553 rgblight_mode(2); 523 rgblight_mode(2);
554 } else { 524 } else { // otherwise, stay solid
555 rgblight_mode(1); 525 rgblight_mode(1);
556 } 526 }
557 break; 527 break;
@@ -562,3 +532,9 @@ uint32_t layer_state_set_user(uint32_t state) {
562} 532}
563 533
564 534
535// Any custom LED code goes here.
536// So far, I only have keyboard specific code,
537// So nothing goes here.
538void led_set_user(uint8_t usb_led) {
539 led_set_keymap(usb_led);
540}