aboutsummaryrefslogtreecommitdiff
path: root/keyboards/handwired/woodpad/keymaps/drashna/keymap.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/handwired/woodpad/keymaps/drashna/keymap.c')
-rw-r--r--keyboards/handwired/woodpad/keymaps/drashna/keymap.c483
1 files changed, 248 insertions, 235 deletions
diff --git a/keyboards/handwired/woodpad/keymaps/drashna/keymap.c b/keyboards/handwired/woodpad/keymaps/drashna/keymap.c
index 4a2893e4a..725d1f724 100644
--- a/keyboards/handwired/woodpad/keymaps/drashna/keymap.c
+++ b/keyboards/handwired/woodpad/keymaps/drashna/keymap.c
@@ -15,10 +15,10 @@
15 */ 15 */
16#include "woodpad.h" 16#include "woodpad.h"
17 17
18// Each layer gets a name for readability, which is then used in the keymap matrix below. 18 // Each layer gets a name for readability, which is then used in the keymap matrix below.
19// The underscores don't mean anything - you can have a layer called STUFF or any other name. 19 // The underscores don't mean anything - you can have a layer called STUFF or any other name.
20// Layer names don't all need to be of the same length, obviously, and you can also skip them 20 // Layer names don't all need to be of the same length, obviously, and you can also skip them
21// entirely and just use numbers. 21 // entirely and just use numbers.
22#define _NUMLOCK 0 22#define _NUMLOCK 0
23#define _NAV 1 23#define _NAV 1
24#define _DIABLO 2 24#define _DIABLO 2
@@ -54,76 +54,77 @@ static uint8_t diablo_key_time[4];
54 54
55 55
56bool check_dtimer(uint8_t dtimer) { 56bool check_dtimer(uint8_t dtimer) {
57 // has the correct number of seconds elapsed (as defined by diablo_times) 57 // has the correct number of seconds elapsed (as defined by diablo_times)
58 return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true; 58 return (timer_elapsed(diablo_timer[dtimer]) < (diablo_key_time[dtimer] * 1000)) ? false : true;
59}; 59};
60#endif 60#endif
61 61
62 62
63enum custom_keycodes { 63enum custom_keycodes {
64 PLACEHOLDER = SAFE_RANGE, // can always be here 64 PLACEHOLDER = SAFE_RANGE, // can always be here
65 KC_DIABLO_CLEAR, 65 KC_DIABLO_CLEAR,
66 KC_OVERWATCH, 66 KC_OVERWATCH,
67 KC_SALT, 67 KC_SALT,
68 KC_MORESALT, 68 KC_MORESALT,
69 KC_SALTHARD, 69 KC_SALTHARD,
70 KC_GOODGAME, 70 KC_GOODGAME,
71 KC_SYMM, 71 KC_SYMM,
72 KC_DOOMFIST, 72 KC_DOOMFIST,
73 KC_JUSTGAME, 73 KC_JUSTGAME,
74 KC_GLHF, 74 KC_GLHF,
75 KC_TORB, 75 KC_TORB,
76 KC_MAKE 76 KC_MAKE,
77 KC_RESET
77}; 78};
78 79
79#ifdef TAP_DANCE_ENABLE 80#ifdef TAP_DANCE_ENABLE
80enum { 81enum {
81 TD_DIABLO_1 = 0, 82 TD_DIABLO_1 = 0,
82 TD_DIABLO_2, 83 TD_DIABLO_2,
83 TD_DIABLO_3, 84 TD_DIABLO_3,
84 TD_DIABLO_4 85 TD_DIABLO_4
85}; 86};
86 87
87 88
88// Cycle through the times for the macro, starting at 0, for disabled. 89// Cycle through the times for the macro, starting at 0, for disabled.
89// Max of six values, so don't exceed 90// Max of six values, so don't exceed
90void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) { 91void diablo_tapdance_master(qk_tap_dance_state_t *state, void *user_data, uint8_t diablo_key) {
91 if (state->count >= 7) { 92 if (state->count >= 7) {
92 diablo_key_time[diablo_key] = diablo_times[0]; 93 diablo_key_time[diablo_key] = diablo_times[0];
93 reset_tap_dance(state); 94 reset_tap_dance(state);
94 } 95 }
95 else { 96 else {
96 diablo_key_time[diablo_key] = diablo_times[state->count - 1]; 97 diablo_key_time[diablo_key] = diablo_times[state->count - 1];
97 } 98 }
98} 99}
99 100
100 101
101// Would rather have one function for all of this, but no idea how to do that... 102// Would rather have one function for all of this, but no idea how to do that...
102void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) { 103void diablo_tapdance1(qk_tap_dance_state_t *state, void *user_data) {
103 diablo_tapdance_master(state, user_data, 0); 104 diablo_tapdance_master(state, user_data, 0);
104} 105}
105 106
106void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) { 107void diablo_tapdance2(qk_tap_dance_state_t *state, void *user_data) {
107 diablo_tapdance_master(state, user_data, 1); 108 diablo_tapdance_master(state, user_data, 1);
108} 109}
109 110
110void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) { 111void diablo_tapdance3(qk_tap_dance_state_t *state, void *user_data) {
111 diablo_tapdance_master(state, user_data, 2); 112 diablo_tapdance_master(state, user_data, 2);
112} 113}
113 114
114void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) { 115void diablo_tapdance4(qk_tap_dance_state_t *state, void *user_data) {
115 diablo_tapdance_master(state, user_data, 3); 116 diablo_tapdance_master(state, user_data, 3);
116} 117}
117 118
118 119
119 120
120//Tap Dance Definitions 121//Tap Dance Definitions
121qk_tap_dance_action_t tap_dance_actions[] = { 122qk_tap_dance_action_t tap_dance_actions[] = {
122 // tap once to disable, and more to enable timed micros 123 // tap once to disable, and more to enable timed micros
123 [TD_DIABLO_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1), 124 [TD_DIABLO_1] = ACTION_TAP_DANCE_FN(diablo_tapdance1),
124 [TD_DIABLO_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2), 125 [TD_DIABLO_2] = ACTION_TAP_DANCE_FN(diablo_tapdance2),
125 [TD_DIABLO_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3), 126 [TD_DIABLO_3] = ACTION_TAP_DANCE_FN(diablo_tapdance3),
126 [TD_DIABLO_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4), 127 [TD_DIABLO_4] = ACTION_TAP_DANCE_FN(diablo_tapdance4),
127 128
128}; 129};
129#endif 130#endif
@@ -170,7 +171,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
170 KC_SALT, KC_MORESALT, KC_SALTHARD, KC_GLHF \ 171 KC_SALT, KC_MORESALT, KC_SALTHARD, KC_GLHF \
171), 172),
172[_MEDIA] = KEYMAP( /* Base */ 173[_MEDIA] = KEYMAP( /* Base */
173 RESET, KC_MUTE, KC_VOLD, KC_VOLU,\ 174 KC_RESET, KC_MUTE, KC_VOLD, KC_VOLU,\
174 KC_MAKE, _______, RGB_HUI, RGB_HUD, \ 175 KC_MAKE, _______, RGB_HUI, RGB_HUD, \
175 KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, \ 176 KC_MPLY, KC_MSTP, KC_MPRV, KC_MNXT, \
176 RGB_TOG, RGB_MOD, RGB_SAI, RGB_VAI, \ 177 RGB_TOG, RGB_MOD, RGB_SAI, RGB_VAI, \
@@ -181,150 +182,162 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
181 182
182 183
183void numlock_led_on(void) { 184void numlock_led_on(void) {
184 PORTF |= (1<<7); 185 PORTF |= (1 << 7);
185} 186}
186 187
187void numlock_led_off(void) { 188void numlock_led_off(void) {
188 PORTF &= ~(1<<7); 189 PORTF &= ~(1 << 7);
189} 190}
190 191
191 192
192bool process_record_user(uint16_t keycode, keyrecord_t *record) { 193bool process_record_user(uint16_t keycode, keyrecord_t *record) {
193 uint16_t kc; 194 uint16_t kc;
194 if (is_overwatch) { 195 if (is_overwatch) {
195 kc = KC_BSPC; 196 kc = KC_BSPC;
196 } else { 197 }
197 kc = KC_ENTER; 198 else {
198 } 199 kc = KC_ENTER;
199 switch (keycode) { 200 }
201 switch (keycode) {
200#ifdef TAP_DANCE_ENABLE 202#ifdef TAP_DANCE_ENABLE
201 case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them 203 case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them
202 if (record->event.pressed) { 204 if (record->event.pressed) {
203 uint8_t dtime; 205 uint8_t dtime;
204 206
205 for (dtime = 0; dtime < 4; dtime++) { 207 for (dtime = 0; dtime < 4; dtime++) {
206 diablo_key_time[dtime] = diablo_times[0]; 208 diablo_key_time[dtime] = diablo_times[0];
207 } 209 }
208 } 210 }
209 return false; 211 return false;
210 break; 212 break;
211#endif 213#endif
212 case KC_OVERWATCH: 214 case KC_OVERWATCH:
213 if (record->event.pressed) { 215 if (record->event.pressed) {
214 is_overwatch = !is_overwatch; 216 is_overwatch = !is_overwatch;
215 } 217 }
216#ifdef RGBLIGHT_ENABLE 218#ifdef RGBLIGHT_ENABLE
217 is_overwatch ? rgblight_mode(17) : rgblight_mode(18); 219 is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
218#endif 220#endif
219 return false; 221 return false;
220 break; 222 break;
221 case KC_SALT: 223 case KC_SALT:
222 if (!record->event.pressed) { 224 if (!record->event.pressed) {
223 register_code(kc); 225 register_code(kc);
224 unregister_code(kc); 226 unregister_code(kc);
225 _delay_ms(50); 227 _delay_ms(50);
226 SEND_STRING("Salt, salt, salt..."); 228 SEND_STRING("Salt, salt, salt...");
227 register_code(KC_ENTER); 229 register_code(KC_ENTER);
228 unregister_code(KC_ENTER); 230 unregister_code(KC_ENTER);
229 } 231 }
230 return false; 232 return false;
231 break; 233 break;
232 case KC_MORESALT: 234 case KC_MORESALT:
233 if (!record->event.pressed) { 235 if (!record->event.pressed) {
234 register_code(kc); 236 register_code(kc);
235 unregister_code(kc); 237 unregister_code(kc);
236 _delay_ms(50); 238 _delay_ms(50);
237 SEND_STRING("Please sir, can I have some more salt?!"); 239 SEND_STRING("Please sir, can I have some more salt?!");
238 register_code(KC_ENTER); 240 register_code(KC_ENTER);
239 unregister_code(KC_ENTER); 241 unregister_code(KC_ENTER);
240 } 242 }
241 return false; 243 return false;
242 break; 244 break;
243 case KC_SALTHARD: 245 case KC_SALTHARD:
244 if (!record->event.pressed) { 246 if (!record->event.pressed) {
245 register_code(kc); 247 register_code(kc);
246 unregister_code(kc); 248 unregister_code(kc);
247 _delay_ms(50); 249 _delay_ms(50);
248 SEND_STRING("Your salt only makes my penis that much harder, and even more aggressive!"); 250 SEND_STRING("Your salt only makes my penis that much harder, and even more aggressive!");
249 register_code(KC_ENTER); 251 register_code(KC_ENTER);
250 unregister_code(KC_ENTER); 252 unregister_code(KC_ENTER);
251 } 253 }
252 return false; 254 return false;
253 break; 255 break;
254 case KC_GOODGAME: 256 case KC_GOODGAME:
255 if (!record->event.pressed) { 257 if (!record->event.pressed) {
256 register_code(kc); 258 register_code(kc);
257 unregister_code(kc); 259 unregister_code(kc);
258 _delay_ms(50); 260 _delay_ms(50);
259 SEND_STRING("Good game, everyone!"); 261 SEND_STRING("Good game, everyone!");
260 register_code(KC_ENTER); 262 register_code(KC_ENTER);
261 unregister_code(KC_ENTER); 263 unregister_code(KC_ENTER);
262 } 264 }
263 return false; 265 return false;
264 break; 266 break;
265 case KC_GLHF: 267 case KC_GLHF:
266 if (!record->event.pressed) { 268 if (!record->event.pressed) {
267 register_code(kc); 269 register_code(kc);
268 unregister_code(kc); 270 unregister_code(kc);
269 _delay_ms(50); 271 _delay_ms(50);
270 SEND_STRING("Good luck, have fun!!!"); 272 SEND_STRING("Good luck, have fun!!!");
271 register_code(KC_ENTER); 273 register_code(KC_ENTER);
272 unregister_code(KC_ENTER); 274 unregister_code(KC_ENTER);
273 } 275 }
274 return false; 276 return false;
275 break; 277 break;
276 case KC_SYMM: 278 case KC_SYMM:
277 if (!record->event.pressed) { 279 if (!record->event.pressed) {
278 register_code(kc); 280 register_code(kc);
279 unregister_code(kc); 281 unregister_code(kc);
280 _delay_ms(50); 282 _delay_ms(50);
281 SEND_STRING("Left click to win!"); 283 SEND_STRING("Left click to win!");
282 register_code(KC_ENTER); 284 register_code(KC_ENTER);
283 unregister_code(KC_ENTER); 285 unregister_code(KC_ENTER);
284 } 286 }
285 return false; 287 return false;
286 break; 288 break;
287 case KC_DOOMFIST: 289 case KC_DOOMFIST:
288 if (!record->event.pressed) { 290 if (!record->event.pressed) {
289 register_code(kc); 291 register_code(kc);
290 unregister_code(kc); 292 unregister_code(kc);
291 _delay_ms(50); 293 _delay_ms(50);
292 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!"); 294 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!");
293 register_code(KC_ENTER); 295 register_code(KC_ENTER);
294 unregister_code(KC_ENTER); 296 unregister_code(KC_ENTER);
295 } 297 }
296 return false; 298 return false;
297 break; 299 break;
298 case KC_JUSTGAME: 300 case KC_JUSTGAME:
299 301
300 if (!record->event.pressed) { 302 if (!record->event.pressed) {
301 register_code(kc); 303 register_code(kc);
302 unregister_code(kc); 304 unregister_code(kc);
303 _delay_ms(50); 305 _delay_ms(50);
304 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."); 306 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.");
305 register_code(KC_ENTER); 307 register_code(KC_ENTER);
306 unregister_code(KC_ENTER); 308 unregister_code(KC_ENTER);
307 } 309 }
308 return false; 310 return false;
309 break; 311 break;
310 case KC_TORB: 312 case KC_TORB:
311 313
312 if (!record->event.pressed) { 314 if (!record->event.pressed) {
313 register_code(kc); 315 register_code(kc);
314 unregister_code(kc); 316 unregister_code(kc);
315 _delay_ms(50); 317 _delay_ms(50);
316 SEND_STRING("That was positively riveting!"); 318 SEND_STRING("That was positively riveting!");
317 register_code(KC_ENTER); 319 register_code(KC_ENTER);
318 unregister_code(KC_ENTER); 320 unregister_code(KC_ENTER);
319 } 321 }
320 return false; 322 return false;
321 break; 323 break;
322 case KC_MAKE: 324 case KC_MAKE:
323 if (!record->event.pressed) { 325 if (!record->event.pressed) {
324 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP SS_TAP(X_ENTER)); 326 SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP SS_TAP(X_ENTER));
325 } 327 }
326 return false; 328 return false;
327 break; 329 break;
330 case KC_RESET:
331 if (!record->event.pressed) {
332#ifdef RGBLIGHT_ENABLE
333 rgblight_enable();
334 rgblight_mode(1);
335 rgblight_setrgb(0xff, 0x00, 0x00);
336#endif
337 reset_keyboard();
338 }
339 return false;
340 break;
328 341
329 342
330 } 343 }
@@ -334,96 +347,96 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
334 347
335// Sends the key press to system, but only if on the Diablo layer 348// Sends the key press to system, but only if on the Diablo layer
336void send_diablo_keystroke(uint8_t diablo_key) { 349void send_diablo_keystroke(uint8_t diablo_key) {
337 if (biton32(layer_state) == _DIABLO) { 350 if (biton32(layer_state) == _DIABLO) {
338 switch (diablo_key) { 351 switch (diablo_key) {
339 case 0: 352 case 0:
340 SEND_STRING("1"); 353 SEND_STRING("1");
341 break; 354 break;
342 case 1: 355 case 1:
343 SEND_STRING("2"); 356 SEND_STRING("2");
344 break; 357 break;
345 case 2: 358 case 2:
346 SEND_STRING("3"); 359 SEND_STRING("3");
347 break; 360 break;
348 case 3: 361 case 3:
349 SEND_STRING("4"); 362 SEND_STRING("4");
350 break; 363 break;
351 }
352 } 364 }
365 }
353} 366}
354 367
355// Checks each of the 4 timers/keys to see if enough time has elapsed 368// Checks each of the 4 timers/keys to see if enough time has elapsed
356// Runs the "send string" command if enough time has passed, and resets the timer. 369// Runs the "send string" command if enough time has passed, and resets the timer.
357void run_diablo_macro_check(void) { 370void run_diablo_macro_check(void) {
358 uint8_t dtime; 371 uint8_t dtime;
359 372
360 for (dtime = 0; dtime < 4; dtime++) { 373 for (dtime = 0; dtime < 4; dtime++) {
361 if (check_dtimer(dtime) && diablo_key_time[dtime]) { 374 if (check_dtimer(dtime) && diablo_key_time[dtime]) {
362 diablo_timer[dtime] = timer_read(); 375 diablo_timer[dtime] = timer_read();
363 send_diablo_keystroke(dtime); 376 send_diablo_keystroke(dtime);
364 }
365 } 377 }
378 }
366 379
367} 380}
368#endif 381#endif
369void matrix_init_user(void) { 382void matrix_init_user(void) {
370 // set Numlock LED to output and low 383 // set Numlock LED to output and low
371 DDRF |= (1<<7); 384 DDRF |= (1 << 7);
372 PORTF &= ~(1<<7); 385 PORTF &= ~(1 << 7);
373 386
374#ifdef RGBLIGHT_ENABLE 387#ifdef RGBLIGHT_ENABLE
375 rgblight_enable(); 388 rgblight_enable();
376 rgblight_set_teal; 389 rgblight_set_teal;
377 rgblight_mode(1); 390 rgblight_mode(1);
378#endif 391#endif
379 392
380 if (!(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK)) ){ 393 if (!(host_keyboard_leds() & (1 << USB_LED_NUM_LOCK))) {
381 register_code(KC_NUMLOCK); 394 register_code(KC_NUMLOCK);
382 unregister_code(KC_NUMLOCK); 395 unregister_code(KC_NUMLOCK);
383 } 396 }
384} 397}
385 398
386void matrix_scan_user(void) { 399void matrix_scan_user(void) {
387 numlock_led_off(); 400 numlock_led_off();
388 if (is_overwatch && biton32(layer_state) == _MACROS) { 401 if (is_overwatch && biton32(layer_state) == _MACROS) {
389 numlock_led_on(); 402 numlock_led_on();
390 } 403 }
391 404
392 // Run Diablo 3 macro checking code. 405 // Run Diablo 3 macro checking code.
393#ifdef TAP_DANCE_ENABLE 406#ifdef TAP_DANCE_ENABLE
394 run_diablo_macro_check(); 407 run_diablo_macro_check();
395#endif 408#endif
396} 409}
397 410
398uint32_t layer_state_set_kb(uint32_t state) { 411uint32_t layer_state_set_kb(uint32_t state) {
399#ifdef RGBLIGHT_ENABLE 412#ifdef RGBLIGHT_ENABLE
400// Check layer, and apply color if its changed since last check 413 // Check layer, and apply color if its changed since last check
401 switch (biton32(state)) { 414 switch (biton32(state)) {
402 case _NAV: 415 case _NAV:
403 rgblight_set_blue; 416 rgblight_set_blue;
404 rgblight_mode(1); 417 rgblight_mode(1);
405 break; 418 break;
406 case _MACROS: 419 case _MACROS:
407 rgblight_set_orange; 420 rgblight_set_orange;
408 is_overwatch ? rgblight_mode(17) : rgblight_mode(18); 421 is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
409 break; 422 break;
410 case _DIABLO: 423 case _DIABLO:
411 rgblight_set_red; 424 rgblight_set_red;
412 rgblight_mode(5); 425 rgblight_mode(5);
413 break; 426 break;
414 case _MEDIA: 427 case _MEDIA:
415 rgblight_set_green; 428 rgblight_set_green;
416 rgblight_mode(22); 429 rgblight_mode(22);
417 break; 430 break;
418 default: 431 default:
419 rgblight_set_teal; 432 rgblight_set_teal;
420 rgblight_mode(1); 433 rgblight_mode(1);
421 break; 434 break;
422 } 435 }
423 436
424#endif 437#endif
425 return state; 438 return state;
426} 439}
427void led_set_user(uint8_t usb_led) { 440void led_set_user(uint8_t usb_led) {
428 441
429} 442}