From 598384bc1064ab9250191a1727c27a0eea406756 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sun, 4 Feb 2018 10:44:02 -0800 Subject: Update to drashna userspace (Keymap Templating) (#2338) * Change tapping term to be longer * Make Audio/Underglow settings permanent * Use wait_ms rather than _delay_ms * Readd One Shot Mods * Switch to Imperial March startup sound * Move OSM to it's own layer * Minor Formatting Tweaks * Keymap Templates and formatting fixes --- users/drashna/drashna.c | 36 ++++++++++------------------ users/drashna/drashna.h | 63 +++++++++++++++++++++++++++++++++++++++++++++++-- users/drashna/readme.md | 16 +++++++++++++ 3 files changed, 90 insertions(+), 25 deletions(-) (limited to 'users') diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index a07d74407..6039c7c56 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -166,7 +166,7 @@ void matrix_init_user(void) { } #endif #ifdef AUDIO_ENABLE -// _delay_ms(21); // gets rid of tick +// wait_ms(21); // gets rid of tick // stop_all_notes(); // PLAY_SONG(tone_hackstartup); #endif @@ -329,7 +329,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Salt, salt, salt..."); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -340,7 +340,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Please sir, can I have some more salt?!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -351,7 +351,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Your salt only makes me harder, and even more aggressive!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -362,7 +362,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Good game, everyone!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -373,7 +373,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Good luck, have fun!!!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -384,7 +384,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("Left click to win!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -395,7 +395,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); 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."); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -406,7 +406,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("That was positively riveting!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -417,9 +417,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER)); - _delay_ms(3000); + wait_ms(3000); register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); SEND_STRING("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!" SS_TAP(X_ENTER)); @@ -430,7 +430,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("OMG!!! C9!!!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -441,7 +441,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { if (!record->event.pressed) { register_code(is_overwatch ? KC_BSPC : KC_ENTER); unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); - _delay_ms(50); + wait_ms(50); SEND_STRING("That was a fantastic game, though it was a bit easy. Try harder next time!"); register_code(KC_ENTER); unregister_code(KC_ENTER); @@ -470,16 +470,6 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { ":teensy" //#elif defined(BOOTLOADER_CATERINA) // ":avrdude" -#endif -#ifdef RGBLIGHT_ENABLE - " RGBLIGHT_ENABLE=yes" -#else - " RGBLIGHT_ENABLE=no" -#endif -#ifdef AUDIO_ENABLE - " AUDIO_ENABLE=yes" -#else - " AUDIO_ENABLE=no" #endif SS_TAP(X_ENTER)); } diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index aa9c83086..8354c55c9 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -26,8 +26,10 @@ along with this program. If not, see . #define _COLEMAK 1 #define _DVORAK 2 #define _WORKMAN 3 -#define _NAV 5 -#define _COVECUBE 6 +#define _MODS 4 +//#define _MISC 5 +#define _NAV 6 +#define _COVECUBE 7 #define _SYMB 8 #define _GAMEPAD 9 #define _DIABLO 10 @@ -142,4 +144,61 @@ enum { #define AUD_OFF AU_OFF #endif + + +// Since our quirky block definitions are basically a list of comma separated +// arguments, we need a wrapper in order for these definitions to be +// expanded before being used as arguments to the LAYOUT_xxx macro. +#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__) +#define KEYMAP_wrapper(...) KEYMAP(__VA_ARGS__) + +// Blocks for each of the four major keyboard layouts +// Organized so we can quickly adapt and modify all of them +// at once, rather than for each keyboard, one at a time. +// And this allows wor much cleaner blocks in the keymaps. +// For instance Tap/Hold for Control on all of the layouts + +#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T +#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G +#define _________________QWERTY_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B + +#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P +#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN +#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) + + +#define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G +#define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D +#define _________________COLEMAK_L3________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B + +#define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN +#define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O +#define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) + + +#define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I +#define _________________DVORAK_L3_________________ CTL_T(KC_SCLN),KC_Q, KC_J, KC_K, KC_X + +#define _________________DVORAK_R1_________________ KC_F, KC_G, KC_C, KC_R, KC_L +#define _________________DVORAK_R2_________________ KC_D, KC_H, KC_T, KC_N, KC_S +#define _________________DVORAK_R3_________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z) + + +#define _________________WORKMAN_L1________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y +#define _________________WORKMAN_L2________________ KC_A, KC_O, KC_E, KC_U, KC_I +#define _________________WORKMAN_L3________________ CTL_T(KC_SCLN),KC_Q, KC_J, KC_K, KC_X + +#define _________________WORKMAN_R1________________ KC_F, KC_G, KC_C, KC_R, KC_L +#define _________________WORKMAN_R2________________ KC_D, KC_H, KC_T, KC_N, KC_S +#define _________________WORKMAN_R3________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z) + + + +// Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN), +// this allows us to quickly modify the bottom row for all of the layouts +// so we don't have to alter it 4 times and hope that we haven't missed +// anything +#define ___________ERGODOX_BOTTOM_LEFT_____________ KC_QUOT, KC_LGUI, KC_LBRC, KC_RBRC +#define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT #endif diff --git a/users/drashna/readme.md b/users/drashna/readme.md index e77948ea9..92792fb97 100644 --- a/users/drashna/readme.md +++ b/users/drashna/readme.md @@ -20,6 +20,22 @@ This allows for keyboard specific configuration while maintaining the ability to My [Ergodox EZ Keymap](https://github.com/qmk/qmk_firmware/blob/master/keyboards/ergodox_ez/keymaps/drashna/keymap.c#L399) is a good example of this, as it uses the LEDs as modifier indicators. +Keyboard Layout Templates +------------------------- + +This borrows from @jola5's "Not quite neo" code. This allows me to maintain blocks of keymaps in the userspace, so that I can modify the userspace, and this is reflected in all of the keyboards that use it, at once. + +This makes adding tap/hold mods, or other special keycodes or functions to all keyboards super easy, as it's done to all of them at once. + +The caveat here is that the keymap needs a processor/wrapper, as it doesn't like the substitutions. However, this is as simple as just pushing it through a define. For instance: + +`#define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__)` + +Once that's been done and you've switched the keymaps to use the "wrapper", it will read the substitution blocks just fine. + +Credit goes to @jola5 for first implementing this awesome idea. + + Custom Keycodes --------------- -- cgit v1.2.3-24-g4f1b