aboutsummaryrefslogtreecommitdiff
path: root/users/drashna
diff options
context:
space:
mode:
authordrashna <drashna@live.com>2017-11-06 21:11:08 -0800
committerJack Humbert <jack.humb@gmail.com>2017-11-07 00:11:08 -0500
commit363aa8aa2eeedaded6fe9fd35ba5c02329d83959 (patch)
tree189433181f4ee93c3bfbb194c090b7530e0e83cd /users/drashna
parentef2961798cddb43dbcbac9d72ca9d84d71ad565e (diff)
downloadqmk_firmware-363aa8aa2eeedaded6fe9fd35ba5c02329d83959.tar.gz
qmk_firmware-363aa8aa2eeedaded6fe9fd35ba5c02329d83959.zip
Migrated most code from keymaps to userspace (#1980)
* Add woodpad * Cleanup * Remove misc layouts for woodpad * Move woodpad to handwired * Updated RGB Underglow info * Cleanup macros * Tweaked RGB lighting stuff * Start to merge orthodox/ergodox keymaps (persistant layers) * Add woodpad * Add forced NKRO * Added default layer (qwerty/colemak/dvorak) detection to RGB Underglow * Updated macros and added workman keymaps * Fixed RGB lighting for Workman layout * Add leader keys * Remove force NKRO * Add Viterbi one handed layout and minor tweaks to others * Finishing up Viterbi keyboard layout, and NKRO tweaks to other layouts * Made "make" keystroke universal * Clean up and updates of drashna keymaps * Add workman layer to planck * Update to keymaps * Fix makefile toggle code in ez keymap Finish adding RGB code to orthodox * Updated RGB Underglow layer indication code due to discovery of the layer_state_set_kb function * Remove unnecessary planck layout * Fixed Workman song * update make command and added lit reset * Fixed formatting to fall in line with official standards * Minor tweaks * Removed Leader Keys from Ergodox EZ Keymap Added KC_RESET that resets board and sets underglow to red * Tweak reset code * Cleanup * Remove misc layouts for woodpad * Move woodpad to handwired * Updated RGB Underglow info * Cleanup macros * Tweaked RGB lighting stuff * Start to merge orthodox/ergodox keymaps (persistant layers) * Add forced NKRO * Added default layer (qwerty/colemak/dvorak) detection to RGB Underglow * Updated macros and added workman keymaps * Fixed RGB lighting for Workman layout * Add leader keys * Remove force NKRO * Add Viterbi one handed layout and minor tweaks to others * Finishing up Viterbi keyboard layout, and NKRO tweaks to other layouts * Made "make" keystroke universal * Clean up and updates of drashna keymaps * Add workman layer to planck * Update to keymaps * Fix makefile toggle code in ez keymap Finish adding RGB code to orthodox * Updated RGB Underglow layer indication code due to discovery of the layer_state_set_kb function * Remove unnecessary planck layout * Fixed Workman song * update make command and added lit reset * Fixed formatting to fall in line with official standards * Minor tweaks * Removed Leader Keys from Ergodox EZ Keymap Added KC_RESET that resets board and sets underglow to red * Tweak reset code * Fix rebasing issues * remove head files * Fix "macro" issue * Rename ez keymaps for userspace * Revert "Rename ez keymaps for userspace" This reverts commit c25425911852e41711a5f0273b5741adb16e5bd4. * Renamed Ergodox EZ layouts so that all of my personal layouts are on the same name, in prep for using userspaces * Fix ergodox code * Remove "drashna-ez" keymap as it's no longer needed * Migrate majority of code to Userspace
Diffstat (limited to 'users/drashna')
-rw-r--r--users/drashna/drashna.c379
-rw-r--r--users/drashna/drashna.h73
-rw-r--r--users/drashna/readme.md14
-rw-r--r--users/drashna/rules.mk2
4 files changed, 468 insertions, 0 deletions
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c
new file mode 100644
index 000000000..47565ff9c
--- /dev/null
+++ b/users/drashna/drashna.c
@@ -0,0 +1,379 @@
1#include "drashna.h"
2#include "quantum.h"
3#include "action.h"
4#include "version.h"
5
6__attribute__ ((weak))
7void matrix_init_keymap(void) {}
8
9__attribute__ ((weak))
10void matrix_scan_keymap(void) {}
11
12__attribute__ ((weak))
13bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
14 return true;
15}
16
17
18void matrix_init_user(void) {
19#ifdef RGBLIGHT_ENABLE
20 uint8_t default_layer = eeconfig_read_default_layer();
21
22 rgblight_enable();
23
24 if (true) {
25 if (default_layer & (1UL << _COLEMAK)) {
26 rgblight_set_magenta;
27 }
28 else if (default_layer & (1UL << _DVORAK)) {
29 rgblight_set_green;
30 }
31 else if (default_layer & (1UL << _WORKMAN)) {
32 rgblight_set_purple;
33 }
34 else {
35 rgblight_set_teal;
36 }
37 }
38 else
39 {
40 rgblight_set_red;
41 rgblight_mode(5);
42 }
43#endif
44 matrix_init_keymap();
45}
46
47void matrix_scan_user(void) {
48 matrix_scan_keymap();
49}
50
51#ifdef AUDIO_ENABLE
52float tone_qwerty[][2] = SONG(QWERTY_SOUND);
53float tone_dvorak[][2] = SONG(DVORAK_SOUND);
54float tone_colemak[][2] = SONG(COLEMAK_SOUND);
55float tone_workman[][2] = SONG(PLOVER_SOUND);
56#endif
57
58
59void persistent_default_layer_set(uint16_t default_layer) {
60 eeconfig_update_default_layer(default_layer);
61 default_layer_set(default_layer);
62}
63
64
65bool process_record_user(uint16_t keycode, keyrecord_t *record) {
66
67 uint16_t kc;
68 if (is_overwatch) {
69 kc = KC_BSPC;
70 }
71 else {
72 kc = KC_ENTER;
73 }
74#ifdef CONSOLE_ENABLE
75 xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
76#endif
77
78 switch (keycode) {
79 case KC_QWERTY:
80 if (record->event.pressed) {
81#ifdef AUDIO_ENABLE
82 PLAY_SONG(tone_qwerty);
83#endif
84 persistent_default_layer_set(1UL << _QWERTY);
85 }
86 return false;
87 break;
88 case KC_COLEMAK:
89 if (record->event.pressed) {
90#ifdef AUDIO_ENABLE
91 PLAY_SONG(tone_colemak);
92#endif
93 persistent_default_layer_set(1UL << _COLEMAK);
94 }
95 return false;
96 break;
97 case KC_DVORAK:
98 if (record->event.pressed) {
99#ifdef AUDIO_ENABLE
100 PLAY_SONG(tone_dvorak);
101#endif
102 persistent_default_layer_set(1UL << _DVORAK);
103 }
104 return false;
105 break;
106 case KC_WORKMAN:
107 if (record->event.pressed) {
108#ifdef AUDIO_ENABLE
109 PLAY_SONG(tone_workman);
110#endif
111 persistent_default_layer_set(1UL << _WORKMAN);
112 }
113 return false;
114 break;
115 case LOWER:
116 if (record->event.pressed) {
117 layer_on(_LOWER);
118 update_tri_layer(_LOWER, _RAISE, _ADJUST);
119 }
120 else {
121 layer_off(_LOWER);
122 update_tri_layer(_LOWER, _RAISE, _ADJUST);
123 }
124 return false;
125 break;
126 case RAISE:
127 if (record->event.pressed) {
128 layer_on(_RAISE);
129 update_tri_layer(_LOWER, _RAISE, _ADJUST);
130 }
131 else {
132 layer_off(_RAISE);
133 update_tri_layer(_LOWER, _RAISE, _ADJUST);
134 }
135 return false;
136 break;
137 case ADJUST:
138 if (record->event.pressed) {
139 layer_on(_ADJUST);
140 }
141 else {
142 layer_off(_ADJUST);
143 }
144 return false;
145 break;
146 case KC_OVERWATCH:
147 if (record->event.pressed) {
148 is_overwatch = !is_overwatch;
149 }
150#ifdef RGBLIGHT_ENABLE
151 is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
152#endif
153 return false;
154 break;
155 case KC_SALT:
156 if (!record->event.pressed) {
157 register_code(kc);
158 unregister_code(kc);
159 _delay_ms(50);
160 SEND_STRING("Salt, salt, salt...");
161 register_code(KC_ENTER);
162 unregister_code(KC_ENTER);
163 }
164 return false;
165 break;
166 case KC_MORESALT:
167 if (!record->event.pressed) {
168 register_code(kc);
169 unregister_code(kc);
170 _delay_ms(50);
171 SEND_STRING("Please sir, can I have some more salt?!");
172 register_code(KC_ENTER);
173 unregister_code(KC_ENTER);
174 }
175 return false;
176 break;
177 case KC_SALTHARD:
178 if (!record->event.pressed) {
179 register_code(kc);
180 unregister_code(kc);
181 _delay_ms(50);
182 SEND_STRING("Your salt only makes my penis that much harder, and even more aggressive!");
183 register_code(KC_ENTER);
184 unregister_code(KC_ENTER);
185 }
186 return false;
187 break;
188 case KC_GOODGAME:
189 if (!record->event.pressed) {
190 register_code(kc);
191 unregister_code(kc);
192 _delay_ms(50);
193 SEND_STRING("Good game, everyone!");
194 register_code(KC_ENTER);
195 unregister_code(KC_ENTER);
196 }
197 return false;
198 break;
199 case KC_GLHF:
200 if (!record->event.pressed) {
201 register_code(kc);
202 unregister_code(kc);
203 _delay_ms(50);
204 SEND_STRING("Good luck, have fun!!!");
205 register_code(KC_ENTER);
206 unregister_code(KC_ENTER);
207 }
208 return false;
209 break;
210 case KC_SYMM:
211 if (!record->event.pressed) {
212 register_code(kc);
213 unregister_code(kc);
214 _delay_ms(50);
215 SEND_STRING("Left click to win!");
216 register_code(KC_ENTER);
217 unregister_code(KC_ENTER);
218 }
219 return false;
220 break;
221 case KC_DOOMFIST:
222 if (!record->event.pressed) {
223 register_code(kc);
224 unregister_code(kc);
225 _delay_ms(50);
226 SEND_STRING("Hey, look at me. I'm Doomfist, and I'm overpowered! All I do is spam punches all day! I'm DPS, tank and defense, rolled into one! All I need is team healing to be complete!");
227 register_code(KC_ENTER);
228 unregister_code(KC_ENTER);
229 }
230 return false;
231 break;
232 case KC_JUSTGAME:
233 if (!record->event.pressed) {
234 register_code(kc);
235 unregister_code(kc);
236 _delay_ms(50);
237 SEND_STRING("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.");
238 register_code(KC_ENTER);
239 unregister_code(KC_ENTER);
240 }
241 return false;
242 break;
243 case KC_TORB:
244 if (!record->event.pressed) {
245 register_code(kc);
246 unregister_code(kc);
247 _delay_ms(50);
248 SEND_STRING("That was positively riveting!");
249 register_code(KC_ENTER);
250 unregister_code(KC_ENTER);
251 }
252 return false;
253 break;
254 case KC_AIM:
255 if (!record->event.pressed) {
256 register_code(kc);
257 unregister_code(kc);
258 _delay_ms(50);
259 SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER));
260 _delay_ms(50);
261 SEND_STRING("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!" SS_TAP(X_ENTER));
262 }
263 return false;
264 break;
265 case KC_MAKE:
266 if (!record->event.pressed) {
267#ifdef RGBLIGHT_ENABLE
268 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP " RGBLIGHT_ENABLE=yes" SS_TAP(X_ENTER));
269#else
270 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP " RGBLIGHT_ENABLE=no"SS_TAP(X_ENTER));
271#endif
272 }
273 return false;
274 break;
275 case KC_RESET:
276 if (!record->event.pressed) {
277#ifdef RGBLIGHT_ENABLE
278 rgblight_enable();
279 rgblight_mode(1);
280 rgblight_setrgb(0xff, 0x00, 0x00);
281#endif
282 reset_keyboard();
283 }
284 return false;
285 break;
286 case EPRM:
287 if (record->event.pressed) {
288 eeconfig_init();
289 }
290 return false;
291 break;
292 case VRSN:
293 if (record->event.pressed) {
294 SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
295 }
296 return false;
297 break;
298 case KC_P00:
299 if (!record->event.pressed) {
300 register_code(KC_P0);
301 unregister_code(KC_P0);
302 register_code(KC_P0);
303 unregister_code(KC_P0);
304 }
305 return false;
306 break;
307 }
308 return process_record_keymap(keycode, record);
309}
310
311
312uint32_t layer_state_set_kb(uint32_t state) {
313#ifdef RGBLIGHT_ENABLE
314 uint8_t default_layer = eeconfig_read_default_layer();
315
316 switch (biton32(state)) {
317 case _NAV:
318 rgblight_set_blue;
319 rgblight_mode(1);
320 break;
321 case _SYMB:
322 rgblight_set_blue;
323 rgblight_mode(2);
324 break;
325 case _MOUS:
326 rgblight_set_yellow;
327 rgblight_mode(1);
328 break;
329 case _MACROS:
330 rgblight_set_orange;
331 is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
332 rgblight_mode(18);
333 break;
334 case _MEDIA:
335 rgblight_set_green;
336 rgblight_mode(22);
337 break;
338 case _OVERWATCH:
339 rgblight_set_orange;
340 rgblight_mode(17);
341 break;
342 case _DIABLO:
343 rgblight_set_red;
344 rgblight_mode(5);
345 break;
346 case _RAISE:
347 rgblight_set_yellow;
348 rgblight_mode(5);
349 break;
350 case _LOWER:
351 rgblight_set_orange;
352 rgblight_mode(5);
353 break;
354 case _ADJUST:
355 rgblight_set_red;
356 rgblight_mode(23);
357 break;
358 case _COVECUBE:
359 rgblight_set_green;
360 rgblight_mode(2);
361 default:
362 if (default_layer & (1UL << _COLEMAK)) {
363 rgblight_set_magenta;
364 }
365 else if (default_layer & (1UL << _DVORAK)) {
366 rgblight_set_green;
367 }
368 else if (default_layer & (1UL << _WORKMAN)) {
369 rgblight_set_purple;
370 }
371 else {
372 rgblight_set_teal;
373 }
374 rgblight_mode(1);
375 break;
376 }
377#endif
378 return state;
379}
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h
new file mode 100644
index 000000000..0e7b25d2d
--- /dev/null
+++ b/users/drashna/drashna.h
@@ -0,0 +1,73 @@
1#ifndef USERSPACE
2#define USERSPACE
3
4#include "quantum.h"
5
6// Define layer names
7#define _QWERTY 0
8#define _NUMLOCK 0
9#define _COLEMAK 1
10#define _DVORAK 2
11#define _WORKMAN 3
12#define _NAV 5
13#define _COVECUBE 6
14#define _SYMB 8
15#define _OVERWATCH 9
16#define _DIABLO 10
17#define _MOUS 11
18#define _MACROS 12
19#define _MEDIA 13
20#define _LOWER 14
21#define _RAISE 15
22#define _ADJUST 16
23
24
25//define modifiers
26#define MODS_SHIFT_MASK (MOD_BIT(KC_LSHIFT)|MOD_BIT(KC_RSHIFT))
27#define MODS_CTRL_MASK (MOD_BIT(KC_LCTL)|MOD_BIT(KC_RCTRL))
28#define MODS_ALT_MASK (MOD_BIT(KC_LALT)|MOD_BIT(KC_RALT))
29
30#ifdef RGBLIGHT_ENABLE
31#define rgblight_set_blue rgblight_sethsv (0xFF, 0xFF, 0xFF);
32#define rgblight_set_red rgblight_sethsv (0x00, 0xFF, 0xFF);
33#define rgblight_set_green rgblight_sethsv (0x78, 0xFF, 0xFF);
34#define rgblight_set_orange rgblight_sethsv (0x1E, 0xFF, 0xFF);
35#define rgblight_set_teal rgblight_sethsv (0xC3, 0xFF, 0xFF);
36#define rgblight_set_magenta rgblight_sethsv (0x12C, 0xFF, 0xFF);
37#define rgblight_set_yellow rgblight_sethsv (0x3C, 0xFF, 0xFF);
38#define rgblight_set_purple rgblight_sethsv (0x10E, 0xFF, 0xFF);
39#endif
40
41__attribute__ ((weak))
42bool is_overwatch = false;
43
44enum custom_keycodes {
45 PLACEHOLDER = SAFE_RANGE, // can always be here
46 EPRM,
47 VRSN,
48 KC_QWERTY,
49 KC_COLEMAK,
50 KC_DVORAK,
51 KC_WORKMAN,
52 LOWER,
53 RAISE,
54 ADJUST,
55 KC_DIABLO_CLEAR,
56 KC_OVERWATCH,
57 KC_SALT,
58 KC_MORESALT,
59 KC_SALTHARD,
60 KC_GOODGAME,
61 KC_SYMM,
62 KC_DOOMFIST,
63 KC_JUSTGAME,
64 KC_GLHF,
65 KC_TORB,
66 KC_AIM,
67 KC_MAKE,
68 KC_RESET,
69 KC_P00,
70 NEWPLACEHOLDER
71};
72
73#endif
diff --git a/users/drashna/readme.md b/users/drashna/readme.md
new file mode 100644
index 000000000..0d553f08e
--- /dev/null
+++ b/users/drashna/readme.md
@@ -0,0 +1,14 @@
1Copyright 2017 Christopher Courtney <drashna@live.com> @drashna
2
3This program is free software: you can redistribute it and/or modify
4it under the terms of the GNU General Public License as published by
5the Free Software Foundation, either version 2 of the License, or
6(at your option) any later version.
7
8This program is distributed in the hope that it will be useful,
9but WITHOUT ANY WARRANTY; without even the implied warranty of
10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11GNU General Public License for more details.
12
13You should have received a copy of the GNU General Public License
14along with this program. If not, see <http://www.gnu.org/licenses/>.
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk
new file mode 100644
index 000000000..0150bb608
--- /dev/null
+++ b/users/drashna/rules.mk
@@ -0,0 +1,2 @@
1
2SRC += drashna.c