diff options
Diffstat (limited to 'users/drashna')
| -rw-r--r-- | users/drashna/config.h | 61 | ||||
| -rw-r--r-- | users/drashna/drashna.c | 125 | ||||
| -rw-r--r-- | users/drashna/drashna.h | 64 | ||||
| -rw-r--r-- | users/drashna/readme.md | 27 | ||||
| -rw-r--r-- | users/drashna/rules.mk | 4 |
5 files changed, 177 insertions, 104 deletions
diff --git a/users/drashna/config.h b/users/drashna/config.h new file mode 100644 index 000000000..f33721d23 --- /dev/null +++ b/users/drashna/config.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | #ifndef USERSPACE_CONFIG_H | ||
| 2 | #define USERSPACE_CONFIG_H | ||
| 3 | |||
| 4 | |||
| 5 | #ifdef AUDIO_ENABLE | ||
| 6 | #define STARTUP_SONG SONG(IMPERIAL_MARCH) | ||
| 7 | #define GOODBYE_SONG SONG(SONIC_RING) | ||
| 8 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ | ||
| 9 | SONG(COLEMAK_SOUND), \ | ||
| 10 | SONG(DVORAK_SOUND), \ | ||
| 11 | SONG(PLOVER_SOUND) \ | ||
| 12 | } | ||
| 13 | #endif | ||
| 14 | |||
| 15 | #ifdef RGBLIGHT_ENABLE | ||
| 16 | #define RGBLIGHT_SLEEP | ||
| 17 | #endif // RGBLIGHT_ENABLE | ||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | #ifndef ONESHOT_TAP_TOGGLE | ||
| 22 | #define ONESHOT_TAP_TOGGLE 2 | ||
| 23 | #endif // !ONESHOT_TAP_TOGGLE | ||
| 24 | |||
| 25 | #ifndef ONESHOT_TIMEOUT | ||
| 26 | #define ONESHOT_TIMEOUT 3000 | ||
| 27 | #endif// !ONESHOT_TIMEOUT | ||
| 28 | |||
| 29 | #ifndef QMK_KEYS_PER_SCAN | ||
| 30 | #define QMK_KEYS_PER_SCAN 4 | ||
| 31 | #endif // !QMK_KEYS_PER_SCAN | ||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | // this makes it possible to do rolling combos (zx) with keys that | ||
| 36 | // convert to other keys on hold (z becomes ctrl when you hold it, | ||
| 37 | // and when this option isn't enabled, z rapidly followed by x | ||
| 38 | // actually sends Ctrl-x. That's bad.) | ||
| 39 | #define IGNORE_MOD_TAP_INTERRUPT | ||
| 40 | #undef PERMISSIVE_HOLD | ||
| 41 | #undef PREVENT_STUCK_MODIFIERS | ||
| 42 | |||
| 43 | #ifndef TAPPING_TOGGLE | ||
| 44 | #define TAPPING_TOGGLE 1 | ||
| 45 | #endif | ||
| 46 | |||
| 47 | #ifdef TAPPING_TERM | ||
| 48 | #undef TAPPING_TERM | ||
| 49 | #endif | ||
| 50 | #define TAPPING_TERM 150 | ||
| 51 | |||
| 52 | |||
| 53 | // Disable action_get_macro and fn_actions, since we don't use these | ||
| 54 | // and it saves on space in the firmware. | ||
| 55 | #define NO_ACTION_MACRO | ||
| 56 | #define NO_ACTION_FUNCTION | ||
| 57 | |||
| 58 | |||
| 59 | |||
| 60 | #endif // !USERSPACE_CONFIG_H | ||
| 61 | |||
diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 678570958..09b3891dd 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c | |||
| @@ -22,7 +22,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 22 | #include "secrets.h" | 22 | #include "secrets.h" |
| 23 | #else | 23 | #else |
| 24 | // `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware | 24 | // `PROGMEM const char secret[][x]` may work better, but it takes up more space in the firmware |
| 25 | // And I'm not familar enough to know which is better or why... | 25 | // And I'm not familiar enough to know which is better or why... |
| 26 | PROGMEM const char secret[][64] = { | 26 | PROGMEM const char secret[][64] = { |
| 27 | "test1", | 27 | "test1", |
| 28 | "test2", | 28 | "test2", |
| @@ -32,20 +32,13 @@ PROGMEM const char secret[][64] = { | |||
| 32 | }; | 32 | }; |
| 33 | #endif | 33 | #endif |
| 34 | 34 | ||
| 35 | #ifdef AUDIO_ENABLE | ||
| 36 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | ||
| 37 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | ||
| 38 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | ||
| 39 | float tone_workman[][2] = SONG(PLOVER_SOUND); | ||
| 40 | float tone_hackstartup[][2] = SONG(ONE_UP_SOUND); | ||
| 41 | #endif | ||
| 42 | 35 | ||
| 43 | #ifdef FAUXCLICKY_ENABLE | 36 | #ifdef FAUXCLICKY_ENABLE |
| 44 | float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); | 37 | float fauxclicky_pressed_note[2] = MUSICAL_NOTE(_A6, 2); // (_D4, 0.25); |
| 45 | float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); | 38 | float fauxclicky_released_note[2] = MUSICAL_NOTE(_A6, 2); // (_C4, 0.125); |
| 46 | #else | 39 | #else |
| 47 | float fauxclicky_pressed[][2] = SONG(E__NOTE(_A6)); // change to your tastes | 40 | float fauxclicky_pressed[][2] = SONG(S__NOTE(_A6)); // change to your tastes |
| 48 | float fauxclicky_released[][2] = SONG(E__NOTE(_A6)); // change to your tastes | 41 | float fauxclicky_released[][2] = SONG(S__NOTE(_A6)); // change to your tastes |
| 49 | #endif | 42 | #endif |
| 50 | 43 | ||
| 51 | bool faux_click_enabled = false; | 44 | bool faux_click_enabled = false; |
| @@ -191,7 +184,7 @@ void matrix_init_user(void) { | |||
| 191 | #endif | 184 | #endif |
| 192 | matrix_init_keymap(); | 185 | matrix_init_keymap(); |
| 193 | } | 186 | } |
| 194 | // No global matrix scan code, so just run keymap's matix | 187 | // No global matrix scan code, so just run keymap's matrix |
| 195 | // scan function | 188 | // scan function |
| 196 | void matrix_scan_user(void) { | 189 | void matrix_scan_user(void) { |
| 197 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. | 190 | #ifdef TAP_DANCE_ENABLE // Run Diablo 3 macro checking code. |
| @@ -202,17 +195,20 @@ void matrix_scan_user(void) { | |||
| 202 | 195 | ||
| 203 | // This block is for all of the gaming macros, as they were all doing | 196 | // This block is for all of the gaming macros, as they were all doing |
| 204 | // the same thing, but with differring text sent. | 197 | // the same thing, but with differring text sent. |
| 205 | void send_game_macro(const char *str) { | 198 | bool send_game_macro(const char *str, keyrecord_t *record, bool override) { |
| 206 | clear_keyboard(); | 199 | if (!record->event.pressed || override) { |
| 207 | register_code(is_overwatch ? KC_BSPC : KC_ENTER); | 200 | clear_keyboard(); |
| 208 | unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); | 201 | register_code(is_overwatch ? KC_BSPC : KC_ENTER); |
| 209 | wait_ms(50); | 202 | unregister_code(is_overwatch ? KC_BSPC : KC_ENTER); |
| 210 | send_string(str); | 203 | wait_ms(50); |
| 211 | register_code(KC_ENTER); | 204 | send_string(str); |
| 212 | unregister_code(KC_ENTER); | 205 | register_code(KC_ENTER); |
| 206 | unregister_code(KC_ENTER); | ||
| 207 | } | ||
| 208 | if (override) wait_ms(3000); | ||
| 209 | return false; | ||
| 213 | } | 210 | } |
| 214 | 211 | ||
| 215 | |||
| 216 | // Sent the default layer | 212 | // Sent the default layer |
| 217 | void persistent_default_layer_set(uint16_t default_layer) { | 213 | void persistent_default_layer_set(uint16_t default_layer) { |
| 218 | eeconfig_update_default_layer(default_layer); | 214 | eeconfig_update_default_layer(default_layer); |
| @@ -221,7 +217,7 @@ void persistent_default_layer_set(uint16_t default_layer) { | |||
| 221 | 217 | ||
| 222 | 218 | ||
| 223 | // Defines actions tor my global custom keycodes. Defined in drashna.h file | 219 | // Defines actions tor my global custom keycodes. Defined in drashna.h file |
| 224 | // Then runs the _keymap's recod handier if not processed here | 220 | // Then runs the _keymap's record handier if not processed here |
| 225 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 221 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 226 | 222 | ||
| 227 | // If console is enabled, it will print the matrix position and status of each key pressed | 223 | // If console is enabled, it will print the matrix position and status of each key pressed |
| @@ -230,7 +226,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 230 | #endif //CONSOLE_ENABLE | 226 | #endif //CONSOLE_ENABLE |
| 231 | 227 | ||
| 232 | // Run custom faux click code, but only if faux clicky is enabled | 228 | // Run custom faux click code, but only if faux clicky is enabled |
| 233 | #ifdef AUDIO_ENABLE | 229 | #ifdef AUDIO_ENABLE |
| 234 | if ( (faux_click_enabled && keycode != KC_FXCL) || (!faux_click_enabled && keycode == KC_FXCL) ) { | 230 | if ( (faux_click_enabled && keycode != KC_FXCL) || (!faux_click_enabled && keycode == KC_FXCL) ) { |
| 235 | if (record->event.pressed) { | 231 | if (record->event.pressed) { |
| 236 | PLAY_SONG(fauxclicky_pressed); | 232 | PLAY_SONG(fauxclicky_pressed); |
| @@ -245,37 +241,25 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 245 | switch (keycode) { | 241 | switch (keycode) { |
| 246 | case KC_QWERTY: | 242 | case KC_QWERTY: |
| 247 | if (record->event.pressed) { | 243 | if (record->event.pressed) { |
| 248 | #ifdef AUDIO_ENABLE | 244 | set_single_persistent_default_layer(_QWERTY); |
| 249 | PLAY_SONG(tone_qwerty); | ||
| 250 | #endif //AUDIO_ENABLE | ||
| 251 | persistent_default_layer_set(1UL << _QWERTY); | ||
| 252 | } | 245 | } |
| 253 | return false; | 246 | return false; |
| 254 | break; | 247 | break; |
| 255 | case KC_COLEMAK: | 248 | case KC_COLEMAK: |
| 256 | if (record->event.pressed) { | 249 | if (record->event.pressed) { |
| 257 | #ifdef AUDIO_ENABLE | 250 | set_single_persistent_default_layer(_COLEMAK); |
| 258 | PLAY_SONG(tone_colemak); | ||
| 259 | #endif //AUDIO_ENABLE | ||
| 260 | persistent_default_layer_set(1UL << _COLEMAK); | ||
| 261 | } | 251 | } |
| 262 | return false; | 252 | return false; |
| 263 | break; | 253 | break; |
| 264 | case KC_DVORAK: | 254 | case KC_DVORAK: |
| 265 | if (record->event.pressed) { | 255 | if (record->event.pressed) { |
| 266 | #ifdef AUDIO_ENABLE | 256 | set_single_persistent_default_layer(_DVORAK); |
| 267 | PLAY_SONG(tone_dvorak); | ||
| 268 | #endif //AUDIO_ENABLE | ||
| 269 | persistent_default_layer_set(1UL << _DVORAK); | ||
| 270 | } | 257 | } |
| 271 | return false; | 258 | return false; |
| 272 | break; | 259 | break; |
| 273 | case KC_WORKMAN: | 260 | case KC_WORKMAN: |
| 274 | if (record->event.pressed) { | 261 | if (record->event.pressed) { |
| 275 | #ifdef AUDIO_ENABLE | 262 | set_single_persistent_default_layer(_WORKMAN); |
| 276 | PLAY_SONG(tone_workman); | ||
| 277 | #endif //AUDIO_ENABLE | ||
| 278 | persistent_default_layer_set(1UL << _WORKMAN); | ||
| 279 | } | 263 | } |
| 280 | return false; | 264 | return false; |
| 281 | break; | 265 | break; |
| @@ -328,7 +312,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 328 | } | 312 | } |
| 329 | return false; | 313 | return false; |
| 330 | break; | 314 | break; |
| 331 | case KC_RESET: // Custom RESET code that setr RGBLights to RED | 315 | |
| 316 | |||
| 317 | case KC_RESET: // Custom RESET code that sets RGBLights to RED | ||
| 332 | if (!record->event.pressed) { | 318 | if (!record->event.pressed) { |
| 333 | #ifdef RGBLIGHT_ENABLE | 319 | #ifdef RGBLIGHT_ENABLE |
| 334 | rgblight_enable(); | 320 | rgblight_enable(); |
| @@ -339,6 +325,8 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 339 | } | 325 | } |
| 340 | return false; | 326 | return false; |
| 341 | break; | 327 | break; |
| 328 | |||
| 329 | |||
| 342 | case EPRM: // Resets EEPROM | 330 | case EPRM: // Resets EEPROM |
| 343 | if (record->event.pressed) { | 331 | if (record->event.pressed) { |
| 344 | eeconfig_init(); | 332 | eeconfig_init(); |
| @@ -347,11 +335,13 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 347 | break; | 335 | break; |
| 348 | case VRSN: // Prints firmware version | 336 | case VRSN: // Prints firmware version |
| 349 | if (record->event.pressed) { | 337 | if (record->event.pressed) { |
| 350 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION); | 338 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE); |
| 351 | } | 339 | } |
| 352 | return false; | 340 | return false; |
| 353 | break; | 341 | break; |
| 354 | case KC_SECRET_1 ... KC_SECRET_5: // Custom | 342 | |
| 343 | |||
| 344 | case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo | ||
| 355 | if (!record->event.pressed) { | 345 | if (!record->event.pressed) { |
| 356 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | 346 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); |
| 357 | send_string_P(secret[keycode - KC_SECRET_1]); | 347 | send_string_P(secret[keycode - KC_SECRET_1]); |
| @@ -364,61 +354,42 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 364 | // Only enables for the viterbi, basically, | 354 | // Only enables for the viterbi, basically, |
| 365 | // to save on firmware space, since it's limited. | 355 | // to save on firmware space, since it's limited. |
| 366 | #if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) | 356 | #if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) |
| 367 | |||
| 368 | |||
| 369 | case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros | 357 | case KC_OVERWATCH: // Toggle's if we hit "ENTER" or "BACKSPACE" to input macros |
| 370 | if (record->event.pressed) { is_overwatch = !is_overwatch; } | 358 | if (record->event.pressed) { is_overwatch = !is_overwatch; } |
| 371 | #ifdef RGBLIGHT_ENABLE | 359 | #ifdef RGBLIGHT_ENABLE |
| 372 | is_overwatch ? rgblight_mode(17) : rgblight_mode(18); | 360 | is_overwatch ? rgblight_mode(17) : rgblight_mode(18); |
| 373 | #endif //RGBLIGHT_ENABLE | 361 | #endif //RGBLIGHT_ENABLE |
| 374 | return false; | ||
| 375 | break; | ||
| 376 | |||
| 377 | case KC_SALT: | ||
| 378 | if (!record->event.pressed) { send_game_macro("Salt, salt, salt..."); } | ||
| 379 | return false; break; | 362 | return false; break; |
| 363 | case KC_SALT: | ||
| 364 | return send_game_macro("Salt, salt, salt...", record, false); | ||
| 380 | case KC_MORESALT: | 365 | case KC_MORESALT: |
| 381 | if (!record->event.pressed) { send_game_macro("Please sir, can I have some more salt?!"); } | 366 | return send_game_macro("Please sir, can I have some more salt?!", record, false); |
| 382 | return false; break; | ||
| 383 | case KC_SALTHARD: | 367 | case KC_SALTHARD: |
| 384 | if (!record->event.pressed) { send_game_macro("Your salt only makes me harder, and even more aggressive!"); } | 368 | return send_game_macro("Your salt only makes me harder, and even more aggressive!", record, false); |
| 385 | return false; break; | ||
| 386 | case KC_GOODGAME: | 369 | case KC_GOODGAME: |
| 387 | if (!record->event.pressed) { send_game_macro("Good game, everyone!"); } | 370 | return send_game_macro("Good game, everyone!", record, false); |
| 388 | return false; break; | ||
| 389 | case KC_GLHF: | 371 | case KC_GLHF: |
| 390 | if (!record->event.pressed) { send_game_macro("Good luck, have fun!!!"); } | 372 | return send_game_macro("Good luck, have fun!!!", record, false); |
| 391 | return false; break; | ||
| 392 | case KC_SYMM: | 373 | case KC_SYMM: |
| 393 | if (!record->event.pressed) { send_game_macro("Left click to win!"); } | 374 | return send_game_macro("Left click to win!", record, false); |
| 394 | return false; break; | ||
| 395 | case KC_JUSTGAME: | 375 | case KC_JUSTGAME: |
| 396 | if (!record->event.pressed) { send_game_macro("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."); } | 376 | return send_game_macro("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.", record, false); |
| 397 | return false; break; | ||
| 398 | case KC_TORB: | 377 | case KC_TORB: |
| 399 | if (!record->event.pressed) { send_game_macro("That was positively riveting!"); } | 378 | return send_game_macro("That was positively riveting!", record, false); |
| 400 | return false; break; | ||
| 401 | case KC_AIM: | 379 | case KC_AIM: |
| 402 | if (!record->event.pressed) { | 380 | send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!", record, true); |
| 403 | send_game_macro("That aim is absolutely amazing. It's almost like you're a machine!"); | 381 | return send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!", record, false); |
| 404 | wait_ms(3000); | ||
| 405 | send_game_macro("Wait! That aim is TOO good! You're clearly using an aim hack! CHEATER!"); | ||
| 406 | } | ||
| 407 | return false; break; | ||
| 408 | case KC_C9: | 382 | case KC_C9: |
| 409 | if (!record->event.pressed) { send_game_macro("OMG!!! C9!!!"); } | 383 | return send_game_macro("OMG!!! C9!!!", record, false); |
| 410 | return false; break; | ||
| 411 | case KC_GGEZ: | 384 | case KC_GGEZ: |
| 412 | if (!record->event.pressed) { send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!"); } | 385 | return send_game_macro("That was a fantastic game, though it was a bit easy. Try harder next time!", record, false); |
| 413 | return false; break; | ||
| 414 | #endif // !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) | 386 | #endif // !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez)) |
| 415 | 387 | ||
| 416 | 388 | ||
| 417 | #ifdef TAP_DANCE_ENABLE | 389 | #ifdef TAP_DANCE_ENABLE |
| 418 | case KC_DIABLO_CLEAR: // reset all Diable timers, disabling them | 390 | case KC_DIABLO_CLEAR: // reset all Diablo timers, disabling them |
| 419 | if (record->event.pressed) { | 391 | if (record->event.pressed) { |
| 420 | uint8_t dtime; | 392 | uint8_t dtime; |
| 421 | |||
| 422 | for (dtime = 0; dtime < 4; dtime++) { | 393 | for (dtime = 0; dtime < 4; dtime++) { |
| 423 | diablo_key_time[dtime] = diablo_times[0]; | 394 | diablo_key_time[dtime] = diablo_times[0]; |
| 424 | } | 395 | } |
| @@ -437,14 +408,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |||
| 437 | if (record->event.pressed) { | 408 | if (record->event.pressed) { |
| 438 | rgb_layer_change = !rgb_layer_change; | 409 | rgb_layer_change = !rgb_layer_change; |
| 439 | if (rgb_layer_change) { | 410 | if (rgb_layer_change) { |
| 440 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks beetter) | 411 | layer_state_set(layer_state); // This is needed to immediately set the layer color (looks better) |
| 441 | } | 412 | } |
| 442 | } | 413 | } |
| 443 | #endif // RGBLIGHT_ENABLE | 414 | #endif // RGBLIGHT_ENABLE |
| 444 | return false; break; | 415 | return false; break; |
| 445 | #ifdef RGBLIGHT_ENABLE | 416 | #ifdef RGBLIGHT_ENABLE |
| 446 | case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions | 417 | case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions |
| 447 | if (record->event.pressed) { //This disrables layer indication, as it's assumed that if you're changing this ... you want that disabled | 418 | if (record->event.pressed) { //This disables layer indication, as it's assumed that if you're changing this ... you want that disabled |
| 448 | rgb_layer_change = false; | 419 | rgb_layer_change = false; |
| 449 | } | 420 | } |
| 450 | return true; break; | 421 | return true; break; |
| @@ -534,7 +505,7 @@ uint32_t layer_state_set_user(uint32_t state) { | |||
| 534 | 505 | ||
| 535 | // Any custom LED code goes here. | 506 | // Any custom LED code goes here. |
| 536 | // So far, I only have keyboard specific code, | 507 | // So far, I only have keyboard specific code, |
| 537 | // So nothing goes here. | 508 | // So nothing goes here. |
| 538 | void led_set_user(uint8_t usb_led) { | 509 | void led_set_user(uint8_t usb_led) { |
| 539 | led_set_keymap(usb_led); | 510 | led_set_keymap(usb_led); |
| 540 | } | 511 | } |
diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 8a022cd14..0df9abb46 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h | |||
| @@ -17,10 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 17 | 17 | ||
| 18 | #ifndef USERSPACE | 18 | #ifndef USERSPACE |
| 19 | #define USERSPACE | 19 | #define USERSPACE |
| 20 | |||
| 21 | #include "quantum.h" | 20 | #include "quantum.h" |
| 22 | 21 | ||
| 23 | // Define layer names | 22 | // Define layer names |
| 24 | #define _QWERTY 0 | 23 | #define _QWERTY 0 |
| 25 | #define _NUMLOCK 0 | 24 | #define _NUMLOCK 0 |
| 26 | #define _COLEMAK 1 | 25 | #define _COLEMAK 1 |
| @@ -118,6 +117,12 @@ enum userspace_custom_keycodes { | |||
| 118 | NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes | 117 | NEW_SAFE_RANGE //use "NEWPLACEHOLDER for keymap specific codes |
| 119 | }; | 118 | }; |
| 120 | 119 | ||
| 120 | #define KC_SEC1 KC_SECRET_1 | ||
| 121 | #define KC_SEC2 KC_SECRET_2 | ||
| 122 | #define KC_SEC3 KC_SECRET_3 | ||
| 123 | #define KC_SEC4 KC_SECRET_4 | ||
| 124 | #define KC_SEC5 KC_SECRET_5 | ||
| 125 | |||
| 121 | #ifdef TAP_DANCE_ENABLE | 126 | #ifdef TAP_DANCE_ENABLE |
| 122 | enum { | 127 | enum { |
| 123 | TD_D3_1 = 0, | 128 | TD_D3_1 = 0, |
| @@ -129,8 +134,8 @@ enum { | |||
| 129 | 134 | ||
| 130 | 135 | ||
| 131 | // Custom Keycodes for Diablo 3 layer | 136 | // Custom Keycodes for Diablo 3 layer |
| 132 | // But since TD() doesn't work when tapdance is disabled | 137 | // But since TD() doesn't work when tap dance is disabled |
| 133 | // We use custom codes here, so we can substituet the right stuff | 138 | // We use custom codes here, so we can substitute the right stuff |
| 134 | #ifdef TAP_DANCE_ENABLE | 139 | #ifdef TAP_DANCE_ENABLE |
| 135 | #define KC_D3_1 TD(TD_D3_1) | 140 | #define KC_D3_1 TD(TD_D3_1) |
| 136 | #define KC_D3_2 TD(TD_D3_2) | 141 | #define KC_D3_2 TD(TD_D3_2) |
| @@ -146,26 +151,10 @@ enum { | |||
| 146 | // OSM keycodes, to keep things clean and easy to change | 151 | // OSM keycodes, to keep things clean and easy to change |
| 147 | #define KC_MLSF OSM(MOD_LSFT) | 152 | #define KC_MLSF OSM(MOD_LSFT) |
| 148 | #define KC_MRSF OSM(MOD_RSFT) | 153 | #define KC_MRSF OSM(MOD_RSFT) |
| 149 | #define ONESHOT_TIMEOUT 3000 | ||
| 150 | |||
| 151 | #define QMK_KEYS_PER_SCAN 8 | ||
| 152 | 154 | ||
| 153 | #ifdef RGBLIGHT_ENABLE | ||
| 154 | #define RGBLIGHT_SLEEP | ||
| 155 | #endif // RGBLIGHT_ENABLE | ||
| 156 | 155 | ||
| 157 | // this makes it possible to do rolling combos (zx) with keys that | ||
| 158 | // convert to other keys on hold (z becomes ctrl when you hold it, | ||
| 159 | // and when this option isn't enabled, z rapidly followed by x | ||
| 160 | // actually sends Ctrl-x. That's bad.) | ||
| 161 | #define IGNORE_MOD_TAP_INTERRUPT | ||
| 162 | 156 | ||
| 163 | // Disable action_get_macro and fn_actions, since we don't use these | 157 | // If we're still using the official Faux Clicky feature, substitute codes |
| 164 | // and it saves on space in the firmware. | ||
| 165 | #define NO_ACTION_MACRO | ||
| 166 | #define NO_ACTION_FUNCTION | ||
| 167 | |||
| 168 | // If we're still using the official Faux Clicky feature, substituet codes | ||
| 169 | // so that we don't have any unused/blank keys. | 158 | // so that we don't have any unused/blank keys. |
| 170 | #ifdef FAUXCLICKY_ENABLE | 159 | #ifdef FAUXCLICKY_ENABLE |
| 171 | #define AUD_ON FC_ON | 160 | #define AUD_ON FC_ON |
| @@ -177,23 +166,27 @@ enum { | |||
| 177 | 166 | ||
| 178 | 167 | ||
| 179 | 168 | ||
| 180 | // Since our quirky block definitions are basically a list of comma separated | 169 | // Since our quirky block definitions are basically a list of comma separated |
| 181 | // arguments, we need a wrapper in order for these definitions to be | 170 | // arguments, we need a wrapper in order for these definitions to be |
| 182 | // expanded before being used as arguments to the LAYOUT_xxx macro. | 171 | // expanded before being used as arguments to the LAYOUT_xxx macro. |
| 172 | #if (!defined(LAYOUT) && defined(KEYMAP)) | ||
| 173 | #define LAYOUT KEYMAP | ||
| 174 | #endif | ||
| 175 | |||
| 183 | #define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__) | 176 | #define LAYOUT_ergodox_wrapper(...) LAYOUT_ergodox(__VA_ARGS__) |
| 184 | #define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__) | 177 | #define LAYOUT_ergodox_pretty_wrapper(...) LAYOUT_ergodox_pretty(__VA_ARGS__) |
| 185 | #define KEYMAP_wrapper(...) KEYMAP(__VA_ARGS__) | 178 | #define KEYMAP_wrapper(...) LAYOUT(__VA_ARGS__) |
| 186 | 179 | ||
| 187 | 180 | ||
| 188 | // Blocks for each of the four major keyboard layouts | 181 | // Blocks for each of the four major keyboard layouts |
| 189 | // Organized so we can quickly adapt and modify all of them | 182 | // Organized so we can quickly adapt and modify all of them |
| 190 | // at once, rather than for each keyboard, one at a time. | 183 | // at once, rather than for each keyboard, one at a time. |
| 191 | // And this allows wor much cleaner blocks in the keymaps. | 184 | // And this allows for much cleaner blocks in the keymaps. |
| 192 | // For instance Tap/Hold for Control on all of the layouts | 185 | // For instance Tap/Hold for Control on all of the layouts |
| 193 | 186 | ||
| 194 | // NOTE: These are all the same length. If you do a search/replace | 187 | // NOTE: These are all the same length. If you do a search/replace |
| 195 | // then you need to add/remove underscores to keep the | 188 | // then you need to add/remove underscores to keep the |
| 196 | // lengths consistent. | 189 | // lengths consistent. |
| 197 | 190 | ||
| 198 | #define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T | 191 | #define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T |
| 199 | #define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G | 192 | #define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G |
| @@ -212,6 +205,14 @@ enum { | |||
| 212 | #define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O | 205 | #define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O |
| 213 | #define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) | 206 | #define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) |
| 214 | 207 | ||
| 208 | #define ______________COLEMAK_MOD_DH_L1____________ KC_Q, KC_W, KC_F, KC_P, KC_B | ||
| 209 | #define ______________COLEMAK_MOD_DH_L2____________ KC_A, KC_R, KC_S, KC_T, KC_G | ||
| 210 | #define ______________COLEMAK_MOD_DH_L3____________ CTL_T(KC_Z), KC_X, KC_C, KC_D, KC_V | ||
| 211 | |||
| 212 | #define ______________COLEMAK_MOD_DH_R1____________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN | ||
| 213 | #define ______________COLEMAK_MOD_DH_R2____________ KC_K, KC_N, KC_E, KC_I, KC_O | ||
| 214 | #define ______________COLEMAK_MOD_DH_R3____________ KC_M, KC_H, KC_COMM, KC_DOT, CTL_T(KC_SLASH) | ||
| 215 | |||
| 215 | 216 | ||
| 216 | #define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y | 217 | #define _________________DVORAK_L1_________________ KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y |
| 217 | #define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I | 218 | #define _________________DVORAK_L2_________________ KC_A, KC_O, KC_E, KC_U, KC_I |
| @@ -231,12 +232,21 @@ enum { | |||
| 231 | #define _________________WORKMAN_R3________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z) | 232 | #define _________________WORKMAN_R3________________ KC_B, KC_M, KC_W, KC_V, CTL_T(KC_Z) |
| 232 | 233 | ||
| 233 | 234 | ||
| 235 | #define _________________NORMAN_L1_________________ KC_Q, KC_W, KC_D, KC_F, KC_K | ||
| 236 | #define _________________NORMAN_L2_________________ KC_A, KC_S, KC_E, KC_T, KC_G | ||
| 237 | #define _________________NORMAN_L3_________________ CTL_T(KC_Z), KC_X, KC_C, KC_V, KC_B | ||
| 238 | |||
| 239 | #define _________________NORMAN_R1_________________ KC_J, KC_U, KC_R, KC_L, KC_SCLN | ||
| 240 | #define _________________NORMAN_R2_________________ KC_J, KC_N, KC_I, KC_O, KC_U | ||
| 241 | #define _________________NORMAN_R3_________________ KC_P, KC_M, KC_COMM, KC_DOT, CTL_T(KC_SLASH) | ||
| 242 | |||
| 243 | |||
| 234 | 244 | ||
| 235 | // Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN), | 245 | // Since we have 4 default layouts (QWERTY, DVORAK, COLEMAK and WORKMAN), |
| 236 | // this allows us to quickly modify the bottom row for all of the layouts | 246 | // this allows us to quickly modify the bottom row for all of the layouts |
| 237 | // so we don't have to alter it 4 times and hope that we haven't missed | 247 | // so we don't have to alter it 4 times and hope that we haven't missed |
| 238 | // anything | 248 | // anything |
| 239 | #define ___________ERGODOX_BOTTOM_LEFT_____________ KC_QUOT, KC_MEH, KC_LBRC, KC_RBRC | 249 | #define ___________ERGODOX_BOTTOM_LEFT_____________ KC_MEH, KC_LGUI, KC_LBRC, KC_RBRC |
| 240 | #define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | 250 | #define ___________ERGODOX_BOTTOM_RIGHT____________ KC_LEFT, KC_DOWN, KC_UP, KC_RGHT |
| 241 | 251 | ||
| 242 | 252 | ||
diff --git a/users/drashna/readme.md b/users/drashna/readme.md index 92792fb97..2229a3fe0 100644 --- a/users/drashna/readme.md +++ b/users/drashna/readme.md | |||
| @@ -3,6 +3,33 @@ Overview | |||
| 3 | 3 | ||
| 4 | This is my personal userspace file. Most of my code exists here, as it's heavily shared. | 4 | This is my personal userspace file. Most of my code exists here, as it's heavily shared. |
| 5 | 5 | ||
| 6 | Userspace Config.h | ||
| 7 | ------------------ | ||
| 8 | |||
| 9 | By default, the userspace feature doesn't include a `config.h` file the way that that keyboards, revisions, keymaps and layouts handle them. This means that if you want global configurations via userspace, it's very difficult to implement. | ||
| 10 | |||
| 11 | The reason for using seperate files here is that the `drashna.h` file doesn't get called in such a way that will actually define QMK settings. Additionally, attempting to add it to the `config.h` files has issues. Namely, the `drashna.h` file requires the `quantum.h` file... but including this to the `config.h` attemps to redefines a bunch of settings and breaks the firmare. Removing the `quantum.h` include means that a number of data structures no longer get added, and the `SAFE_RANGE` value is no longer defined, as well. So we need both a `config.h` for global config, and we need a seperate h file for local settings. | ||
| 12 | |||
| 13 | However, the `rules.mk` file is included when building the firmware. So we can hijack that process to "manually" add a `config.h`. To do so, you would need to add the following to the `rules.mk` in your userspace: | ||
| 14 | |||
| 15 | ``` | ||
| 16 | ifneq ("$(wildcard users/$(KEYMAP)/config.h)","") | ||
| 17 | CONFIG_H += users/$(KEYMAP)/config.h | ||
| 18 | endif | ||
| 19 | ``` | ||
| 20 | |||
| 21 | You can replace `$(KEYMAP)` with your name, but it's not necessary. This checks for the existence of `/users/<name>/config.h`, and if it exists, includes it like every other `config.h` file, allowing you to make global `config.h` settings. | ||
| 22 | |||
| 23 | As for the `config.h` file, you want to make sure that it has an "ifdef" in it to make sure it's only used once. So you want something like this: | ||
| 24 | |||
| 25 | ``` | ||
| 26 | #ifndef USERSPACE_CONFIG_H | ||
| 27 | #define USERSPACE_CONFIG_H | ||
| 28 | |||
| 29 | // put stuff here | ||
| 30 | |||
| 31 | #endif | ||
| 32 | ``` | ||
| 6 | 33 | ||
| 7 | Custom userspace handlers | 34 | Custom userspace handlers |
| 8 | ------------------------- | 35 | ------------------------- |
diff --git a/users/drashna/rules.mk b/users/drashna/rules.mk index ab2ab607d..6d9f0664e 100644 --- a/users/drashna/rules.mk +++ b/users/drashna/rules.mk | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 1 | ||
| 2 | SRC += drashna.c | 2 | SRC += drashna.c |
| 3 | EXTRAFLAGS += -flto | 3 | EXTRAFLAGS += -flto |
| 4 | |||
| 5 | ifneq ("$(wildcard users/$(KEYMAP)/config.h)","") | ||
| 6 | CONFIG_H += users/$(KEYMAP)/config.h | ||
| 7 | endif | ||
