aboutsummaryrefslogtreecommitdiff
path: root/users
diff options
context:
space:
mode:
Diffstat (limited to 'users')
-rw-r--r--users/drashna/config.h6
-rw-r--r--users/drashna/drashna.c96
-rw-r--r--users/drashna/drashna.h138
-rw-r--r--users/drashna/readme.md94
-rw-r--r--users/drashna/rgb_stuff.c147
-rw-r--r--users/drashna/rules.mk9
6 files changed, 388 insertions, 102 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h
index 26c989d7f..87050fbcc 100644
--- a/users/drashna/config.h
+++ b/users/drashna/config.h
@@ -1,5 +1,4 @@
1#ifndef USERSPACE_CONFIG_H 1#pragma once
2#define USERSPACE_CONFIG_H
3 2
4 3
5#ifdef AUDIO_ENABLE 4#ifdef AUDIO_ENABLE
@@ -71,5 +70,6 @@
71 70
72#define DISABLE_LEADER 71#define DISABLE_LEADER
73 72
74#endif // !USERSPACE_CONFIG_H 73#define MACRO_TIMER 5
74
75 75
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
index 8efd99f80..f72902f0b 100644
--- a/users/drashna/drashna.c
+++ b/users/drashna/drashna.c
@@ -38,7 +38,7 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
38 clear_keyboard(); 38 clear_keyboard();
39 tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER); 39 tap(userspace_config.is_overwatch ? KC_BSPC : KC_ENTER);
40 wait_ms(50); 40 wait_ms(50);
41 send_string(str); 41 send_string_with_delay(str, MACRO_TIMER);
42 wait_ms(50); 42 wait_ms(50);
43 tap(KC_ENTER); 43 tap(KC_ENTER);
44 } 44 }
@@ -48,6 +48,40 @@ bool send_game_macro(const char *str, keyrecord_t *record, bool override) {
48 48
49void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); }; 49void tap(uint16_t keycode){ register_code(keycode); unregister_code(keycode); };
50 50
51bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed) {
52 static uint16_t this_timer;
53 if(pressed) {
54 this_timer= timer_read();
55 } else {
56 if (timer_elapsed(this_timer) < TAPPING_TERM){
57 register_code(code);
58 unregister_code(code);
59 } else {
60 register_code(mod_code);
61 register_code(code);
62 unregister_code(code);
63 unregister_code(mod_code);
64 }
65 }
66 return false;
67}
68
69bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) {
70 if(pressed) {
71 this_timer= timer_read();
72 } else {
73 if (timer_elapsed(this_timer) < TAPPING_TERM){
74 register_code(code);
75 unregister_code(code);
76 } else {
77 register_code(mod_code);
78 register_code(code);
79 unregister_code(code);
80 unregister_code(mod_code);
81 }
82 }
83 return false;
84}
51 85
52// Add reconfigurable functions here, for keymap customization 86// Add reconfigurable functions here, for keymap customization
53// This allows for a global, userspace functions, and continued 87// This allows for a global, userspace functions, and continued
@@ -57,6 +91,15 @@ __attribute__ ((weak))
57void matrix_init_keymap(void) {} 91void matrix_init_keymap(void) {}
58 92
59__attribute__ ((weak)) 93__attribute__ ((weak))
94void startup_keymap(void) {}
95
96__attribute__ ((weak))
97void suspend_power_down_keymap(void) {}
98
99__attribute__ ((weak))
100void suspend_wakeup_init_keymap(void) {}
101
102__attribute__ ((weak))
60void matrix_scan_keymap(void) {} 103void matrix_scan_keymap(void) {}
61 104
62__attribute__ ((weak)) 105__attribute__ ((weak))
@@ -69,12 +112,18 @@ bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
69 return true; 112 return true;
70} 113}
71 114
115
72__attribute__ ((weak)) 116__attribute__ ((weak))
73uint32_t layer_state_set_keymap (uint32_t state) { 117uint32_t layer_state_set_keymap (uint32_t state) {
74 return state; 118 return state;
75} 119}
76 120
77__attribute__ ((weak)) 121__attribute__ ((weak))
122uint32_t default_layer_state_set_keymap (uint32_t state) {
123 return state;
124}
125
126__attribute__ ((weak))
78void led_set_keymap(uint8_t usb_led) {} 127void led_set_keymap(uint8_t usb_led) {}
79 128
80 129
@@ -99,14 +148,38 @@ void matrix_init_user(void) {
99#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE)) 148#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
100 set_unicode_input_mode(UC_WINC); 149 set_unicode_input_mode(UC_WINC);
101#endif //UNICODE_ENABLE 150#endif //UNICODE_ENABLE
102 matrix_init_rgb();
103 matrix_init_keymap(); 151 matrix_init_keymap();
104} 152}
105 153
154void startup_user (void) {
155 #ifdef RGBLIGHT_ENABLE
156 matrix_init_rgb();
157 #endif //RGBLIGHT_ENABLE
158 startup_keymap();
159}
160
161void suspend_power_down_user(void)
162{
163 suspend_power_down_keymap();
164}
165
166void suspend_wakeup_init_user(void)
167{
168 suspend_wakeup_init_keymap();
169 #ifdef KEYBOARD_ergodox_ez
170 wait_ms(10);
171 #endif
172}
173
106 174
107// No global matrix scan code, so just run keymap's matrix 175// No global matrix scan code, so just run keymap's matrix
108// scan function 176// scan function
109void matrix_scan_user(void) { 177void matrix_scan_user(void) {
178 static bool has_ran_yet;
179 if (!has_ran_yet) {
180 has_ran_yet = true;
181 startup_user();
182 }
110 183
111#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. 184#ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code.
112 run_diablo_macro_check(); 185 run_diablo_macro_check();
@@ -160,7 +233,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
160 233
161 case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader 234 case KC_MAKE: // Compiles the firmware, and adds the flash command based on keyboard bootloader
162 if (!record->event.pressed) { 235 if (!record->event.pressed) {
163 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP 236 send_string_with_delay_P(PSTR("make " QMK_KEYBOARD ":" QMK_KEYMAP
164#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU)) 237#if (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
165 ":dfu" 238 ":dfu"
166#elif defined(BOOTLOADER_HALFKAY) 239#elif defined(BOOTLOADER_HALFKAY)
@@ -168,7 +241,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
168#elif defined(BOOTLOADER_CATERINA) 241#elif defined(BOOTLOADER_CATERINA)
169 ":avrdude" 242 ":avrdude"
170#endif // bootloader options 243#endif // bootloader options
171 SS_TAP(X_ENTER)); 244 SS_TAP(X_ENTER)), 10);
172 } 245 }
173 return false; 246 return false;
174 break; 247 break;
@@ -197,7 +270,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
197 break; 270 break;
198 case VRSN: // Prints firmware version 271 case VRSN: // Prints firmware version
199 if (record->event.pressed) { 272 if (record->event.pressed) {
200 SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); 273 send_string_with_delay_P(PSTR(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE), MACRO_TIMER);
201 } 274 }
202 return false; 275 return false;
203 break; 276 break;
@@ -256,7 +329,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
256 diablo_key_time[dtime] = diablo_times[0]; 329 diablo_key_time[dtime] = diablo_times[0];
257 } 330 }
258 } 331 }
259#endif // TAP_DANCE_ENABLE#endif 332#endif // TAP_DANCE_ENABLE
260 return false; break; 333 return false; break;
261 334
262 335
@@ -314,7 +387,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
314#endif // UNICODE_ENABLE 387#endif // UNICODE_ENABLE
315 388
316 } 389 }
317 return process_record_keymap(keycode, record) && process_record_secrets(keycode, record) && process_record_user_rgb(keycode, record); 390 return process_record_keymap(keycode, record) &&
391#ifdef RGBLIGHT_ENABLE
392 process_record_user_rgb(keycode, record) &&
393#endif // RGBLIGHT_ENABLE
394 process_record_secrets(keycode, record);
318} 395}
319 396
320 397
@@ -331,6 +408,11 @@ uint32_t layer_state_set_user(uint32_t state) {
331} 408}
332 409
333 410
411uint32_t default_layer_state_set_kb(uint32_t state) {
412 return default_layer_state_set_keymap (state);
413}
414
415
334// Any custom LED code goes here. 416// Any custom LED code goes here.
335// So far, I only have keyboard specific code, 417// So far, I only have keyboard specific code,
336// So nothing goes here. 418// So nothing goes here.
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
index e035b86fb..3efef5704 100644
--- a/users/drashna/drashna.h
+++ b/users/drashna/drashna.h
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
19#define USERSPACE 19#define USERSPACE
20#include "quantum.h" 20#include "quantum.h"
21 21
22
22// Define layer names 23// Define layer names
23enum userspace_layers { 24enum userspace_layers {
24 _QWERTY = 0, 25 _QWERTY = 0,
@@ -53,8 +54,8 @@ void rgblight_sethsv_default_helper(uint8_t index);
53#endif // RGBLIGHT_ENABLE 54#endif // RGBLIGHT_ENABLE
54 55
55void tap(uint16_t keycode); 56void tap(uint16_t keycode);
56bool process_record_secrets(uint16_t keycode, keyrecord_t *record); 57bool mod_key_press_timer (uint16_t code, uint16_t mod_code, bool pressed);
57 58bool mod_key_press (uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer);
58 59
59#define EECONFIG_USERSPACE (uint8_t *)19 60#define EECONFIG_USERSPACE (uint8_t *)19
60 61
@@ -69,15 +70,15 @@ typedef union {
69} userspace_config_t; 70} userspace_config_t;
70 71
71enum userspace_custom_keycodes { 72enum userspace_custom_keycodes {
72 EPRM = SAFE_RANGE, // can always be here 73 EPRM = SAFE_RANGE, // Resets EEPROM do defaults (as in eeconfig_init)
73 VRSN, 74 VRSN, // Prints QMK Firmware and board info
74 KC_QWERTY, 75 KC_QWERTY, // Sets default layer to QWERTY
75 KC_COLEMAK, 76 KC_COLEMAK, // Sets default layer to COLEMAK
76 KC_DVORAK, 77 KC_DVORAK, // Sets default layer to DVORAK
77 KC_WORKMAN, 78 KC_WORKMAN, // Sets default layer to WORKMAN
78 KC_DIABLO_CLEAR, 79 KC_DIABLO_CLEAR, // Clears all Diablo Timers
79 KC_OVERWATCH, 80 KC_OVERWATCH, // Toggles game macro input mode (so in OW, it defaults to game chat)
80 KC_SALT, 81 KC_SALT, // See drashna.c for details
81 KC_MORESALT, 82 KC_MORESALT,
82 KC_SALTHARD, 83 KC_SALTHARD,
83 KC_GOODGAME, 84 KC_GOODGAME,
@@ -88,27 +89,28 @@ enum userspace_custom_keycodes {
88 KC_AIM, 89 KC_AIM,
89 KC_C9, 90 KC_C9,
90 KC_GGEZ, 91 KC_GGEZ,
91 KC_MAKE, 92 KC_MAKE, // Run keyboard's customized make command
92 KC_RESET, 93 KC_RESET, // Resets keyboard, with red underglow
93 KC_RGB_T, 94 KC_RGB_T, // Toggles RGB Layer Indication mode
94 KC_SECRET_1, 95 KC_SECRET_1, // test1
95 KC_SECRET_2, 96 KC_SECRET_2, // test2
96 KC_SECRET_3, 97 KC_SECRET_3, // test3
97 KC_SECRET_4, 98 KC_SECRET_4, // test4
98 KC_SECRET_5, 99 KC_SECRET_5, // test5
99 KC_CCCV, 100 KC_CCCV, // Hold to copy, tap to paste
100 KC_NUKE, 101 KC_NUKE, // NUCLEAR LAUNCH DETECTED!!!
101 102
102#ifdef UNICODE_ENABLE 103#ifdef UNICODE_ENABLE
103 UC_FLIP, 104 UC_FLIP, // Table flip (not working?)
104#endif //UNICODE_ENABLE 105#endif //UNICODE_ENABLE
105 NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes 106 NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes
106}; 107};
107 108
108#define LOWER MO(_LOWER) 109#define LOWER MO(_LOWER)
109#define RAISE MO(_RAISE) 110#define RAISE MO(_RAISE)
110#define ADJUST MO(_ADJUST) 111#define ADJUST MO(_ADJUST)
111 112#define TG_MODS TG(_MODS)
113#define TG_GAME TG(_GAMEPAD)
112 114
113#define KC_SEC1 KC_SECRET_1 115#define KC_SEC1 KC_SECRET_1
114#define KC_SEC2 KC_SECRET_2 116#define KC_SEC2 KC_SECRET_2
@@ -184,7 +186,7 @@ enum {
184#define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__) 186#define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__)
185#define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__) 187#define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__)
186#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__) 188#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
187 189#define LAYOUT_ortho_4x12_wrapper(...) LAYOUT_ortho_4x12(__VA_ARGS__)
188 190
189// Blocks for each of the four major keyboard layouts 191// Blocks for each of the four major keyboard layouts
190// Organized so we can quickly adapt and modify all of them 192// Organized so we can quickly adapt and modify all of them
@@ -237,7 +239,7 @@ enum {
237 239
238#define _________________WORKMAN_R1________________ KC_J, KC_F, KC_U, KC_P, KC_SCLN 240#define _________________WORKMAN_R1________________ KC_J, KC_F, KC_U, KC_P, KC_SCLN
239#define _________________WORKMAN_R2________________ KC_Y, KC_N, KC_E, KC_O, KC_I 241#define _________________WORKMAN_R2________________ KC_Y, KC_N, KC_E, KC_O, KC_I
240#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, CTL_T(KC_SLASH) 242#define _________________WORKMAN_R3________________ KC_K, KC_L, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
241 243
242 244
243#define _________________NORMAN_L1_________________ KC_Q, KC_W, KC_D, KC_F, KC_K 245#define _________________NORMAN_L1_________________ KC_Q, KC_W, KC_D, KC_F, KC_K
@@ -248,11 +250,89 @@ enum {
248#define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U 250#define _________________NORMAN_R2_________________ KC_Y, KC_N, KC_I, KC_O, KC_U
249#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) 251#define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH)
250 252
253
254#define _________________MALTRON_L1________________ KC_Q, KC_P, KC_Y, KC_C, KC_B
255#define _________________MALTRON_L2________________ KC_A, KC_N, KC_I, KC_S, KC_F
256#define _________________MALTRON_L3________________ CTL_T(KC_SCLN), KC_SLSH, KC_J KC_G, KC_COMM
257
258#define _________________MALTRON_R1________________ KC_V, KC_M, KC_U, KC_Z, KC_L
259#define _________________MALTRON_R2________________ KC_D, KC_T, KC_D, KC_O, KC_R
260#define _________________MALTRON_R3________________ KC_DOT, KC_W, KC_K, KC_MINS, CTL_T(KC_x)
261
262
263#define _________________EUCALYN_L1________________ KC_SLSH, KC_COMM, KC_DOT, KC_F, KC_Q
264#define _________________EUCALYN_L2________________ KC_A, KC_O, KC_E, KC_I, KC_U
265#define _________________EUCALYN_L3________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_W
266
267#define _________________EUCALYN_R1________________ KC_M, KC_R, KC_D, KC_Y, KC_P
268#define _________________EUCALYN_R2________________ KC_G, KC_T, KC_K, KC_S, KC_N
269#define _________________EUCALYN_R3________________ KC_B, KC_H, KC_J, KC_L, CTL_T(KC_SCLN)
270
271
272#define _____________CARPLAX_QFMLWY_L1_____________ KC_Q, KC_F, KC_M, KC_L, KC_W
273#define _____________CARPLAX_QFMLWY_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
274#define _____________CARPLAX_QFMLWY_L3_____________ CTL_T(KC_Z), KC_V, KC_G, KC_C, KC_X
275
276#define _____________CARPLAX_QFMLWY_R1_____________ KC_Y, KC_U, KC_O, KC_B, KC_J
277#define _____________CARPLAX_QFMLWY_R2_____________ KC_I, KC_A, KC_E, KC_H, KC_SCLN
278#define _____________CARPLAX_QFMLWY_R3_____________ KC_P, KC_K, KC_COMM, KC_DOT, CTL_T(KC_SLSH)
279
280
281#define _____________CARPLAX_QGMLWB_L1_____________ KC_Q, KC_G, KC_M, KC_L, KC_W
282#define _____________CARPLAX_QGMLWB_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
283#define _____________CARPLAX_QGMLWB_L3_____________ CTL_T(KC_Z), KC_X, KC_C, KC_F, KC_J
284
285#define _____________CARPLAX_QGMLWB_R1_____________ KC_B, KC_Y, KC_U, KC_V, KC_SCLN
286#define _____________CARPLAX_QGMLWB_R2_____________ KC_I, KC_A, KC_E, KC_O, KC_H
287#define _____________CARPLAX_QGMLWB_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, CTL_T(KC_SLSH)
288
289
290#define _____________CARPLAX_QGMLWY_L1_____________ KC_Q, KC_G, KC_M, KC_L, KC_W
291#define _____________CARPLAX_QGMLWY_L2_____________ KC_D, KC_S, KC_T, KC_N, KC_R
292#define _____________CARPLAX_QGMLWY_L3_____________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_J
293
294#define _____________CARPLAX_QGMLWY_R1_____________ KC_Y, KC_F, KC_U, KC_B, KC_SCLN
295#define _____________CARPLAX_QGMLWY_R2_____________ KC_I, KC_A, KC_E, KC_O, KC_H
296#define _____________CARPLAX_QGMLWY_R3_____________ KC_K, KC_P, KC_COMM, KC_DOT, CTL_T(KC_SLSH)
297
298
251#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5 299#define ________________NUMBER_LEFT________________ KC_1, KC_2, KC_3, KC_4, KC_5
252#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0 300#define ________________NUMBER_RIGHT_______________ KC_6, KC_7, KC_8, KC_9, KC_0
253#define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5 301#define _________________FUNC_LEFT_________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5
254#define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10 302#define _________________FUNC_RIGHT________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10
255 303
304#define ___________________BLANK___________________ _______, _______, _______, _______, _______
305
306
307#define _________________LOWER_L1__________________ KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC
308#define _________________LOWER_L2__________________ _________________FUNC_LEFT_________________
309#define _________________LOWER_L3__________________ _________________FUNC_RIGHT________________
310
311#define _________________LOWER_R1__________________ KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN
312#define _________________LOWER_R2__________________ _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR
313#define _________________LOWER_R3__________________ _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
314
315
316
317#define _________________RAISE_L1__________________ ________________NUMBER_LEFT________________
318#define _________________RAISE_L2__________________ ___________________BLANK___________________
319#define _________________RAISE_L3__________________ ___________________BLANK___________________
320
321#define _________________RAISE_R1__________________ ________________NUMBER_RIGHT_______________
322#define _________________RAISE_R2__________________ _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC
323#define _________________RAISE_R3__________________ _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END
324
325
326
327#define _________________ADJUST_L1_________________ RGB_MOD, RGB_HUI, RGB_SAI, RGB_VAI, RGB_TOG
328#define _________________ADJUST_L2_________________ _______, CK_TOGG, AU_ON, AU_OFF, AG_NORM
329#define _________________ADJUST_L3_________________ RGB_RMOD,RGB_HUD,RGB_SAD, RGB_VAD, KC_RGB_T
330
331#define _________________ADJUST_R1_________________ KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5
332#define _________________ADJUST_R2_________________ AG_SWAP, QWERTY, COLEMAK, DVORAK, WORKMAN
333#define _________________ADJUST_R3_________________ MG_NKRO, KC_MUTE, KC_VOLD, KC_VOLU, KC_MNXT
334
335
256// Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN), 336// Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN),
257// this allows us to quickly modify the bottom row for all of the layouts 337// this allows us to quickly modify the bottom row for all of the layouts
258// so we don't have to alter it 4 times and hope that we haven't missed 338// so we don't have to alter it 4 times and hope that we haven't missed
@@ -261,7 +341,11 @@ enum {
261#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT 341#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
262 342
263 343
264#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \ 344#define ___________ORTHODOX_THUMP_TOP_____________ ALT_APP, OS_LGUI, KC_LALT, OS_RGUI
345#define ___________________ORTHODOX_THUMB_BOTTOM____________________ LOWER, KC_SPACE,KC_BSPC, KC_DEL, KC_ENT, RAISE
346
347
348#define __________________ERGODOX_THUMB_CLUSTER_____________________ ALT_T(KC_APP), OSM(MOD_LGUI), OSM(MOD_RGUI), CTL_T(KC_ESCAPE), \
265 KC_HOME, KC_PGUP, \ 349 KC_HOME, KC_PGUP, \
266 LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER) 350 LT(_LOWER, KC_SPACE),KC_BSPC, KC_END, KC_PGDN, KC_DEL, LT(_RAISE, KC_ENTER)
267 351
diff --git a/users/drashna/readme.md b/users/drashna/readme.md
index 0aa73ece9..179960322 100644
--- a/users/drashna/readme.md
+++ b/users/drashna/readme.md
@@ -75,11 +75,12 @@ For critics that think this is cheating, search "diablo 3 num lock auto cast".
75Secret Macros 75Secret Macros
76------------- 76-------------
77 77
78With help from gitter and Colinta, this adds the ability to add hidden strings to be used for macros. 78With help from gitter and Colinta, this adds the ability to add hidden macros from other users.
79 79
80I have a number of long strings that I need to use that are semi-private. This uses the `__has_include` function to check for the file. If it exists, then it includes the custom text. Otherwise, it uses some default values. 80First, I have several files that are hidden/excluded from Git/GitHub. These contain everything needed for the macros. To hide these files, open `.git/info/exclude` and add `secrets.c` and `secrets.h` to that file, below the comments.
81
82And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your `<name>.h` file to define the keycodes for the new macros.
81 83
82If you would *also* like to take advantage of this feature, you'll first want to make sure your "secrets" file isn't included in the repo. Open `.git/info/exclude` and add `secrets.h` to that file, below the comments.
83 84
84###### .git/info/exclude 85###### .git/info/exclude
85``` 86```
@@ -89,10 +90,44 @@ If you would *also* like to take advantage of this feature, you'll first want to
89# exclude patterns (uncomment them if you want to use them): 90# exclude patterns (uncomment them if you want to use them):
90# *.[oa] 91# *.[oa]
91# *~ 92# *~
93/users/drashna/secrets.c
92/users/drashna/secrets.h 94/users/drashna/secrets.h
93``` 95```
94 96
95Then you can create this file and add your macro strings to it: 97Then you can create these files:
98
99###### secrets.c
100
101```c
102#include "drashna.h" // replace with your keymap's "h" file, or whatever file stores the keycodes
103
104#if (__has_include("secrets.h") && !defined(NO_SECRETS))
105#include "secrets.h"
106#else
107// `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware
108// And I'm not familiar enough to know which is better or why...
109static const char * const secret[] = {
110 "test1",
111 "test2",
112 "test3",
113 "test4",
114 "test5"
115};
116#endif
117
118bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
119 switch (keycode) {
120 case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo
121 if (!record->event.pressed) {
122 clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED);
123 send_string_with_delay(secret[keycode - KC_SECRET_1], MACRO_TIMER);
124 }
125 return false;
126 break;
127 }
128 return true;
129}
130```
96 131
97###### secrets.h 132###### secrets.h
98```c 133```c
@@ -107,36 +142,33 @@ static const char * const secrets[] = {
107 142
108Replacing the strings with the codes that you need. 143Replacing the strings with the codes that you need.
109 144
145###### name.c
146
110In the `<name>.c` file, you will want to add this to the top: 147In the `<name>.c` file, you will want to add this to the top:
111 148
112```c 149```c
113 150__attribute__ ((weak))
114#if (__has_include("secrets.h") && !defined(NO_SECRETS)) 151bool process_record_secrets(uint16_t keycode, keyrecord_t *record) {
115#include "secrets.h" 152 return true;
116#else 153}
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...
119static const char * const secrets[] = {
120 "test1",
121 "test2",
122 "test3",
123 "test4",
124 "test5"
125};
126#endif
127``` 154```
155This is so that the function can be called here, and replaced in the `secrets.c` file, and so it won't error out if it doesn't exist.
156
128 157
129And then, in the `process_record_user` function, you'll want to add this block: 158And then, in the `process_record_user` function, assuming you have `return process_record_keymap(keycode, record)` here, you'll want to replace the "final" return with the following. Otherwise, you want to replace the `return true;` with `return process_record_secrets(keycode, record);`
130```c 159```c
131 case KC_SECRET_1 ... KC_SECRET_5: 160 return process_record_keymap(keycode, record) && process_record_secrets(keycode, record);
132 if (!record->event.pressed) { 161}
133 send_string_P(secret[keycode - KC_SECRET_1]);
134 }
135 return false;
136 break;
137``` 162```
138 163
139And this requires `KC_SECRET_1` through `KC_SECRET_5` to be defined in your `<name>.h` file fo the new macros, as well. 164###### rules.mk
165
166Here, you want your `/users/<name>/rules.mk` file to "detect" the existence of the `secrets.c` file, and only add it if the file exists. To do so, add this block:
167```c
168ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
169 SRC += secrets.c
170endif
171```
140 172
141Additionally, if you want to make sure that you can disable the function without messing with the file, you need to add this to your `/users/<name>/rules.mk`, so that it catches the flag: 173Additionally, if you want to make sure that you can disable the function without messing with the file, you need to add this to your `/users/<name>/rules.mk`, so that it catches the flag:
142```c 174```c
@@ -181,15 +213,15 @@ Pro Micro Hacking
181 213
182Well, you can get the QMK DFU bootloader working on the ProMicro. But you need to change fuses. 214Well, you can get the QMK DFU bootloader working on the ProMicro. But you need to change fuses.
183 215
184What worked to get into the firmware properly was: 216What worked to get into the firmware properly was:
185 217
186``` 218```
187Low: 0x5E High: 0x99 Extended: 0xF3 Lock: 0xFF 219Low: 0x5E High: 0xD9 Extended: 0xC3 Lock: 0x3F
188``` 220```
189 221
190But some of the columns and rows didn't work, like the pin mapping was wrong. Even when setting the bootloader settings. 222The reason that there was some issues before, is that JTAG was still enabled, and using some of the pins that the keyboard uses. Disabling JTAG (either by fuse, or modifying the matrix code for splits fixes the issue).
191 223
192 This is here for future reference. And the default fuse settings I believe were: 224And for reference, if you want to go back to caterina, the default fuse settings I believe were:
193 225
194``` 226```
195Low: 0xFF High: 0xD8 Extended: 0xC3 Lock: 0x3F 227Low: 0xFF High: 0xD8 Extended: 0xC3 Lock: 0x3F
diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c
index af7190cc3..f2a9a47a9 100644
--- a/users/drashna/rgb_stuff.c
+++ b/users/drashna/rgb_stuff.c
@@ -1,5 +1,6 @@
1#include "drashna.h" 1#include "drashna.h"
2#include "rgb_stuff.h" 2#include "rgb_stuff.h"
3#include "eeprom.h"
3 4
4extern rgblight_config_t rgblight_config; 5extern rgblight_config_t rgblight_config;
5extern userspace_config_t userspace_config; 6extern userspace_config_t userspace_config;
@@ -22,25 +23,64 @@ uint8_t current_osm;
22void set_rgb_indicators(uint8_t this_mod, uint8_t this_led, uint8_t this_osm) { 23void 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 (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 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 #ifdef SHFT_LED1
26 rgblight_sethsv_at(0, 255, 255, SHFT_LED2); 27 rgblight_sethsv_at(120, 255, 255, SHFT_LED1);
28 #endif // SHFT_LED1
29 #ifdef SHFT_LED2
30 rgblight_sethsv_at(120, 255, 255, SHFT_LED2);
31 #endif // SHFT_LED2
27 } else { 32 } else {
28 rgblight_sethsv_default_helper(SHFT_LED1); 33 #ifdef SHFT_LED1
29 rgblight_sethsv_default_helper(SHFT_LED2); 34 rgblight_sethsv_default_helper(SHFT_LED1);
35 #endif // SHFT_LED1
36 #ifdef SHFT_LED2
37 rgblight_sethsv_default_helper(SHFT_LED2);
38 #endif // SHFT_LED2
30 } 39 }
31 if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) { 40 if (this_mod & MODS_CTRL_MASK || this_osm & MODS_CTRL_MASK) {
32 rgblight_sethsv_at(51, 255, 255, CTRL_LED1); 41 #ifdef CTRL_LED1
33 rgblight_sethsv_at(51, 255, 255, CTRL_LED2); 42 rgblight_sethsv_at(0, 255, 255, CTRL_LED1);
43 #endif // CTRL_LED1
44 #ifdef CTRL_LED2
45 rgblight_sethsv_at(0, 255, 255, CTRL_LED2);
46 #endif // CTRL_LED2
34 } else { 47 } else {
35 rgblight_sethsv_default_helper(CTRL_LED1); 48 #ifdef CTRL_LED1
36 rgblight_sethsv_default_helper(CTRL_LED2); 49 rgblight_sethsv_default_helper(CTRL_LED1);
50 #endif // CTRL_LED1
51 #ifdef CTRL_LED2
52 rgblight_sethsv_default_helper(CTRL_LED2);
53 #endif // CTRL_LED2
37 } 54 }
38 if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) { 55 if (this_mod & MODS_GUI_MASK || this_osm & MODS_GUI_MASK) {
39 rgblight_sethsv_at(120, 255, 255, GUI_LED1); 56 #ifdef GUI_LED1
40 rgblight_sethsv_at(120, 255, 255, GUI_LED2); 57 rgblight_sethsv_at(51, 255, 255, GUI_LED1);
58 #endif // GUI_LED1
59 #ifdef GUI_LED2
60 rgblight_sethsv_at(51, 255, 255, GUI_LED2);
61 #endif // GUI_LED2
41 } else { 62 } else {
42 rgblight_sethsv_default_helper(GUI_LED1); 63 #ifdef GUI_LED1
43 rgblight_sethsv_default_helper(GUI_LED2); 64 rgblight_sethsv_default_helper(GUI_LED1);
65 #endif // GUI_LED1
66 #ifdef GUI_LED2
67 rgblight_sethsv_default_helper(GUI_LED2);
68 #endif // GUI_LED2
69 }
70 if (this_mod & MODS_ALT_MASK || this_osm & MODS_ALT_MASK) {
71 #ifdef ALT_LED1
72 rgblight_sethsv_at(240, 255, 255, ALT_LED1);
73 #endif // ALT_LED1
74 #ifdef GUI_LED2
75 rgblight_sethsv_at(240, 255, 255, ALT_LED2);
76 #endif // GUI_LED2
77 } else {
78 #ifdef GUI_LED1
79 rgblight_sethsv_default_helper(ALT_LED1);
80 #endif // GUI_LED1
81 #ifdef GUI_LED2
82 rgblight_sethsv_default_helper(ALT_LED2);
83 #endif // GUI_LED2
44 } 84 }
45 } 85 }
46} 86}
@@ -63,7 +103,48 @@ void matrix_scan_indicator(void) {
63static rgblight_fadeout lights[RGBLED_NUM]; 103static rgblight_fadeout lights[RGBLED_NUM];
64 104
65__attribute__ ((weak)) 105__attribute__ ((weak))
66bool indicator_is_this_led_used(uint8_t index) { return false; } 106bool rgblight_twinkle_is_led_used_keymap(uint8_t index) { return false; }
107
108bool rgblight_twinkle_is_led_used(uint8_t index) {
109 switch (index) {
110#ifdef INDICATOR_LIGHTS
111#ifdef SHFT_LED1
112 case SHFT_LED1:
113 return true;
114#endif //SHFT_LED1
115#ifdef SHFT_LED2
116 case SHFT_LED2:
117 return true;
118#endif //SHFT_LED2
119#ifdef CTRL_LED1
120 case CTRL_LED1:
121 return true;
122#endif //CTRL_LED1
123#ifdef CTRL_LED2
124 case CTRL_LED2:
125 return true;
126#endif //CTRL_LED2
127#ifdef GUI_LED1
128 case GUI_LED1:
129 return true;
130#endif //GUI_LED1
131#ifdef GUI_LED2
132 case GUI_LED2:
133 return true;
134#endif //GUI_LED2
135#ifdef ALT_LED1
136 case ALT_LED1:
137 return true;
138#endif //ALT_LED1
139#ifdef ALT_LED2
140 case ALT_LED2:
141 return true;
142#endif //ALT_LED2
143#endif //INDICATOR_LIGHTS
144 default:
145 return rgblight_twinkle_is_led_used_keymap(index);
146 }
147}
67 148
68void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive 149void scan_rgblight_fadeout(void) { // Don't effing change this function .... rgblight_sethsv is supppppper intensive
69 bool litup = false; 150 bool litup = false;
@@ -97,7 +178,7 @@ void start_rgb_light(void) {
97 uint8_t min_life = 0xFF; 178 uint8_t min_life = 0xFF;
98 uint8_t min_life_index = -1; 179 uint8_t min_life_index = -1;
99 for (uint8_t index = 0 ; index < RGBLED_NUM ; ++index ) { 180 for (uint8_t index = 0 ; index < RGBLED_NUM ; ++index ) {
100 if (indicator_is_this_led_used(index)) { continue; } 181 if (rgblight_twinkle_is_led_used(index)) { continue; }
101 if (lights[index].enabled) { 182 if (lights[index].enabled) {
102 if (min_life_index == -1 || 183 if (min_life_index == -1 ||
103 lights[index].life < min_life) 184 lights[index].life < min_life)
@@ -181,16 +262,16 @@ void matrix_init_rgb(void) {
181#endif 262#endif
182 263
183 if (userspace_config.rgb_layer_change) { 264 if (userspace_config.rgb_layer_change) {
184 uint8_t default_layer = eeconfig_read_default_layer();
185 rgblight_enable_noeeprom(); 265 rgblight_enable_noeeprom();
186 if (default_layer & (1UL << _COLEMAK)) { 266 switch (biton32(eeconfig_read_default_layer())) {
187 rgblight_sethsv_magenta(); 267 case _COLEMAK:
188 } else if (default_layer & (1UL << _DVORAK)) { 268 rgblight_sethsv_noeeprom_magenta(); break;
189 rgblight_sethsv_green(); 269 case _DVORAK:
190 } else if (default_layer & (1UL << _WORKMAN)) { 270 rgblight_sethsv_noeeprom_green(); break;
191 rgblight_sethsv_goldenrod(); 271 case _WORKMAN:
192 } else { 272 rgblight_sethsv_noeeprom_goldenrod(); break;
193 rgblight_sethsv_cyan(); 273 default:
274 rgblight_sethsv_noeeprom_cyan(); break;
194 } 275 }
195 } 276 }
196} 277}
@@ -209,7 +290,6 @@ void matrix_scan_rgb(void) {
209 290
210uint32_t layer_state_set_rgb(uint32_t state) { 291uint32_t layer_state_set_rgb(uint32_t state) {
211#ifdef RGBLIGHT_ENABLE 292#ifdef RGBLIGHT_ENABLE
212 uint8_t default_layer = eeconfig_read_default_layer();
213 if (userspace_config.rgb_layer_change) { 293 if (userspace_config.rgb_layer_change) {
214 switch (biton32(state)) { 294 switch (biton32(state)) {
215 case _MACROS: 295 case _MACROS:
@@ -241,14 +321,15 @@ uint32_t layer_state_set_rgb(uint32_t state) {
241 rgblight_mode_noeeprom(23); 321 rgblight_mode_noeeprom(23);
242 break; 322 break;
243 default: // for any other layers, or the default layer 323 default: // for any other layers, or the default layer
244 if (default_layer & (1UL << _COLEMAK)) { 324 switch (biton32(default_layer_state)) {
245 rgblight_sethsv_noeeprom_magenta(); 325 case _COLEMAK:
246 } else if (default_layer & (1UL << _DVORAK)) { 326 rgblight_sethsv_noeeprom_magenta(); break;
247 rgblight_sethsv_noeeprom_green(); 327 case _DVORAK:
248 } else if (default_layer & (1UL << _WORKMAN)) { 328 rgblight_sethsv_noeeprom_green(); break;
249 rgblight_sethsv_noeeprom_goldenrod(); 329 case _WORKMAN:
250 } else { 330 rgblight_sethsv_noeeprom_goldenrod(); break;
251 rgblight_sethsv_noeeprom_cyan(); 331 default:
332 rgblight_sethsv_noeeprom_cyan(); break;
252 } 333 }
253 biton32(state) == _MODS ? rgblight_mode_noeeprom(2) : rgblight_mode_noeeprom(1); // if _MODS layer is on, then breath to denote it 334 biton32(state) == _MODS ? rgblight_mode_noeeprom(2) : rgblight_mode_noeeprom(1); // if _MODS layer is on, then breath to denote it
254 break; 335 break;
@@ -259,3 +340,5 @@ uint32_t layer_state_set_rgb(uint32_t state) {
259 340
260 return state; 341 return state;
261} 342}
343
344
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
index 18df665c0..e299f24a1 100644
--- a/users/drashna/rules.mk
+++ b/users/drashna/rules.mk
@@ -1,5 +1,9 @@
1 1
2SRC += drashna.c secrets.c rgb_stuff.c 2SRC += drashna.c
3
4ifneq ("$(wildcard $(USER_PATH)/secrets.c)","")
5 SRC += secrets.c
6endif
3 7
4ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) 8ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
5 SRC += tap_dances.c 9 SRC += tap_dances.c
@@ -11,7 +15,8 @@ ifeq ($(strip $(NO_SECRETS)), yes)
11 OPT_DEFS += -DNO_SECRETS 15 OPT_DEFS += -DNO_SECRETS
12endif 16endif
13 17
14ifdef RGBLIGHT_ENABLE 18ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
19 SRC += rgb_stuff.c
15 ifeq ($(strip $(INDICATOR_LIGHTS)), yes) 20 ifeq ($(strip $(INDICATOR_LIGHTS)), yes)
16 OPT_DEFS += -DINDICATOR_LIGHTS 21 OPT_DEFS += -DINDICATOR_LIGHTS
17 endif 22 endif