aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-05-31 22:11:06 -0700
committerJack Humbert <jack.humb@gmail.com>2018-06-01 01:11:06 -0400
commit3d1349b280d9c0a57e37b5347a405426de6dba10 (patch)
tree0b8c989d0c902115e2ce51c8bb9dc201b0e2eb0c
parent8eaf23ae8146766615cc1cec3fc8e04111e8ef49 (diff)
downloadqmk_firmware-3d1349b280d9c0a57e37b5347a405426de6dba10.tar.gz
qmk_firmware-3d1349b280d9c0a57e37b5347a405426de6dba10.zip
Big overhaul to Drashna keymaps and userspace (#3097)
* Optimize secrets code * Orthodox tweaks * rules.mk features * Minor cleanup * Revert mod bits * Force Hold breaks One Shot Tap Toggle * Cleanup * Moke keymaps more consistent * minor ergodox tweak * More OSM for the Orthodox * Cleanup of userspace * Toggle Secrets * Add hidden process record for super secret macros * Make sure secret macros always compiles * finish up making them super secret * Add ColinTA's rgb twinkle as WIP * Optimize RGB Twinkling for typing Also, tweak RGB indicators. AND WTF, I HAVE NO IDEA WHY THE INDICATORS ONLY WORK AS IS. The logical method for getting them working doesn't ... and it's beyond bizarre * Make console logging more configurable * Indicator travisty * Clean up userspace rgb code * Optimize RGB Twinking to work on default layer only, and to base it's color on the curent hue * Eff it... rgblight_sethsv_at runs at every matrix scan * RGB Twinkle cleanup * Update Iris code for new board * Move RGB Indicator and RGB Twinkle into userspace * Move RGB Indicator code to rgb_stuff.c * Major cleanup of RGB Code in userspace * Additional cleanup of RGB code in userspace * Use noeeprom functions to save my boards! * Enable RGB Sleep on all boards now * Add old iris board * tapping tweak * Use byte 19 for eeprom to prepare for possible merge of eeconfig function pr * Add code to fix default layer after eeprom reset
-rw-r--r--keyboards/iris/keymaps/drashna/config.h11
-rw-r--r--keyboards/iris/keymaps/drashna/keymap.c108
-rw-r--r--keyboards/iris/keymaps/drashna/rules.mk7
-rw-r--r--keyboards/iris/keymaps/drashna_old/config.h70
-rw-r--r--keyboards/iris/keymaps/drashna_old/keymap.c89
-rw-r--r--keyboards/iris/keymaps/drashna_old/rules.mk17
-rw-r--r--keyboards/orthodox/keymaps/drashna/config.h10
-rw-r--r--keyboards/orthodox/keymaps/drashna/keymap.c116
-rw-r--r--keyboards/orthodox/keymaps/drashna/rules.mk3
-rw-r--r--keyboards/viterbi/keymaps/drashna/rules.mk7
-rw-r--r--layouts/community/ergodox/drashna/keymap.c20
-rw-r--r--layouts/community/ergodox/drashna/rules.mk8
-rw-r--r--users/drashna/config.h11
-rw-r--r--users/drashna/drashna.c340
-rw-r--r--users/drashna/drashna.h30
-rw-r--r--users/drashna/readme.md4
-rw-r--r--users/drashna/rgb_stuff.c261
-rw-r--r--users/drashna/rgb_stuff.h16
-rw-r--r--users/drashna/rules.mk29
-rw-r--r--users/drashna/tap_dances.c65
-rw-r--r--users/drashna/tap_dances.h7
21 files changed, 731 insertions, 498 deletions
diff --git a/keyboards/iris/keymaps/drashna/config.h b/keyboards/iris/keymaps/drashna/config.h
index bfdd0022b..d2c112923 100644
--- a/keyboards/iris/keymaps/drashna/config.h
+++ b/keyboards/iris/keymaps/drashna/config.h
@@ -33,7 +33,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
33 33
34#ifdef RGBLIGHT_ENABLE 34#ifdef RGBLIGHT_ENABLE
35#undef RGBLED_NUM 35#undef RGBLED_NUM
36#define RGBLED_NUM 16 // Number of LEDs 36#define RGBLED_NUM 18 // Number of LEDs
37#define RGBLIGHT_ANIMATIONS 37#define RGBLIGHT_ANIMATIONS
38#define RGBLIGHT_HUE_STEP 12 38#define RGBLIGHT_HUE_STEP 12
39#define RGBLIGHT_SAT_STEP 12 39#define RGBLIGHT_SAT_STEP 12
@@ -58,4 +58,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
58#define PRODUCT Drashna Hacked Iris Rev.2 58#define PRODUCT Drashna Hacked Iris Rev.2
59#endif 59#endif
60 60
61#define SHFT_LED1 6
62#define SHFT_LED2 11
63
64#define CTRL_LED1 7
65#define CTRL_LED2 10
66
67#define GUI_LED1 8
68#define GUI_LED2 9
69
61#endif 70#endif
diff --git a/keyboards/iris/keymaps/drashna/keymap.c b/keyboards/iris/keymaps/drashna/keymap.c
index b24e5fe53..bc3cd38ad 100644
--- a/keyboards/iris/keymaps/drashna/keymap.c
+++ b/keyboards/iris/keymaps/drashna/keymap.c
@@ -2,15 +2,6 @@
2#include QMK_KEYBOARD_H 2#include QMK_KEYBOARD_H
3#include "drashna.h" 3#include "drashna.h"
4 4
5#ifdef INDICATOR_LIGHTS
6extern userspace_config_t userspace_config;
7
8uint8_t last_mod;
9uint8_t last_led;
10uint8_t last_osm;
11bool has_mods_changed = false;
12#endif
13
14#define KC_ALAP ALT_T(KC_APP) 5#define KC_ALAP ALT_T(KC_APP)
15#define KC_OSLG OSM(MOD_LGUI) 6#define KC_OSLG OSM(MOD_LGUI)
16const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 7const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -55,7 +46,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
55 46
56 [_LOWER] = LAYOUT_wrapper( 47 [_LOWER] = LAYOUT_wrapper(
57 _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, 48 _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
58 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 49 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
59 _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, 50 _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
60 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, 51 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______,
61 _______, _______, _______, _______, _______, _______ 52 _______, _______, _______, _______, _______, _______
@@ -63,7 +54,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
63 54
64 [_RAISE] = LAYOUT_wrapper( 55 [_RAISE] = LAYOUT_wrapper(
65 _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______, 56 _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
66 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 57 KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, _______,
67 _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, 58 _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
68 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______, 59 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______,
69 _______, _______, _______, _______, _______, _______ 60 _______, _______, _______, _______, _______, _______
@@ -71,93 +62,28 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
71 62
72 [_ADJUST] = LAYOUT_wrapper( 63 [_ADJUST] = LAYOUT_wrapper(
73 KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST, 64 KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST,
74 VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, _______, _______, _______, _______, _______, EPRM, 65 VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_NUKE, _______, _______, _______, _______, EPRM,
75 _______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, _______, 66 _______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS),
76 TG(_MODS),RGB_SMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, 67 _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY,
77 _______, _______, _______, _______, _______, _______ 68 _______, _______, _______, _______, _______, _______
78 ) 69 )
79 70
80}; 71};
81 72
82 73
83void matrix_init_keymap(void) { 74bool indicator_is_this_led_used(uint8_t index) {
75 switch (index) {
84#ifdef INDICATOR_LIGHTS 76#ifdef INDICATOR_LIGHTS
85 last_mod = get_mods(); 77 case SHFT_LED1:
86 last_led = host_keyboard_leds(); 78 case SHFT_LED2:
87 last_osm =get_oneshot_mods(); 79 case CTRL_LED1:
80 case CTRL_LED2:
81 case GUI_LED1:
82 case GUI_LED2:
83 return true;
84 break;
88#endif 85#endif
89} 86 default:
90 87 return false;
91uint32_t layer_state_set_keymap (uint32_t state) {
92#ifdef INDICATOR_LIGHTS
93 uint8_t modifiders = get_mods();
94 uint8_t led_usb_state = host_keyboard_leds();
95 uint8_t one_shot = get_oneshot_mods();
96
97
98 if (modifiders & MODS_SHIFT_MASK || led_usb_state & (1<<USB_LED_CAPS_LOCK) || one_shot & MODS_SHIFT_MASK) {
99 rgblight_sethsv_at(0, 255, 255, 5);
100 rgblight_sethsv_at(0, 255, 255, 10);
101 }
102 if (modifiders & MODS_CTRL_MASK || one_shot & MODS_CTRL_MASK) {
103 rgblight_sethsv_at(51, 255, 255, 6);
104 rgblight_sethsv_at(51, 255, 255, 9);
105 }
106 if (modifiders & MODS_ALT_MASK || one_shot & MODS_ALT_MASK) {
107 rgblight_sethsv_at(120, 255, 255, 7);
108 rgblight_sethsv_at(120, 255, 255, 8);
109 } 88 }
110#endif
111
112 return state;
113}
114
115
116void matrix_scan_keymap (void) {
117
118#ifdef INDICATOR_LIGHTS
119 uint8_t current_mod = get_mods();
120 uint8_t current_led = host_keyboard_leds();
121 uint8_t current_osm =get_oneshot_mods();
122
123 if (last_mod == current_mod) {
124 last_mod = current_mod;
125 has_mods_changed = true;
126 }
127 if (last_led == current_led) {
128 last_led = current_led;
129 has_mods_changed = true;
130 }
131 if (last_osm == current_osm) {
132 last_osm = current_osm;
133 has_mods_changed = true;
134 }
135
136
137 if (userspace_config.rgb_layer_change && has_mods_changed && biton32(layer_state) == 0) {
138 if (current_mod & MODS_SHIFT_MASK || current_led & (1<<USB_LED_CAPS_LOCK) || current_osm & MODS_SHIFT_MASK) {
139 rgblight_sethsv_at(0, 255, 255, 5);
140 rgblight_sethsv_at(0, 255, 255, 10);
141 } else {
142 rgblight_sethsv_default_helper(5);
143 rgblight_sethsv_default_helper(10);
144 }
145 if (current_mod & MODS_CTRL_MASK || current_osm & MODS_CTRL_MASK) {
146 rgblight_sethsv_at(51, 255, 255, 6);
147 rgblight_sethsv_at(51, 255, 255, 9);
148 } else {
149 rgblight_sethsv_default_helper(6);
150 rgblight_sethsv_default_helper(9);
151 }
152 if (current_mod & MODS_GUI_MASK || current_osm & MODS_GUI_MASK) {
153 rgblight_sethsv_at(120, 255, 255, 7);
154 rgblight_sethsv_at(120, 255, 255, 8);
155 } else {
156 rgblight_sethsv_default_helper(7);
157 rgblight_sethsv_default_helper(8);
158
159 }
160 }
161#endif
162
163} 89}
diff --git a/keyboards/iris/keymaps/drashna/rules.mk b/keyboards/iris/keymaps/drashna/rules.mk
index 2608985c6..1b2604239 100644
--- a/keyboards/iris/keymaps/drashna/rules.mk
+++ b/keyboards/iris/keymaps/drashna/rules.mk
@@ -7,6 +7,9 @@ TAP_DANCE_ENABLE = no
7RGBLIGHT_ENABLE = yes 7RGBLIGHT_ENABLE = yes
8AUDIO_ENABLE = yes 8AUDIO_ENABLE = yes
9NKRO_ENABLE = yes 9NKRO_ENABLE = yes
10BACKLIGHT_ENABLE = no 10BACKLIGHT_ENABLE = no
11SWAP_HANDS_ENABLE = yes 11SWAP_HANDS_ENABLE = no
12
12INDICATOR_LIGHTS = yes 13INDICATOR_LIGHTS = yes
14MACROS_ENABLED = no
15RGBLIGHT_TWINKLE = yes
diff --git a/keyboards/iris/keymaps/drashna_old/config.h b/keyboards/iris/keymaps/drashna_old/config.h
new file mode 100644
index 000000000..4eec67148
--- /dev/null
+++ b/keyboards/iris/keymaps/drashna_old/config.h
@@ -0,0 +1,70 @@
1/*
2Copyright 2017 Danny Nguyen <danny@keeb.io>
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#ifndef CONFIG_USER_H
19#define CONFIG_USER_H
20
21#include "config_common.h"
22
23/* Use I2C or Serial, not both */
24
25#define USE_SERIAL
26#undef USE_I2C
27
28/* Select hand configuration */
29
30// #define MASTER_LEFT
31// #define MASTER_RIGHT
32#define EE_HANDS
33
34#ifdef RGBLIGHT_ENABLE
35#undef RGBLED_NUM
36#define RGBLED_NUM 16 // Number of LEDs
37#define RGBLIGHT_ANIMATIONS
38#define RGBLIGHT_HUE_STEP 12
39#define RGBLIGHT_SAT_STEP 12
40#define RGBLIGHT_VAL_STEP 12
41#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
42#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
43#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
44
45#define RGBLIGHT_LIMIT_VAL 225
46#endif // RGBLIGHT_ENABLE
47
48#ifdef AUDIO_ENABLE
49#define C6_AUDIO
50#ifdef RGBLIGHT_ENABLE
51#define NO_MUSIC_MODE
52#endif //RGBLIGHT_ENABLE
53#endif //AUDIO_ENABLE
54
55
56#undef PRODUCT
57#ifdef KEYBOARD_iris_rev2
58#define PRODUCT Drashna Hacked Iris Rev.2
59#endif
60
61#define SHFT_LED1 5
62#define SHFT_LED2 10
63
64#define CTRL_LED1 6
65#define CTRL_LED2 9
66
67#define GUI_LED1 7
68#define GUI_LED2 8
69
70#endif
diff --git a/keyboards/iris/keymaps/drashna_old/keymap.c b/keyboards/iris/keymaps/drashna_old/keymap.c
new file mode 100644
index 000000000..bc3cd38ad
--- /dev/null
+++ b/keyboards/iris/keymaps/drashna_old/keymap.c
@@ -0,0 +1,89 @@
1
2#include QMK_KEYBOARD_H
3#include "drashna.h"
4
5#define KC_ALAP ALT_T(KC_APP)
6#define KC_OSLG OSM(MOD_LGUI)
7const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
8
9 [_QWERTY] = LAYOUT_wrapper(
10 KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS,
11 KC_TAB , _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSLS,
12 KC_CCCV, _________________QWERTY_L2_________________, _________________QWERTY_R2_________________, KC_QUOT,
13 KC_MLSF, _________________QWERTY_L3_________________, KC_ALAP, KC_OSLG, _________________QWERTY_R3_________________, KC_MRSF,
14 LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
15 ),
16 [_COLEMAK] = LAYOUT_wrapper(
17 KC_ESC , ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS,
18 KC_TAB , _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSLS,
19 KC_CCCV, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT,
20 KC_MLSF, _________________COLEMAK_L3________________, KC_ALAP, KC_OSLG, _________________COLEMAK_R3________________, KC_MRSF,
21 LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
22 ),
23 [_DVORAK] = LAYOUT_wrapper(
24 KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS,
25 KC_TAB , _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSLS,
26 KC_CCCV, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_QUOT,
27 KC_MLSF, _________________DVORAK_L3_________________, KC_ALAP, KC_OSLG, _________________DVORAK_R3_________________, KC_MRSF,
28 LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
29 ),
30 [_WORKMAN] = LAYOUT_wrapper(
31 KC_ESC, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_MINS,
32 KC_TAB , _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSLS,
33 KC_CCCV, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT,
34 KC_MLSF, _________________WORKMAN_L3________________, KC_ALAP, KC_OSLG, _________________WORKMAN_R3________________, KC_MRSF,
35 LT(_LOWER,KC_GRV), KC_SPC, KC_BSPC, KC_DEL, KC_ENT, RAISE
36 ),
37
38 [_MODS] = LAYOUT_wrapper(
39 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
40 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
41 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
42 KC_LSFT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT,
43 _______, _______, _______, _______, _______, _______
44 ),
45
46
47 [_LOWER] = LAYOUT_wrapper(
48 _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
49 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
50 _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
51 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______,
52 _______, _______, _______, _______, _______, _______
53 ),
54
55 [_RAISE] = LAYOUT_wrapper(
56 _______, _________________FUNC_LEFT_________________, _________________FUNC_RIGHT________________, _______,
57 KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, _______,
58 _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
59 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______,
60 _______, _______, _______, _______, _______, _______
61 ),
62
63 [_ADJUST] = LAYOUT_wrapper(
64 KC_MAKE, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST,
65 VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_NUKE, _______, _______, _______, _______, EPRM,
66 _______, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS),
67 _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY,
68 _______, _______, _______, _______, _______, _______
69 )
70
71};
72
73
74bool indicator_is_this_led_used(uint8_t index) {
75 switch (index) {
76#ifdef INDICATOR_LIGHTS
77 case SHFT_LED1:
78 case SHFT_LED2:
79 case CTRL_LED1:
80 case CTRL_LED2:
81 case GUI_LED1:
82 case GUI_LED2:
83 return true;
84 break;
85#endif
86 default:
87 return false;
88 }
89}
diff --git a/keyboards/iris/keymaps/drashna_old/rules.mk b/keyboards/iris/keymaps/drashna_old/rules.mk
new file mode 100644
index 000000000..1a6b63f16
--- /dev/null
+++ b/keyboards/iris/keymaps/drashna_old/rules.mk
@@ -0,0 +1,17 @@
1USER_NAME := drashna
2
3BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration(+1000)
4MOUSEKEY_ENABLE = no # Mouse keys(+4700)
5EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
6CONSOLE_ENABLE = no # Console for debug(+400)
7COMMAND_ENABLE = no # Commands for debug and configuration
8TAP_DANCE_ENABLE = no
9RGBLIGHT_ENABLE = yes
10AUDIO_ENABLE = yes
11NKRO_ENABLE = yes
12BACKLIGHT_ENABLE = no
13SWAP_HANDS_ENABLE = no
14
15INDICATOR_LIGHTS = yes
16MACROS_ENABLED = no
17RGBLIGHT_TWINKLE = yes
diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h
index 1c3620616..8c283e7ca 100644
--- a/keyboards/orthodox/keymaps/drashna/config.h
+++ b/keyboards/orthodox/keymaps/drashna/config.h
@@ -76,4 +76,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
76#define QMK_LED B0 76#define QMK_LED B0
77#define QMK_SPEAKER C6 77#define QMK_SPEAKER C6
78 78
79
80#define SHFT_LED1 5
81#define SHFT_LED2 10
82
83#define CTRL_LED1 6
84#define CTRL_LED2 9
85
86#define GUI_LED1 7
87#define GUI_LED2 8
88
79#endif 89#endif
diff --git a/keyboards/orthodox/keymaps/drashna/keymap.c b/keyboards/orthodox/keymaps/drashna/keymap.c
index bcc59268c..c65e21cb0 100644
--- a/keyboards/orthodox/keymaps/drashna/keymap.c
+++ b/keyboards/orthodox/keymaps/drashna/keymap.c
@@ -28,7 +28,6 @@ extern userspace_config_t userspace_config;
28uint8_t last_mod; 28uint8_t last_mod;
29uint8_t last_led; 29uint8_t last_led;
30uint8_t last_osm; 30uint8_t last_osm;
31bool has_mods_changed = false;
32#endif 31#endif
33 32
34// Each layer gets a name for readability, which is then used in the keymap matrix below. 33// Each layer gets a name for readability, which is then used in the keymap matrix below.
@@ -46,25 +45,25 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
46 45
47[_QWERTY] = LAYOUT_wrapper(\ 46[_QWERTY] = LAYOUT_wrapper(\
48 KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC, 47 KC_ESC, _________________QWERTY_L1_________________, _________________QWERTY_R1_________________, KC_BSPC,
49 KC_TAB, _________________QWERTY_L2_________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________QWERTY_R2_________________, KC_QUOT, 48 KC_TAB, _________________QWERTY_L2_________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________QWERTY_R2_________________, KC_QUOT,
50 KC_MLSF, _________________QWERTY_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________QWERTY_R3_________________, KC_LGUI 49 KC_MLSF, _________________QWERTY_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________QWERTY_R3_________________, KC_MRSF
51), 50),
52 51
53[_COLEMAK] = LAYOUT_wrapper(\ 52[_COLEMAK] = LAYOUT_wrapper(\
54 KC_ESC, _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSPC, 53 KC_ESC, _________________COLEMAK_L1________________, _________________COLEMAK_R1________________, KC_BSPC,
55 KC_TAB, _________________COLEMAK_L2________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________COLEMAK_R2________________, KC_QUOT, 54 KC_TAB, _________________COLEMAK_L2________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________COLEMAK_R2________________, KC_QUOT,
56 KC_MLSF, _________________COLEMAK_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________COLEMAK_R3________________, KC_LGUI 55 KC_MLSF, _________________COLEMAK_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________COLEMAK_R3________________, KC_MRSF
57), 56),
58 57
59[_DVORAK] = LAYOUT_wrapper(\ 58[_DVORAK] = LAYOUT_wrapper(\
60 KC_ESC, _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSPC, 59 KC_ESC, _________________DVORAK_L1_________________, _________________DVORAK_R1_________________, KC_BSPC,
61 KC_TAB, _________________DVORAK_L2_________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________DVORAK_R2_________________, KC_MINS, 60 KC_TAB, _________________DVORAK_L2_________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________DVORAK_R2_________________, KC_MINS,
62 KC_MLSF, _________________DVORAK_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________DVORAK_R3_________________, KC_LGUI 61 KC_MLSF, _________________DVORAK_L3_________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________DVORAK_R3_________________, KC_MRSF
63), 62),
64[_WORKMAN] = LAYOUT_wrapper(\ 63[_WORKMAN] = LAYOUT_wrapper(\
65 KC_ESC, _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSPC, 64 KC_ESC, _________________WORKMAN_L1________________, _________________WORKMAN_R1________________, KC_BSPC,
66 KC_TAB, _________________WORKMAN_L2________________, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT, _________________WORKMAN_R2________________, KC_MINS, 65 KC_TAB, _________________WORKMAN_L2________________, ALT_APP, OS_LGUI, KC_LALT, OS_RGUI, _________________WORKMAN_R2________________, KC_MINS,
67 KC_MLSF, _________________WORKMAN_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________WORKMAN_R3________________, KC_LGUI 66 KC_MLSF, _________________WORKMAN_L3________________, LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE, _________________WORKMAN_R3________________, KC_MRSF
68), 67),
69[_MODS] = LAYOUT_wrapper(\ 68[_MODS] = LAYOUT_wrapper(\
70 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 69 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -73,105 +72,40 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
73), 72),
74 73
75[_LOWER] = LAYOUT_wrapper(\ 74[_LOWER] = LAYOUT_wrapper(\
76 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, 75 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
77 _______, _________________FUNC_LEFT_________________, KC_PGUP, KC_PGDN, KC_HOME, KC_END, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, 76 KC_F11, _________________FUNC_LEFT_________________, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
78 _______, _________________FUNC_RIGHT________________, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______ 77 KC_F12, _________________FUNC_RIGHT________________, _______, _______, _______, _______, _______, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______
79), 78),
80 79
81[_RAISE] = LAYOUT_wrapper(\ 80[_RAISE] = LAYOUT_wrapper(\
82 KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_BSPC, 81 KC_GRV, ________________NUMBER_LEFT________________, ________________NUMBER_RIGHT_______________, KC_BSPC,
83 _______, _______, _______, _______, _______, _______, KC_PGUP, KC_PGDN, KC_HOME, KC_END, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, 82 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
84 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______ 83 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END, _______
85), 84),
86 85
87[_ADJUST] = LAYOUT_wrapper(\ 86[_ADJUST] = LAYOUT_wrapper(\
88 KC_MAKE, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RESET, 87 KC_MAKE, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RESET,
89 VRSN, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, _______, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, EPRM, 88 VRSN, _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM, _______, _______, _______, KC_NUKE, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, EPRM,
90 TG(_MODS),RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, _______, _______, _______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY 89 TG(_MODS),RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, _______, _______, _______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY
91) 90)
92 91
93 92
94}; 93};
95 94
96void matrix_init_keymap(void) {
97#ifdef INDICATOR_LIGHTS
98 last_mod = get_mods();
99 last_led = host_keyboard_leds();
100 last_osm =get_oneshot_mods();
101#endif
102}
103 95
104uint32_t layer_state_set_keymap (uint32_t state) { 96bool indicator_is_this_led_used(uint8_t index) {
97 switch (index) {
105#ifdef INDICATOR_LIGHTS 98#ifdef INDICATOR_LIGHTS
106 uint8_t modifiders = get_mods(); 99 case SHFT_LED1:
107 uint8_t led_usb_state = host_keyboard_leds(); 100 case SHFT_LED2:
108 uint8_t one_shot = get_oneshot_mods(); 101 case CTRL_LED1:
109 102 case CTRL_LED2:
110 103 case GUI_LED1:
111 if (modifiders & MODS_SHIFT_MASK || led_usb_state & (1<<USB_LED_CAPS_LOCK) || one_shot & MODS_SHIFT_MASK) { 104 case GUI_LED2:
112 rgblight_sethsv_at(0, 255, 255, 5); 105 return true;
113 rgblight_sethsv_at(0, 255, 255, 10); 106 break;
114 }
115 if (modifiders & MODS_CTRL_MASK || one_shot & MODS_CTRL_MASK) {
116 rgblight_sethsv_at(51, 255, 255, 6);
117 rgblight_sethsv_at(51, 255, 255, 9);
118 }
119 if (modifiders & MODS_ALT_MASK || one_shot & MODS_ALT_MASK) {
120 rgblight_sethsv_at(120, 255, 255, 7);
121 rgblight_sethsv_at(120, 255, 255, 8);
122 }
123#endif 107#endif
124 108 default:
125 return state; 109 return false;
126}
127
128
129void matrix_scan_keymap (void) {
130
131#ifdef INDICATOR_LIGHTS
132 uint8_t current_mod = get_mods();
133 uint8_t current_led = host_keyboard_leds();
134 uint8_t current_osm =get_oneshot_mods();
135
136 if (last_mod == current_mod) {
137 last_mod = current_mod;
138 has_mods_changed = true;
139 } 110 }
140 if (last_led == current_led) {
141 last_led = current_led;
142 has_mods_changed = true;
143 }
144 if (last_osm == current_osm) {
145 last_osm = current_osm;
146 has_mods_changed = true;
147 }
148
149
150 if (userspace_config.rgb_layer_change && has_mods_changed && biton32(layer_state) == 0) {
151 if (current_mod & MODS_SHIFT_MASK || current_led & (1<<USB_LED_CAPS_LOCK) || current_osm & MODS_SHIFT_MASK) {
152 rgblight_sethsv_at(0, 255, 255, 5);
153 rgblight_sethsv_at(0, 255, 255, 10);
154 } else {
155 rgblight_sethsv_default_helper(5);
156 rgblight_sethsv_default_helper(10);
157 }
158 if (current_mod & MODS_CTRL_MASK || current_osm & MODS_CTRL_MASK) {
159 rgblight_sethsv_at(51, 255, 255, 6);
160 rgblight_sethsv_at(51, 255, 255, 9);
161 } else {
162 rgblight_sethsv_default_helper(6);
163 rgblight_sethsv_default_helper(9);
164 }
165 if (current_mod & MODS_GUI_MASK || current_osm & MODS_GUI_MASK) {
166 rgblight_sethsv_at(120, 255, 255, 7);
167 rgblight_sethsv_at(120, 255, 255, 8);
168 } else {
169 rgblight_sethsv_default_helper(7);
170 rgblight_sethsv_default_helper(8);
171
172 }
173 }
174#endif
175
176} 111}
177
diff --git a/keyboards/orthodox/keymaps/drashna/rules.mk b/keyboards/orthodox/keymaps/drashna/rules.mk
index 7ea609ede..e7ed88d84 100644
--- a/keyboards/orthodox/keymaps/drashna/rules.mk
+++ b/keyboards/orthodox/keymaps/drashna/rules.mk
@@ -7,4 +7,7 @@ TAP_DANCE_ENABLE = no
7RGBLIGHT_ENABLE = yes 7RGBLIGHT_ENABLE = yes
8AUDIO_ENABLE = yes 8AUDIO_ENABLE = yes
9NKRO_ENABLE = yes 9NKRO_ENABLE = yes
10
10INDICATOR_LIGHTS = yes 11INDICATOR_LIGHTS = yes
12MACROS_ENABLED = no
13RGBLIGHT_TWINKLE = yes
diff --git a/keyboards/viterbi/keymaps/drashna/rules.mk b/keyboards/viterbi/keymaps/drashna/rules.mk
index 4b5596a53..a7b18e071 100644
--- a/keyboards/viterbi/keymaps/drashna/rules.mk
+++ b/keyboards/viterbi/keymaps/drashna/rules.mk
@@ -8,7 +8,11 @@ RGBLIGHT_ENABLE = yes
8AUDIO_ENABLE = yes 8AUDIO_ENABLE = yes
9NKRO_ENABLE = yes 9NKRO_ENABLE = yes
10 10
11CUSTOM_LAYOUT = no 11NO_SECRETS = yes
12MACROS_ENABLED = yes
13INDICATOR_LIGHTS = no
14RGBLIGHT_TWINKLE = yes
15
12LAYOUTS = ortho_5x7 16LAYOUTS = ortho_5x7
13 17
14# SRC := $(filter-out serial.c matrix.c i2c.c split_util.c,$(SRC)) 18# SRC := $(filter-out serial.c matrix.c i2c.c split_util.c,$(SRC))
@@ -17,3 +21,4 @@ LAYOUTS = ortho_5x7
17# SRC := $(filter-out i2c.c,$(SRC)) 21# SRC := $(filter-out i2c.c,$(SRC))
18# SRC := $(filter-out split_util.c,$(SRC)) 22# SRC := $(filter-out split_util.c,$(SRC))
19# SRC += quantum/matrix.c 23# SRC += quantum/matrix.c
24
diff --git a/layouts/community/ergodox/drashna/keymap.c b/layouts/community/ergodox/drashna/keymap.c
index 92c790957..1506db03a 100644
--- a/layouts/community/ergodox/drashna/keymap.c
+++ b/layouts/community/ergodox/drashna/keymap.c
@@ -89,7 +89,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
89// Otherwise, it needs KC_* 89// Otherwise, it needs KC_*
90 [_COLEMAK] = LAYOUT_ergodox_pretty_wrapper( 90 [_COLEMAK] = LAYOUT_ergodox_pretty_wrapper(
91 // left hand // right hand 91 // left hand // right hand
92 KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, 92 KC_EQL, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, KC_MINS,
93 KC_TAB, _________________COLEMAK_L1________________, TG(_DIABLO), TG(_DIABLO), _________________COLEMAK_R1________________, KC_BSLS, 93 KC_TAB, _________________COLEMAK_L1________________, TG(_DIABLO), TG(_DIABLO), _________________COLEMAK_R1________________, KC_BSLS,
94 KC_C1R3, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT, 94 KC_C1R3, _________________COLEMAK_L2________________, _________________COLEMAK_R2________________, KC_QUOT,
95 KC_MLSF, _________________COLEMAK_L3________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________COLEMAK_R3________________, KC_MRSF, 95 KC_MLSF, _________________COLEMAK_L3________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________COLEMAK_R3________________, KC_MRSF,
@@ -121,7 +121,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
121// Otherwise, it needs KC_* 121// Otherwise, it needs KC_*
122 [_DVORAK] = LAYOUT_ergodox_pretty_wrapper( 122 [_DVORAK] = LAYOUT_ergodox_pretty_wrapper(
123 // left hand // right hand 123 // left hand // right hand
124 KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSLS, 124 KC_EQL, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, KC_BSLS,
125 KC_TAB, _________________DVORAK_L1_________________, TG(_DIABLO), TG(_DIABLO), _________________DVORAK_R1_________________, KC_SLSH, 125 KC_TAB, _________________DVORAK_L1_________________, TG(_DIABLO), TG(_DIABLO), _________________DVORAK_R1_________________, KC_SLSH,
126 KC_C1R3, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_MINS, 126 KC_C1R3, _________________DVORAK_L2_________________, _________________DVORAK_R2_________________, KC_MINS,
127 KC_MLSF, _________________DVORAK_L3_________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________DVORAK_R3_________________, KC_MRSF, 127 KC_MLSF, _________________DVORAK_L3_________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________DVORAK_R3_________________, KC_MRSF,
@@ -153,7 +153,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
153// Otherwise, it needs KC_* 153// Otherwise, it needs KC_*
154 [_WORKMAN] = LAYOUT_ergodox_pretty_wrapper( 154 [_WORKMAN] = LAYOUT_ergodox_pretty_wrapper(
155 // left hand 155 // left hand
156 KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, 156 KC_EQL, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, KC_MINS,
157 KC_TAB, _________________WORKMAN_L1________________, TG(_DIABLO), TG(_DIABLO), _________________WORKMAN_R1________________, KC_BSLS, 157 KC_TAB, _________________WORKMAN_L1________________, TG(_DIABLO), TG(_DIABLO), _________________WORKMAN_R1________________, KC_BSLS,
158 KC_C1R3, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT, 158 KC_C1R3, _________________WORKMAN_L2________________, _________________WORKMAN_R2________________, KC_QUOT,
159 KC_MLSF, _________________WORKMAN_L3________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________WORKMAN_R3________________, KC_MRSF, 159 KC_MLSF, _________________WORKMAN_L3________________, TG(_GAMEPAD), TG(_GAMEPAD), _________________WORKMAN_R3________________, KC_MRSF,
@@ -240,7 +240,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
240 240
241 [_LOWER] = LAYOUT_ergodox_pretty_wrapper( 241 [_LOWER] = LAYOUT_ergodox_pretty_wrapper(
242 _______, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, 242 _______, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11,
243 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 243 KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______,
244 _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, 244 _______, _______, _______, _______, _______, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
245 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 245 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
246 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 246 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
@@ -251,20 +251,20 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
251 251
252 [_RAISE] = LAYOUT_ergodox_pretty_wrapper( 252 [_RAISE] = LAYOUT_ergodox_pretty_wrapper(
253 _______, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11, 253 _______, _________________FUNC_LEFT_________________, _______, _______, _________________FUNC_RIGHT________________, KC_F11,
254 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 254 KC_GRV, ________________NUMBER_LEFT________________, _______, _______, ________________NUMBER_RIGHT_______________, _______,
255 _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, 255 _______, _______, _______, _______, _______, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
256 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_RSFT, 256 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
257 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 257 _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_SLCK,
258 _______, _______, _______, _______, 258 _______, _______, _______, _______,
259 _______, _______, 259 _______, _______,
260 _______, _______, _______, _______, _______, _______ 260 _______, _______, _______, _______, _______, _______
261 ), 261 ),
262 262
263 [_ADJUST] = LAYOUT_ergodox_pretty_wrapper( 263 [_ADJUST] = LAYOUT_ergodox_pretty_wrapper(
264 KC_MAKE, _______, _______, _______, _______, _______, _______, _______, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST, 264 KC_MAKE, _______, _______, _______, _______, _______, _______, KC_NUKE, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_RST,
265 VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, EPRM, 265 VRSN, RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG, _______, _______, _______, _______, _______, _______, _______, EPRM,
266 RGB_SMOD,RGB_HUI, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, KC_QWERTY, KC_COLEMAK, KC_DVORAK, KC_WORKMAN, TG(_MODS), 266 RGB_SMOD,RGB_HUI, CK_TOGG, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN, TG(_MODS),
267 TG(_MODS),RGB_SMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY, 267 _______, RGB_SMOD,RGB_HUD, RGB_SAD, RGB_VAD, KC_RGB_T,_______, _______, MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT, KC_MPLY,
268 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, 268 _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
269 _______, _______, _______, _______, 269 _______, _______, _______, _______,
270 _______, _______, 270 _______, _______,
diff --git a/layouts/community/ergodox/drashna/rules.mk b/layouts/community/ergodox/drashna/rules.mk
index e5bf2d4b3..aea07134b 100644
--- a/layouts/community/ergodox/drashna/rules.mk
+++ b/layouts/community/ergodox/drashna/rules.mk
@@ -1,7 +1,7 @@
1TAP_DANCE_ENABLE = yes 1TAP_DANCE_ENABLE = yes
2SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend 2SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
3COMMAND_ENABLE = yes # Commands for debug and configuration 3COMMAND_ENABLE = yes # Commands for debug and configuration
4ifeq ($(strip $(KEYBOARD)), ergodox_ez) 4ifdef KEYBOARD_ergodox_ez
5 RGBLIGHT_ENABLE = yes 5 RGBLIGHT_ENABLE = yes
6endif 6endif
7CONSOLE_ENABLE = no 7CONSOLE_ENABLE = no
@@ -9,3 +9,9 @@ BOOTMAGIC_ENABLE = yes
9 9
10UNICODE_ENABLE = no 10UNICODE_ENABLE = no
11UNICDOEMAP_ENABLE = yes 11UNICDOEMAP_ENABLE = yes
12
13MACROS_ENABLED = no
14INDICATOR_LIGHTS = no
15ifdef RGBLIGHT_ENABLE
16 RGBLIGHT_TWINKLE = yes
17endif
diff --git a/users/drashna/config.h b/users/drashna/config.h
index ef1860778..26c989d7f 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -11,12 +11,13 @@
11 SONG(DVORAK_SOUND), \ 11 SONG(DVORAK_SOUND), \
12 SONG(OVERWATCH_THEME) \ 12 SONG(OVERWATCH_THEME) \
13 } 13 }
14
15#define AUDIO_CLICKY_FREQ_RANDOMNESS 1.0f
16
14#endif 17#endif
15 18
16#ifdef RGBLIGHT_ENABLE 19#ifdef RGBLIGHT_ENABLE
17 #ifndef KEYBOARD_ergodox_ez 20#define RGBLIGHT_SLEEP
18 #define RGBLIGHT_SLEEP
19 #endif // !KEYBOARD_ergodox_ez
20#endif // RGBLIGHT_ENABLE 21#endif // RGBLIGHT_ENABLE
21 22
22 23
@@ -42,7 +43,7 @@
42#define IGNORE_MOD_TAP_INTERRUPT 43#define IGNORE_MOD_TAP_INTERRUPT
43#undef PERMISSIVE_HOLD 44#undef PERMISSIVE_HOLD
44#undef PREVENT_STUCK_MODIFIERS 45#undef PREVENT_STUCK_MODIFIERS
45#define TAPPING_FORCE_HOLD 46// #define TAPPING_FORCE_HOLD
46//#define RETRO_TAPPING 47//#define RETRO_TAPPING
47 48
48#define FORCE_NKRO 49#define FORCE_NKRO
@@ -54,7 +55,7 @@
54#ifdef TAPPING_TERM 55#ifdef TAPPING_TERM
55#undef TAPPING_TERM 56#undef TAPPING_TERM
56#endif // TAPPING_TERM 57#endif // TAPPING_TERM
57#define TAPPING_TERM 200 58#define TAPPING_TERM 175
58 59
59 60
60// Disable action_get_macro and fn_actions, since we don't use these 61// Disable action_get_macro and fn_actions, since we don't use these
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 6ce541bfb..8efd99f80 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -17,119 +17,36 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18#include "drashna.h" 18#include "drashna.h"
19#include "version.h" 19#include "version.h"
20 20#include "eeprom.h"
21#if (__has_include("secrets.h") && !defined(NO_SECRETS)) 21#include "tap_dances.h"
22#include "secrets.h" 22#include "rgb_stuff.h"
23#else
24// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
25// And I'm not familiar enough to know which is better or why...
26PROGMEM const char secret[][64] = {
27 "test1",
28 "test2",
29 "test3",
30 "test4",
31 "test5"
32};
33#endif
34 23
35 24
36float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND); 25float tone_copy[][2] = SONG(SCROLL_LOCK_ON_SOUND);
37float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND); 26float tone_paste[][2] = SONG(SCROLL_LOCK_OFF_SOUND);
38 27
39
40static uint16_t copy_paste_timer; 28static uint16_t copy_paste_timer;
41userspace_config_t userspace_config; 29userspace_config_t userspace_config;
42 30
43// Helper Functions 31// Helper Functions
44void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
45
46#ifdef RGBLIGHT_ENABLE
47void rgblight_sethsv_default_helper(uint8_t index) {
48 uint8_t default_layer = eeconfig_read_default_layer();
49 if (default_layer & (1UL << _COLEMAK)) {
50 rgblight_sethsv_at(300, 255, 255, index);
51 rgblight_sethsv_at(300, 255, 255, index);
52 }
53 else if (default_layer & (1UL << _DVORAK)) {
54 rgblight_sethsv_at(120, 255, 255, index);
55 rgblight_sethsv_at(120, 255, 255, index);
56 }
57 else if (default_layer & (1UL << _WORKMAN)) {
58 rgblight_sethsv_at(43, 255, 255, index);
59 rgblight_sethsv_at(43, 255, 255, index);
60 }
61 else {
62 rgblight_sethsv_at(180, 255, 255, index);
63 rgblight_sethsv_at(180, 255, 255, index);
64 }
65}
66#endif // RGBLIGHT_ENABLE
67
68 32
69// ========================================= TAP DANCE =========================================
70#ifdef TAP_DANCE_ENABLE
71//define diablo macro timer variables
72static uint16_t diablo_timer[4];
73static uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
74static uint8_t diablo_key_time[4];
75
76// has the correct number of seconds elapsed (as defined by diablo_times)
77bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; };
78
79// Cycle through the times for the macro, starting at 0, for disabled.
80// Max of six values, so don't exceed
81void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
82 if (state->count >= 7) {
83 diablo_key_time[diablo_key] = diablo_times[0];
84 reset_tap_dance(state);
85 } else {
86 diablo_key_time[diablo_key] = diablo_times[state->count - 1];
87 }
88}
89 33
90// Would rather have one function for all of this, but no idea how to do that... 34// This block is for all of the gaming macros, as they were all doing
91void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); } 35// the same thing, but with differring text sent.
92void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); } 36bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
93void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); } 37 if (!record->event.pressed || override) {
94void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); } 38 clear_keyboard();
95 39 tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
96//Tap Dance Definitions 40 wait_ms(50);
97qk_tap_dance_action_t tap_dance_actions[] = { 41 send_string(str);
98 // tap once to disable, and more to enable timed micros 42 wait_ms(50);
99 [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1), 43 tap(KC_ENTER);
100 [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
101 [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
102 [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
103};
104
105// Sends the key press to system, but only if on the Diablo layer
106void send_diablo_keystroke(uint8_t diablo_key) {
107 if (biton32(layer_state) == _DIABLO) {
108 switch (diablo_key) {
109 case 0:
110 tap(KC_1); break;
111 case 1:
112 tap(KC_2); break;
113 case 2:
114 tap(KC_3); break;
115 case 3:
116 tap(KC_4); break;
117 }
118 } 44 }
45 if (override) wait_ms(3000);
46 return false;
119} 47}
120 48
121// Checks each of the 4 timers/keys to see if enough time has elapsed 49void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
122// Runs the "send string" command if enough time has passed, and resets the timer.
123void run_diablo_macro_check(void) {
124 uint8_t dtime;
125 for (dtime = 0; dtime < 4; dtime++) {
126 if (check_dtimer(dtime) && diablo_key_time[dtime]) {
127 diablo_timer[dtime] = timer_read();
128 send_diablo_keystroke(dtime);
129 }
130 }
131}
132#endif // TAP_DANCE_ENABLE
133 50
134 51
135// Add reconfigurable functions here, for keymap customization 52// Add reconfigurable functions here, for keymap customization
@@ -148,6 +65,11 @@ bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
148} 65}
149 66
150__attribute__ ((weak)) 67__attribute__ ((weak))
68bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
69 return true;
70}
71
72__attribute__ ((weak))
151uint32_t layer_state_set_keymap (uint32_t state) { 73uint32_t layer_state_set_keymap (uint32_t state) {
152 return state; 74 return state;
153} 75}
@@ -159,9 +81,12 @@ void led_set_keymap(uint8_t usb_led) {}
159// Call user matrix init, set default RGB colors and then 81// Call user matrix init, set default RGB colors and then
160// call the keymap's init function 82// call the keymap's init function
161void matrix_init_user(void) { 83void matrix_init_user(void) {
162 uint8_t default_layer = eeconfig_read_default_layer();
163 userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE); 84 userspace_config.raw = eeprom_read_byte(EECONFIG_USERSPACE);
164 85
86#ifdef AUDIO_CLICKY
87 clicky_enable = userspace_config.clicky_enable;
88#endif
89
165#ifdef BOOTLOADER_CATERINA 90#ifdef BOOTLOADER_CATERINA
166 DDRD &= ~(1<<5); 91 DDRD &= ~(1<<5);
167 PORTD &= ~(1<<5); 92 PORTD &= ~(1<<5);
@@ -170,39 +95,15 @@ void matrix_init_user(void) {
170 PORTB &= ~(1<<0); 95 PORTB &= ~(1<<0);
171#endif 96#endif
172 97
173 if (userspace_config.rgb_layer_change) {
174#ifdef RGBLIGHT_ENABLE
175 rgblight_enable();
176#endif // RGBLIGHT_ENABLE
177 if (default_layer & (1UL << _COLEMAK)) {
178 #ifdef RGBLIGHT_ENABLE
179 rgblight_sethsv_magenta();
180 #endif // RGBLIGHT_ENABLE
181 } else if (default_layer & (1UL << _DVORAK)) {
182 #ifdef RGBLIGHT_ENABLE
183 rgblight_sethsv_green();
184 #endif // RGBLIGHT_ENABLE
185 } else if (default_layer & (1UL << _WORKMAN)) {
186 #ifdef RGBLIGHT_ENABLE
187 rgblight_sethsv_goldenrod();
188 #endif // RGBLIGHT_ENABLE
189 } else {
190 #ifdef RGBLIGHT_ENABLE
191 rgblight_sethsv_teal();
192 #endif // RGBLIGHT_ENABLE
193 }
194 }
195 98
196#ifdef AUDIO_CLICKY 99#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
197 clicky_enable = userspace_config.clicky_enable;
198#endif
199
200#if ( defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE) )
201 set_unicode_input_mode(UC_WINC); 100 set_unicode_input_mode(UC_WINC);
202#endif //UNICODE_ENABLE 101#endif //UNICODE_ENABLE
203 102 matrix_init_rgb();
204 matrix_init_keymap(); 103 matrix_init_keymap();
205} 104}
105
106
206// No global matrix scan code, so just run keymap's matrix 107// No global matrix scan code, so just run keymap's matrix
207// scan function 108// scan function
208void matrix_scan_user(void) { 109void matrix_scan_user(void) {
@@ -211,24 +112,14 @@ void matrix_scan_user(void) {
211 run_diablo_macro_check(); 112 run_diablo_macro_check();
212#endif // TAP_DANCE_ENABLE 113#endif // TAP_DANCE_ENABLE
213 114
115#ifdef RGBLIGHT_ENABLE
116 matrix_scan_rgb();
117#endif // RGBLIGHT_ENABLE
118
214 matrix_scan_keymap(); 119 matrix_scan_keymap();
215} 120}
216 121
217 122
218// This block is for all of the gaming macros, as they were all doing
219// the same thing, but with differring text sent.
220bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
221 if (!record->event.pressed || override) {
222 clear_keyboard();
223 tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
224 wait_ms(50);
225 send_string(str);
226 wait_ms(50);
227 tap(KC_ENTER);
228 }
229 if (override) wait_ms(3000);
230 return false;
231}
232 123
233 124
234// Defines actions tor my global custom keycodes. Defined in drashna.h file 125// Defines actions tor my global custom keycodes. Defined in drashna.h file
@@ -236,10 +127,9 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
236bool process_record_user(uint16_t keycode, keyrecord_t *record) { 127bool process_record_user(uint16_t keycode, keyrecord_t *record) {
237 128
238 // If console is enabled, it will print the matrix position and status of each key pressed 129 // If console is enabled, it will print the matrix position and status of each key pressed
239#ifdef CONSOLE_ENABLE 130#ifdef KEYLOGGER_ENABLE
240 xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed); 131 xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
241#endif //CONSOLE_ENABLE 132#endif //KEYLOGGER_ENABLE
242
243 133
244 switch (keycode) { 134 switch (keycode) {
245 case KC_QWERTY: 135 case KC_QWERTY:
@@ -287,8 +177,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
287 case KC_RESET: // Custom RESET code that sets RGBLights to RED 177 case KC_RESET: // Custom RESET code that sets RGBLights to RED
288 if (!record->event.pressed) { 178 if (!record->event.pressed) {
289#ifdef RGBLIGHT_ENABLE 179#ifdef RGBLIGHT_ENABLE
290 rgblight_enable(); 180 rgblight_enable_noeeprom();
291 rgblight_mode(1); 181 rgblight_mode_noeeprom(1);
292 rgblight_setrgb_red(); 182 rgblight_setrgb_red();
293#endif // RGBLIGHT_ENABLE 183#endif // RGBLIGHT_ENABLE
294 reset_keyboard(); 184 reset_keyboard();
@@ -300,6 +190,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
300 case EPRM: // Resets EEPROM 190 case EPRM: // Resets EEPROM
301 if (record->event.pressed) { 191 if (record->event.pressed) {
302 eeconfig_init(); 192 eeconfig_init();
193 default_layer_set(1UL<<eeconfig_read_default_layer());
194 layer_state_set(layer_state);
303 } 195 }
304 return false; 196 return false;
305 break; 197 break;
@@ -310,24 +202,24 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
310 return false; 202 return false;
311 break; 203 break;
312 204
313 205/* Code has been depreciated
314 case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo 206 case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo
315 if (!record->event.pressed) { 207 if (!record->event.pressed) {
316 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); 208 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
317 send_string_P(secret[keycode - KC_SECRET_1]); 209 send_string(decoy_secret[keycode - KC_SECRET_1]);
318 } 210 }
319 return false; 211 return false;
320 break; 212 break;
321 213*/
322 214
323// These are a serious of gaming macros. 215// These are a serious of gaming macros.
324// Only enables for the viterbi, basically, 216// Only enables for the viterbi, basically,
325// to save on firmware space, since it's limited. 217// to save on firmware space, since it's limited.
326#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez) || defined(KEYBOARD_iris_rev2)) 218#ifdef MACROS_ENABLED
327 case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros 219 case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros
328 if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); } 220 if (record->event.pressed) { userspace_config.is_overwatch ^= 1; eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw); }
329#ifdef RGBLIGHT_ENABLE 221#ifdef RGBLIGHT_ENABLE
330 userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18); 222 userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18);
331#endif //RGBLIGHT_ENABLE 223#endif //RGBLIGHT_ENABLE
332 return false; break; 224 return false; break;
333 case KC_SALT: 225 case KC_SALT:
@@ -353,40 +245,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
353 return send_game_macro("OMG!!! C9!!!", record, false); 245 return send_game_macro("OMG!!! C9!!!", record, false);
354 case KC_GGEZ: 246 case KC_GGEZ:
355 return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false); 247 return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false);
356#endif // !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) 248#endif // MACROS_ENABLED
357 249
358 250
359#ifdef TAP_DANCE_ENABLE
360 case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them 251 case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them
252#ifdef TAP_DANCE_ENABLE
361 if (record->event.pressed) { 253 if (record->event.pressed) {
362 uint8_t dtime; 254 uint8_t dtime;
363 for (dtime = 0; dtime < 4; dtime++) { 255 for (dtime = 0; dtime < 4; dtime++) {
364 diablo_key_time[dtime] = diablo_times[0]; 256 diablo_key_time[dtime] = diablo_times[0];
365 } 257 }
366 } 258 }
259#endif // TAP_DANCE_ENABLE#endif
367 return false; break; 260 return false; break;
368#endif // TAP_DANCE_ENABLE
369
370
371 case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
372#ifdef RGBLIGHT_ENABLE
373 if (record->event.pressed) {
374 userspace_config.rgb_layer_change ^= 1;
375 eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
376 if (userspace_config.rgb_layer_change) {
377 layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
378 }
379 }
380#endif // RGBLIGHT_ENABLE
381 return false; break;
382#ifdef RGBLIGHT_ENABLE
383 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
384 if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
385 userspace_config.rgb_layer_change = false;
386 eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
387 }
388 return true; break;
389#endif // RGBLIGHT_ENABLE
390 261
391 262
392 case KC_CCCV: // One key copy/paste 263 case KC_CCCV: // One key copy/paste
@@ -443,7 +314,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
443#endif // UNICODE_ENABLE 314#endif // UNICODE_ENABLE
444 315
445 } 316 }
446 return process_record_keymap(keycode, record); 317 return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) && process_record_user_rgb(keycode, record);
447} 318}
448 319
449 320
@@ -452,111 +323,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
452// on layer change, no matter where the change was initiated 323// on layer change, no matter where the change was initiated
453// Then runs keymap's layer change check 324// Then runs keymap's layer change check
454uint32_t layer_state_set_user(uint32_t state) { 325uint32_t layer_state_set_user(uint32_t state) {
455 uint8_t default_layer = eeconfig_read_default_layer();
456 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); 326 state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
457
458 switch (biton32(state)) {
459 case _MACROS:
460#ifdef RGBLIGHT_ENABLE
461 if (userspace_config.rgb_layer_change) {
462 rgblight_sethsv_orange();
463 userspace_config.is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
464 }
465#endif // RGBLIGHT_ENABLE
466
467 break;
468 case _MEDIA:
469#ifdef RGBLIGHT_ENABLE
470 if (userspace_config.rgb_layer_change) {
471 rgblight_sethsv_chartreuse();
472 rgblight_mode(22);
473 }
474#endif // RGBLIGHT_ENABLE
475
476 break;
477 case _GAMEPAD:
478#ifdef RGBLIGHT_ENABLE
479 if (userspace_config.rgb_layer_change) {
480 rgblight_sethsv_orange();
481 rgblight_mode(17);
482 }
483#endif // RGBLIGHT_ENABLE
484
485 break;
486 case _DIABLO:
487#ifdef RGBLIGHT_ENABLE
488 if (userspace_config.rgb_layer_change) {
489 rgblight_sethsv_red();
490 rgblight_mode(5);
491 }
492#endif // RGBLIGHT_ENABLE
493
494 break;
495 case _RAISE:
496#ifdef RGBLIGHT_ENABLE 327#ifdef RGBLIGHT_ENABLE
497 if (userspace_config.rgb_layer_change) { 328 state = layer_state_set_rgb(state);
498 rgblight_sethsv_yellow();
499 rgblight_mode(5);
500 }
501#endif // RGBLIGHT_ENABLE
502
503 break;
504 case _LOWER:
505#ifdef RGBLIGHT_ENABLE
506 if (userspace_config.rgb_layer_change) {
507 rgblight_sethsv_orange();
508 rgblight_mode(5);
509 }
510#endif // RGBLIGHT_ENABLE
511
512 break;
513 case _ADJUST:
514#ifdef RGBLIGHT_ENABLE
515 if (userspace_config.rgb_layer_change) {
516 rgblight_sethsv_red();
517 rgblight_mode(23);
518 }
519#endif // RGBLIGHT_ENABLE
520
521 break;
522 default: // for any other layers, or the default layer
523 if (default_layer & (1UL << _COLEMAK)) {
524#ifdef RGBLIGHT_ENABLE
525 if (userspace_config.rgb_layer_change) { rgblight_sethsv_magenta(); }
526#endif // RGBLIGHT_ENABLE
527
528 }
529 else if (default_layer & (1UL << _DVORAK)) {
530#ifdef RGBLIGHT_ENABLE
531 if (userspace_config.rgb_layer_change) { rgblight_sethsv_green(); }
532#endif // RGBLIGHT_ENABLE 329#endif // RGBLIGHT_ENABLE
533
534 }
535 else if (default_layer & (1UL << _WORKMAN)) {
536#ifdef RGBLIGHT_ENABLE
537 if (userspace_config.rgb_layer_change) { rgblight_sethsv_goldenrod(); }
538#endif // RGBLIGHT_ENABLE
539
540 }
541 else {
542#ifdef RGBLIGHT_ENABLE
543 if (userspace_config.rgb_layer_change) { rgblight_sethsv_teal(); }
544#endif // RGBLIGHT_ENABLE
545
546 }
547 if (biton32(state) == _MODS) { // If the non-OSM layer is enabled, then breathe
548#ifdef RGBLIGHT_ENABLE
549 if (userspace_config.rgb_layer_change) { rgblight_mode(2); }
550#endif // RGBLIGHT_ENABLE
551
552 } else { // otherwise, stay solid
553#ifdef RGBLIGHT_ENABLE
554 if (userspace_config.rgb_layer_change) { rgblight_mode(1); }
555#endif // RGBLIGHT_ENABLE
556
557 }
558 break;
559 }
560 return layer_state_set_keymap (state); 330 return layer_state_set_keymap (state);
561} 331}
562 332
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index 87a72f528..e035b86fb 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -42,6 +42,7 @@ enum userspace_layers {
42#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT)) 42#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
43#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI)) 43#define MODS_GUI_MASK (MOD_BIT(KC_LGUI)|MOD_BIT(KC_RGUI))
44 44
45
45// RGB color codes are no longer located here anymore. Instead, you will want to 46// RGB color codes are no longer located here anymore. Instead, you will want to
46// head to https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h 47// head to https://github.com/qmk/qmk_firmware/blob/master/quantum/rgblight_list.h
47 48
@@ -51,7 +52,11 @@ extern bool clicky_enable;
51void rgblight_sethsv_default_helper(uint8_t index); 52void rgblight_sethsv_default_helper(uint8_t index);
52#endif // RGBLIGHT_ENABLE 53#endif // RGBLIGHT_ENABLE
53 54
54#define EECONFIG_USERSPACE (uint8_t *)20 55void tap(uint16_t keycode);
56bool process_record_secrets(uint16_t keycode, keyrecord_t *record);
57
58
59#define EECONFIG_USERSPACE (uint8_t *)19
55 60
56typedef union { 61typedef union {
57 uint8_t raw; 62 uint8_t raw;
@@ -59,6 +64,7 @@ typedef union {
59 bool clicky_enable :1; 64 bool clicky_enable :1;
60 bool rgb_layer_change :1; 65 bool rgb_layer_change :1;
61 bool is_overwatch :1; 66 bool is_overwatch :1;
67 bool nuke_switch :1;
62 }; 68 };
63} userspace_config_t; 69} userspace_config_t;
64 70
@@ -91,6 +97,8 @@ enum userspace_custom_keycodes {
91 KC_SECRET_4, 97 KC_SECRET_4,
92 KC_SECRET_5, 98 KC_SECRET_5,
93 KC_CCCV, 99 KC_CCCV,
100 KC_NUKE,
101
94#ifdef UNICODE_ENABLE 102#ifdef UNICODE_ENABLE
95 UC_FLIP, 103 UC_FLIP,
96#endif //UNICODE_ENABLE 104#endif //UNICODE_ENABLE
@@ -112,8 +120,8 @@ enum userspace_custom_keycodes {
112#define DVORAK KC_DVORAK 120#define DVORAK KC_DVORAK
113#define COLEMAK KC_COLEMAK 121#define COLEMAK KC_COLEMAK
114#define WORKMAN KC_WORKMAN 122#define WORKMAN KC_WORKMAN
115#define KC_RST KC_RESET
116 123
124#define KC_RST KC_RESET
117 125
118#ifdef SWAP_HANDS_ENABLE 126#ifdef SWAP_HANDS_ENABLE
119#define KC_C1R3 SH_TT 127#define KC_C1R3 SH_TT
@@ -125,6 +133,16 @@ enum userspace_custom_keycodes {
125#define KC_MLSF OSM(MOD_LSFT) 133#define KC_MLSF OSM(MOD_LSFT)
126#define KC_MRSF OSM(MOD_RSFT) 134#define KC_MRSF OSM(MOD_RSFT)
127 135
136#define OS_LGUI OSM(MOD_LGUI)
137#define OS_RGUI OSM(MOD_RGUI)
138#define OS_LSFT OSM(MOD_LSFT)
139#define OS_RSFT OSM(MOD_RSFT)
140#define OS_LCTL OSM(MOD_LCTL)
141#define OS_RCTL OSM(MOD_RCTL)
142#define OS_LALT OSM(MOD_LALT)
143#define OS_RALT OSM(MOD_RALT)
144#define ALT_APP ALT_T(KC_APP)
145
128#define MG_NKRO MAGIC_TOGGLE_NKRO 146#define MG_NKRO MAGIC_TOGGLE_NKRO
129 147
130 148
@@ -200,8 +218,8 @@ enum {
200#define ______________COLEMAK_MOD_DH_L3____________ CTL_T(KC_Z), KC_X, KC_C, KC_D, KC_V 218#define ______________COLEMAK_MOD_DH_L3____________ CTL_T(KC_Z), KC_X, KC_C, KC_D, KC_V
201 219
202#define ______________COLEMAK_MOD_DH_R1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN 220#define ______________COLEMAK_MOD_DH_R1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
203#define ______________COLEMAK_MOD_DH_R2____________ KC_K, KC_N, KC_E, KC_I, KC_O 221#define ______________COLEMAK_MOD_DH_R2____________ KC_M, KC_N, KC_E, KC_I, KC_O
204#define ______________COLEMAK_MOD_DH_R3____________ KC_M, KC_H, KC_COMM, KC_DOT, CTL_T(KC_SLASH) 222#define ______________COLEMAK_MOD_DH_R3____________ KC_K, KC_H, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
205 223
206 224
207#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y 225#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y
@@ -227,7 +245,7 @@ enum {
227#define _________________NORMAN_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B 245#define _________________NORMAN_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B
228 246
229#define _________________NORMAN_R1_________________ KC_J, KC_U, KC_R, KC_L, KC_SCLN 247#define _________________NORMAN_R1_________________ KC_J, KC_U, KC_R, KC_L, KC_SCLN
230#define _________________NORMAN_R2_________________ KC_J, KC_N, KC_I, KC_O, KC_U 248#define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U
231#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) 249#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
232 250
233#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 251#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5
@@ -243,7 +261,7 @@ enum {
243#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 261#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
244 262
245 263
246#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), KC_LGUI, KC_RGUI, CTL_T(KC_ESCAPE), \ 264#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \
247 KC_HOME, KC_PGUP, \ 265 KC_HOME, KC_PGUP, \
248 LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) 266 LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER)
249 267
diff --git a/users/drashna/readme.md b/users/drashna/readme.md
index ddf24b24f..0aa73ece9 100644
--- a/users/drashna/readme.md
+++ b/users/drashna/readme.md
@@ -96,7 +96,7 @@ Then you can create this file and add your macro strings to it:
96 96
97###### secrets.h 97###### secrets.h
98```c 98```c
99PROGMEM const char secret[][64] = { 99static const char * const secrets[] = {
100 "secret1", 100 "secret1",
101 "secret2", 101 "secret2",
102 "secret3", 102 "secret3",
@@ -116,7 +116,7 @@ In the `<name>.c` file, you will want to add this to the top:
116#else 116#else
117// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware 117// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
118// And I'm not familiar enough to know which is better or why... 118// And I'm not familiar enough to know which is better or why...
119PROGMEM const char secret[][64] = { 119static const char * const secrets[] = {
120 "test1", 120 "test1",
121 "test2", 121 "test2",
122 "test3", 122 "test3",
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
new file mode 100644
index 000000000..af7190cc3
--- /dev/null
+++ b/users/drashna/rgb_stuff.c
@@ -0,0 +1,261 @@
1#include "drashna.h"
2#include "rgb_stuff.h"
3
4extern rgblight_config_t rgblight_config;
5extern userspace_config_t userspace_config;
6
7#ifdef RGBLIGHT_ENABLE
8void rgblight_sethsv_default_helper(uint8_t index) {
9 rgblight_sethsv_at(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, index);
10}
11#endif // RGBLIGHT_ENABLE
12
13#ifdef INDICATOR_LIGHTS
14uint8_t last_mod;
15uint8_t last_led;
16uint8_t last_osm;
17uint8_t current_mod;
18uint8_t current_led;
19uint8_t current_osm;
20
21
22void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) {
23 if (userspace_config.rgb_layer_change && biton32(layer_state) == 0) {
24 if (this_mod & MODS_SHIFT_MASK || this_led & (1<<USB_LED_CAPS_LOCK) || this_osm & MODS_SHIFT_MASK) {
25 rgblight_sethsv_at(0, 255, 255, SHFT_LED1);
26 rgblight_sethsv_at(0, 255, 255, SHFT_LED2);
27 } else {
28 rgblight_sethsv_default_helper(SHFT_LED1);
29 rgblight_sethsv_default_helper(SHFT_LED2);
30 }
31 if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) {
32 rgblight_sethsv_at(51, 255, 255, CTRL_LED1);
33 rgblight_sethsv_at(51, 255, 255, CTRL_LED2);
34 } else {
35 rgblight_sethsv_default_helper(CTRL_LED1);
36 rgblight_sethsv_default_helper(CTRL_LED2);
37 }
38 if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) {
39 rgblight_sethsv_at(120, 255, 255, GUI_LED1);
40 rgblight_sethsv_at(120, 255, 255, GUI_LED2);
41 } else {
42 rgblight_sethsv_default_helper(GUI_LED1);
43 rgblight_sethsv_default_helper(GUI_LED2);
44 }
45 }
46}
47
48void matrix_scan_indicator(void) {
49 current_mod = get_mods();
50 current_led = host_keyboard_leds();
51 current_osm = get_oneshot_mods();
52
53 set_rgb_indicators(current_mod, current_led, current_osm);
54
55 last_mod = current_mod;
56 last_led = current_led;
57 last_osm = current_osm;
58
59}
60#endif //INDICATOR_LIGHTS
61
62#ifdef RGBLIGHT_TWINKLE
63static rgblight_fadeout lights[RGBLED_NUM];
64
65__attribute__ ((weak))
66bool indicator_is_this_led_used(uint8_t index) { return false; }
67
68void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
69 bool litup = false;
70 for (uint8_t light_index = 0 ; light_index < RGBLED_NUM ; ++light_index ) {
71 if (lights[light_index].enabled && timer_elapsed(lights[light_index].timer) > 10) {
72 rgblight_fadeout *light = &lights[light_index];
73 litup = true;
74
75 if (light->life) {
76 light->life -= 1;
77 if (biton32(layer_state) == 0) {
78 sethsv(light->hue + rand() % 0xF, 255, light->life, (LED_TYPE *)&led[light_index]);
79 }
80 light->timer = timer_read();
81 }
82 else {
83 if (light->enabled && biton32(layer_state) == 0) { rgblight_sethsv_default_helper(light_index); }
84 litup = light->enabled = false;
85 }
86 }
87 }
88 if (litup && biton32(layer_state) == 0) {
89 rgblight_set();
90 }
91}
92
93void start_rgb_light(void) {
94
95 uint8_t indices[RGBLED_NUM];
96 uint8_t indices_count = 0;
97 uint8_t min_life = 0xFF;
98 uint8_t min_life_index = -1;
99 for (uint8_t index = 0 ; index < RGBLED_NUM ; ++index ) {
100 if (indicator_is_this_led_used(index)) { continue; }
101 if (lights[index].enabled) {
102 if (min_life_index == -1 ||
103 lights[index].life < min_life)
104 {
105 min_life = lights[index].life;
106 min_life_index = index;
107 }
108 continue;
109 }
110
111 indices[indices_count] = index;
112 ++indices_count;
113 }
114
115 uint8_t light_index;
116 if (!indices_count) {
117 light_index = min_life_index;
118 }
119 else {
120 light_index = indices[rand() % indices_count];
121 }
122
123 rgblight_fadeout *light = &lights[light_index];
124 light->enabled = true;
125 light->timer = timer_read();
126 light->life = 0xC0 + rand() % 0x40;
127
128 light->hue = rgblight_config.hue + (rand() % 0xB4) - 0x54;
129
130 rgblight_sethsv_at(light->hue, 255, light->life, light_index);
131}
132#endif
133
134
135bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
136 switch (keycode) {
137#ifdef RGBLIGHT_TWINKLE
138 case KC_A ... KC_SLASH:
139 case KC_F1 ... KC_F12:
140 case KC_INSERT ... KC_UP:
141 case KC_KP_SLASH ... KC_KP_DOT:
142 case KC_F13 ... KC_F24:
143 case KC_AUDIO_MUTE ... KC_MEDIA_REWIND:
144 if (record->event.pressed) { start_rgb_light(); }
145 return true; break;
146#endif // RGBLIGHT_TWINKLE
147 case KC_RGB_T: // This allows me to use underglow as layer indication, or as normal
148#ifdef RGBLIGHT_ENABLE
149 if (record->event.pressed) {
150 userspace_config.rgb_layer_change ^= 1;
151 xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
152 eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
153 if (userspace_config.rgb_layer_change) {
154 layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better)
155 }
156 }
157#endif // RGBLIGHT_ENABLE
158 return false; break;
159#ifdef RGBLIGHT_ENABLE
160 case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
161 if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled
162 if (userspace_config.rgb_layer_change) {
163 userspace_config.rgb_layer_change = false;
164 xprintf("rgblight layer change [EEPROM]: %u\n", userspace_config.rgb_layer_change);
165 eeprom_update_byte(EECONFIG_USERSPACE, userspace_config.raw);
166 }
167 }
168 return true; break;
169#endif // RGBLIGHT_ENABLE
170 }
171 return true;
172}
173
174
175
176void matrix_init_rgb(void) {
177#ifdef INDICATOR_LIGHTS
178 current_mod = last_mod = get_mods();
179 current_led = last_led = host_keyboard_leds();
180 current_osm = last_osm = get_oneshot_mods();
181#endif
182
183 if (userspace_config.rgb_layer_change) {
184 uint8_t default_layer = eeconfig_read_default_layer();
185 rgblight_enable_noeeprom();
186 if (default_layer & (1UL << _COLEMAK)) {
187 rgblight_sethsv_magenta();
188 } else if (default_layer & (1UL << _DVORAK)) {
189 rgblight_sethsv_green();
190 } else if (default_layer & (1UL << _WORKMAN)) {
191 rgblight_sethsv_goldenrod();
192 } else {
193 rgblight_sethsv_cyan();
194 }
195 }
196}
197
198void matrix_scan_rgb(void) {
199#ifdef RGBLIGHT_TWINKLE
200 scan_rgblight_fadeout();
201#endif // RGBLIGHT_ENABLE
202
203#ifdef INDICATOR_LIGHTS
204 matrix_scan_indicator();
205#endif
206
207}
208
209
210uint32_t layer_state_set_rgb(uint32_t state) {
211#ifdef RGBLIGHT_ENABLE
212 uint8_t default_layer = eeconfig_read_default_layer();
213 if (userspace_config.rgb_layer_change) {
214 switch (biton32(state)) {
215 case _MACROS:
216 rgblight_sethsv_noeeprom_orange();
217 userspace_config.is_overwatch ? rgblight_mode_noeeprom(17) : rgblight_mode_noeeprom(18);
218 break;
219 case _MEDIA:
220 rgblight_sethsv_noeeprom_chartreuse();
221 rgblight_mode_noeeprom(22);
222 break;
223 case _GAMEPAD:
224 rgblight_sethsv_noeeprom_orange();
225 rgblight_mode_noeeprom(17);
226 break;
227 case _DIABLO:
228 rgblight_sethsv_noeeprom_red();
229 rgblight_mode_noeeprom(5);
230 break;
231 case _RAISE:
232 rgblight_sethsv_noeeprom_yellow();
233 rgblight_mode_noeeprom(5);
234 break;
235 case _LOWER:
236 rgblight_sethsv_noeeprom_orange();
237 rgblight_mode_noeeprom(5);
238 break;
239 case _ADJUST:
240 rgblight_sethsv_noeeprom_red();
241 rgblight_mode_noeeprom(23);
242 break;
243 default: // for any other layers, or the default layer
244 if (default_layer & (1UL << _COLEMAK)) {
245 rgblight_sethsv_noeeprom_magenta();
246 } else if (default_layer & (1UL << _DVORAK)) {
247 rgblight_sethsv_noeeprom_green();
248 } else if (default_layer & (1UL << _WORKMAN)) {
249 rgblight_sethsv_noeeprom_goldenrod();
250 } else {
251 rgblight_sethsv_noeeprom_cyan();
252 }
253 biton32(state) == _MODS ? rgblight_mode_noeeprom(2) : rgblight_mode_noeeprom(1); // if _MODS layer is on, then breath to denote it
254 break;
255 }
256// layer_state_set_indicator(); // Runs every scan, so need to call this here .... since I can't get it working "right" anyhow
257 }
258#endif // RGBLIGHT_ENABLE
259
260 return state;
261}
diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h
new file mode 100644
index 000000000..6426ea266
--- /dev/null
+++ b/users/drashna/rgb_stuff.h
@@ -0,0 +1,16 @@
1#include "quantum.h"
2
3typedef struct {
4 bool enabled;
5 uint8_t hue;
6 uint16_t timer;
7 uint8_t life;
8} rgblight_fadeout;
9
10bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record);
11void scan_rgblight_fadeout(void);
12void matrix_init_rgb(void);
13void matrix_scan_rgb(void);
14uint32_t layer_state_set_rgb(uint32_t state);
15
16
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index e2c5a2995..18df665c0 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -1,11 +1,34 @@
1 1
2SRC += drashna.c 2SRC += drashna.c secrets.c rgb_stuff.c
3
4ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
5 SRC += tap_dances.c
6endif
7
3EXTRAFLAGS += -flto 8EXTRAFLAGS += -flto
4 9
5ifeq ($(strip $(NO_SECRETS)), yes) 10ifeq ($(strip $(NO_SECRETS)), yes)
6 OPT_DEFS += -DNO_SECRETS 11 OPT_DEFS += -DNO_SECRETS
7endif 12endif
8 13
9ifeq ($(strip $(INDICATOR_LIGHTS)), yes) 14ifdef RGBLIGHT_ENABLE
10 OPT_DEFS += -DINDICATOR_LIGHTS 15 ifeq ($(strip $(INDICATOR_LIGHTS)), yes)
16 OPT_DEFS += -DINDICATOR_LIGHTS
17 endif
18 ifeq ($(strip $(RGBLIGHT_TWINKLE)), yes)
19 OPT_DEFS += -DRGBLIGHT_TWINKLE
20 endif
21 ifeq ($(strip $(RGBLIGHT_NOEEPROM)), yes)
22 OPT_DEFS += -DRGBLIGHT_NOEEPROM
23 endif
24endif
25
26ifeq ($(strip $(MACROS_ENABLED)), yes)
27 OPT_DEFS += -DMACROS_ENABLED
28endif
29
30ifdef CONSOLE_ENABLE
31 ifeq ($(strip $(KEYLOGGER_ENABLE)), yes)
32 OPT_DEFS += -DKEYLOGGER_ENABLE
33 endif
11endif 34endif
diff --git a/users/drashna/tap_dances.c b/users/drashna/tap_dances.c
new file mode 100644
index 000000000..c9e4b1d0f
--- /dev/null
+++ b/users/drashna/tap_dances.c
@@ -0,0 +1,65 @@
1#include "drashna.h"
2#include "tap_dances.h"
3
4
5//define diablo macro timer variables
6uint16_t diablo_timer[4];
7uint8_t diablo_times[] = { 0, 1, 3, 5, 10, 30 };
8uint8_t diablo_key_time[4];
9
10// has the correct number of seconds elapsed (as defined by diablo_times)
11bool check_dtimer(uint8_t dtimer) { return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; };
12
13// Cycle through the times for the macro, starting at 0, for disabled.
14// Max of six values, so don't exceed
15void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
16 if (state->count >= 7) {
17 diablo_key_time[diablo_key] = diablo_times[0];
18 reset_tap_dance(state);
19 } else {
20 diablo_key_time[diablo_key] = diablo_times[state->count - 1];
21 }
22}
23
24// Would rather have one function for all of this, but no idea how to do that...
25void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 0); }
26void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 1); }
27void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 2); }
28void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { diablo_tapdance_master(state, user_data, 3); }
29
30//Tap Dance Definitions
31qk_tap_dance_action_t tap_dance_actions[] = {
32 // tap once to disable, and more to enable timed micros
33 [TD_D3_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
34 [TD_D3_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
35 [TD_D3_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
36 [TD_D3_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
37};
38
39// Sends the key press to system, but only if on the Diablo layer
40void send_diablo_keystroke(uint8_t diablo_key) {
41 if (biton32(layer_state) == _DIABLO) {
42 switch (diablo_key) {
43 case 0:
44 tap(KC_1); break;
45 case 1:
46 tap(KC_2); break;
47 case 2:
48 tap(KC_3); break;
49 case 3:
50 tap(KC_4); break;
51 }
52 }
53}
54
55// Checks each of the 4 timers/keys to see if enough time has elapsed
56// Runs the "send string" command if enough time has passed, and resets the timer.
57void run_diablo_macro_check(void) {
58 uint8_t dtime;
59 for (dtime = 0; dtime < 4; dtime++) {
60 if (check_dtimer(dtime) && diablo_key_time[dtime]) {
61 diablo_timer[dtime] = timer_read();
62 send_diablo_keystroke(dtime);
63 }
64 }
65}
diff --git a/users/drashna/tap_dances.h b/users/drashna/tap_dances.h
new file mode 100644
index 000000000..8935753f6
--- /dev/null
+++ b/users/drashna/tap_dances.h
@@ -0,0 +1,7 @@
1//define diablo macro timer variables
2extern uint16_t diablo_timer[4];
3extern uint8_t diablo_times[];
4extern uint8_t diablo_key_time[4];
5
6
7void run_diablo_macro_check(void);