aboutsummaryrefslogtreecommitdiff
path: root/layouts/community/ergodox
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2021-01-22 08:23:03 -0800
committerGitHub <noreply@github.com>2021-01-22 08:23:03 -0800
commit7a08b9d374dfcf9d872738af44b231862064b96f (patch)
treea83e16b5b6afd67b22fcbdf81ced5896554ca631 /layouts/community/ergodox
parentc16a3dcb5458bc8d237d26c20a434c333b48d5c8 (diff)
downloadqmk_firmware-7a08b9d374dfcf9d872738af44b231862064b96f.tar.gz
qmk_firmware-7a08b9d374dfcf9d872738af44b231862064b96f.zip
[Keymap] Cleanup and updating of drashna keymap code (#11516)
* Update other keyboards for rgb matrix changes * Remove customized bootmagic code * Fix corne layout compilation error * Fix compiler errors with all keymaps * Add Simple Visualizer for ergodox infinity * Fix compile issue with Corne * Fix keymap stuff * Add alias for mouse layer * Add Halmak Keyboard layout * Updates for Kyria * Add support for oled interval * Change RGB stuff [CHANGE] Fix coexistence issues * Fix rgb_stuff * Add custom ploopyco mouse keymap * Decrease default dwell time * Updates based on last breaking changes update * Disable command on dactyl * Update ergodox to use proper commands for rgb matrix indicators * Update all rgb matrix indicator functions * Update rules for dactyl-manuform * Reduce wait time for mouse layer off event * Add more info to logger * Add wrappers for get_tapping term * Move version.h include into only file that actually needs it * Update rgb sleep stuff * Update key print function * Change DM keymap settings * Change pin for DM Manuform * Add Proton C stuff for Corne keymap * more arm corne tinkering * Even more arm stuff for corne * Cleanup corne stuff * redirect default keymap to drashna because I am a very bad man * change corne rgb priority * Update tractyl manuform to not conflict * Add more secret stuff * more dactyl tweaks * Add more options to split transport * Changes of oled support * Change split settings * Improve keylogger formatting more * tweak oled stuff * Oled and such tweaks * Reduce brightness due to leds * Decrease brightness more * Only run layer code if master
Diffstat (limited to 'layouts/community/ergodox')
-rw-r--r--layouts/community/ergodox/drashna/config.h1
-rw-r--r--layouts/community/ergodox/drashna/keymap.c63
-rw-r--r--layouts/community/ergodox/drashna/visualizer.c77
3 files changed, 107 insertions, 34 deletions
diff --git a/layouts/community/ergodox/drashna/config.h b/layouts/community/ergodox/drashna/config.h
index a595a93c4..4ccba8f04 100644
--- a/layouts/community/ergodox/drashna/config.h
+++ b/layouts/community/ergodox/drashna/config.h
@@ -42,7 +42,6 @@
42# undef RGB_MATRIX_LED_FLUSH_LIMIT 42# undef RGB_MATRIX_LED_FLUSH_LIMIT
43# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE) 43# if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_ENABLE)
44# define RGBLIGHT_LIMIT_VAL 100 44# define RGBLIGHT_LIMIT_VAL 100
45# undef RGBLIGHT_SLEEP
46# endif 45# endif
47#endif 46#endif
48 47
diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c
index 5f1c0c8a0..fb5bcc6bd 100644
--- a/layouts/community/ergodox/drashna/keymap.c
+++ b/layouts/community/ergodox/drashna/keymap.c
@@ -446,70 +446,65 @@ void suspend_power_down_keymap(void) { rgb_matrix_set_suspend_state(true); }
446 446
447void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } 447void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); }
448 448
449void rgb_matrix_indicators_user(void) { 449void rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
450 if (g_suspend_state || !rgb_matrix_config.enable) return;
451 450
452 if (layer_state_is(_GAMEPAD)) { 451 if (layer_state_is(_GAMEPAD)) {
453 rgb_matrix_set_color(32, 0x00, 0xFF, 0x00); // Q 452 RGB_MATRIX_INDICATOR_SET_COLOR(32, 0x00, 0xFF, 0x00); // Q
454 rgb_matrix_set_color(31, 0x00, 0xFF, 0xFF); // W 453 RGB_MATRIX_INDICATOR_SET_COLOR(31, 0x00, 0xFF, 0xFF); // W
455 rgb_matrix_set_color(30, 0xFF, 0x00, 0x00); // E 454 RGB_MATRIX_INDICATOR_SET_COLOR(30, 0xFF, 0x00, 0x00); // E
456 rgb_matrix_set_color(29, 0xFF, 0x80, 0x00); // R 455 RGB_MATRIX_INDICATOR_SET_COLOR(29, 0xFF, 0x80, 0x00); // R
457 rgb_matrix_set_color(37, 0x00, 0xFF, 0xFF); // A 456 RGB_MATRIX_INDICATOR_SET_COLOR(37, 0x00, 0xFF, 0xFF); // A
458 rgb_matrix_set_color(36, 0x00, 0xFF, 0xFF); // S 457 RGB_MATRIX_INDICATOR_SET_COLOR(36, 0x00, 0xFF, 0xFF); // S
459 rgb_matrix_set_color(35, 0x00, 0xFF, 0xFF); // D 458 RGB_MATRIX_INDICATOR_SET_COLOR(35, 0x00, 0xFF, 0xFF); // D
460 rgb_matrix_set_color(34, 0x7A, 0x00, 0xFF); // F 459 RGB_MATRIX_INDICATOR_SET_COLOR(34, 0x7A, 0x00, 0xFF); // F
461 460
462 rgb_matrix_set_color(userspace_config.swapped_numbers ? 27 : 26, 0xFF, 0xFF, 0xFF); // 1 461 RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 26 : 27), 0xFF, 0xFF, 0xFF); // 1
463 rgb_matrix_set_color(userspace_config.swapped_numbers ? 26 : 27, 0x00, 0xFF, 0x00); // 2 462 RGB_MATRIX_INDICATOR_SET_COLOR((userspace_config.swapped_numbers ? 27 : 26), 0x00, 0xFF, 0x00); // 2
464 rgb_matrix_set_color(25, 0x7A, 0x00, 0xFF); // 3 463 RGB_MATRIX_INDICATOR_SET_COLOR(25, 0x7A, 0x00, 0xFF); // 3
465 } 464 }
466 465
467# if defined(RGBLIGHT_ENABLE) 466
468 if (!userspace_config.rgb_layer_change) 467 if (userspace_config.rgb_layer_change) {
469# else
470 if (userspace_config.rgb_layer_change)
471# endif
472 {
473 bool mods_enabled = IS_LAYER_ON(_MODS); 468 bool mods_enabled = IS_LAYER_ON(_MODS);
474 switch (get_highest_layer(layer_state|default_layer_state)) { 469 switch (get_highest_layer(layer_state|default_layer_state)) {
475 case _GAMEPAD: 470 case _GAMEPAD:
476 rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 471 rgb_matrix_layer_helper(HSV_ORANGE, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
477 break; 472 break;
478 case _DIABLO: 473 case _DIABLO:
479 rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER); 474 rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed * 8, LED_FLAG_MODIFIER, led_min, led_max);
480 break; 475 break;
481 case _RAISE: 476 case _RAISE:
482 rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 477 rgb_matrix_layer_helper(HSV_YELLOW, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
483 break; 478 break;
484 case _LOWER: 479 case _LOWER:
485 rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 480 rgb_matrix_layer_helper(HSV_GREEN, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
486 break; 481 break;
487 case _ADJUST: 482 case _ADJUST:
488 rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 483 rgb_matrix_layer_helper(HSV_RED, 1, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
489 break; 484 break;
490 case _QWERTY: 485 case _QWERTY:
491 rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 486 rgb_matrix_layer_helper(HSV_CYAN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
492 break; 487 break;
493 case _COLEMAK: 488 case _COLEMAK:
494 rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 489 rgb_matrix_layer_helper(HSV_MAGENTA, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
495 break; 490 break;
496 case _DVORAK: 491 case _DVORAK:
497 rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 492 rgb_matrix_layer_helper(HSV_SPRINGGREEN, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
498 break; 493 break;
499 case _WORKMAN: 494 case _WORKMAN:
500 rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 495 rgb_matrix_layer_helper(HSV_GOLDENROD, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
501 break; 496 break;
502 case _NORMAN: 497 case _NORMAN:
503 rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 498 rgb_matrix_layer_helper(HSV_CORAL, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
504 break; 499 break;
505 case _MALTRON: 500 case _MALTRON:
506 rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 501 rgb_matrix_layer_helper(HSV_YELLOW, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
507 break; 502 break;
508 case _EUCALYN: 503 case _EUCALYN:
509 rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 504 rgb_matrix_layer_helper(HSV_PINK, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
510 break; 505 break;
511 case _CARPLAX: 506 case _CARPLAX:
512 rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER); 507 rgb_matrix_layer_helper(HSV_BLUE, mods_enabled, rgb_matrix_config.speed, LED_FLAG_MODIFIER, led_min, led_max);
513 break; 508 break;
514 } 509 }
515 } 510 }
@@ -517,6 +512,7 @@ void rgb_matrix_indicators_user(void) {
517 512
518#endif // RGB_MATRIX_INIT 513#endif // RGB_MATRIX_INIT
519 514
515#ifdef TAPPING_TERM_PER_KEY
520uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { 516uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
521 if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) { 517 if (keycode >= QK_MOD_TAP && keycode <= QK_MOD_TAP_MAX) {
522 if (mod_config(keycode & 0xf) & MOD_MASK_ALT) { 518 if (mod_config(keycode & 0xf) & MOD_MASK_ALT) {
@@ -525,3 +521,4 @@ uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
525 } 521 }
526 return TAPPING_TERM; 522 return TAPPING_TERM;
527} 523}
524#endif
diff --git a/layouts/community/ergodox/drashna/visualizer.c b/layouts/community/ergodox/drashna/visualizer.c
new file mode 100644
index 000000000..6b1c3ff49
--- /dev/null
+++ b/layouts/community/ergodox/drashna/visualizer.c
@@ -0,0 +1,77 @@
1/*
2Copyright 2017 Fred Sundvik
3
4This program is free software: you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation, either version 2 of the License, or
7(at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17
18#include "./simple_visualizer.h"
19#include "util.h"
20#include "drashna.h"
21#include "rgblight_list.h"
22
23#define LCD_COLOR_wrapper(...) LCD_COLOR(__VA_ARGS__)
24// This function should be implemented by the keymap visualizer
25// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
26// that the simple_visualizer assumes that you are updating
27// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
28// stopped. This can be done by either double buffering it or by using constant strings
29static void get_visualizer_layer_and_color(visualizer_state_t* state) {
30
31 switch(get_highest_layer(state->status.layer|default_layer_state)) {
32 case _LOWER:
33 state->layer_text = "Lower";
34 state->target_lcd_color = LCD_COLOR_wrapper(HSV_GREEN);
35 break;
36 case _RAISE:
37 state->layer_text = "Raise";
38 state->target_lcd_color = LCD_COLOR_wrapper(HSV_YELLOW);
39 break;
40 case _ADJUST:
41 state->layer_text = "Adjust";
42 state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED);
43 break;
44 case _MACROS:
45 state->layer_text = "Macros";
46 state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE);
47 break;
48 case _MEDIA:
49 state->layer_text = "Media";
50 state->target_lcd_color = LCD_COLOR_wrapper(HSV_CHARTREUSE);
51 break;
52 case _GAMEPAD:
53 state->layer_text = "Game";
54 state->target_lcd_color = LCD_COLOR_wrapper(HSV_ORANGE);
55 break;
56 case _QWERTY:
57 state->layer_text = "QWERTY";
58 state->target_lcd_color = LCD_COLOR_wrapper(HSV_CYAN);
59 break;
60 case _WORKMAN:
61 state->layer_text = "Workman";
62 state->target_lcd_color = LCD_COLOR_wrapper(HSV_GOLDENROD);
63 break;
64 case _DVORAK:
65 state->layer_text = "Dvorak";
66 state->target_lcd_color = LCD_COLOR_wrapper(HSV_SPRINGGREEN);
67 break;
68 case _COLEMAK:
69 state->layer_text = "Colemak";
70 state->target_lcd_color = LCD_COLOR_wrapper(HSV_MAGENTA);
71 break; break;
72 default:
73 state->layer_text = "NONE";
74 state->target_lcd_color = LCD_COLOR_wrapper(HSV_RED);
75 break;
76 }
77}