diff options
| author | Eric Defore <d4mation@users.noreply.github.com> | 2019-12-18 03:59:12 -0500 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-12-18 00:59:12 -0800 |
| commit | f42dd61b8d29f71af2ce479064c64c96fef55ad4 (patch) | |
| tree | f4bb23467099a228c46371cebe748139953245c9 /users/d4mation | |
| parent | b2405fccce1d9dd33e72d2b43a941e9b6bbd1f0d (diff) | |
| download | qmk_firmware-f42dd61b8d29f71af2ce479064c64c96fef55ad4.tar.gz qmk_firmware-f42dd61b8d29f71af2ce479064c64c96fef55ad4.zip | |
[Keymap] Added userspace for d4mation. Included their keymap for the Atreus62 (#7483)
* Added userspace for d4mation. Included their keymap for the Atreus62
* Do not assign layer numbers manually
* Remove some unneeded things per @drashna's recommendation
* Fix some single line comments I missed
* Update unicode macros to use send_unicode_hex_string() instead of process_unicode()
* OBetter check for Unicode Enabled. Moved some checks into macros.c
* Use eeconfig_init_user() to set default unicode input mode
Diffstat (limited to 'users/d4mation')
| -rw-r--r-- | users/d4mation/config.h | 1 | ||||
| -rw-r--r-- | users/d4mation/d4mation.c | 37 | ||||
| -rw-r--r-- | users/d4mation/d4mation.h | 17 | ||||
| -rw-r--r-- | users/d4mation/macros.c | 160 | ||||
| -rw-r--r-- | users/d4mation/macros.h | 23 | ||||
| -rw-r--r-- | users/d4mation/rules.mk | 15 | ||||
| -rw-r--r-- | users/d4mation/tap-dance.c | 6 | ||||
| -rw-r--r-- | users/d4mation/tap-dance.h | 7 | ||||
| -rw-r--r-- | users/d4mation/tap-hold.c | 28 | ||||
| -rw-r--r-- | users/d4mation/tap-hold.h | 5 | ||||
| -rw-r--r-- | users/d4mation/zalgo.c | 21 | ||||
| -rw-r--r-- | users/d4mation/zalgo.h | 5 |
12 files changed, 325 insertions, 0 deletions
diff --git a/users/d4mation/config.h b/users/d4mation/config.h new file mode 100644 index 000000000..3140a036f --- /dev/null +++ b/users/d4mation/config.h | |||
| @@ -0,0 +1 @@ | |||
| #define FORCE_NKRO \ No newline at end of file | |||
diff --git a/users/d4mation/d4mation.c b/users/d4mation/d4mation.c new file mode 100644 index 000000000..5aa58a9f0 --- /dev/null +++ b/users/d4mation/d4mation.c | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | #include "d4mation.h" | ||
| 2 | |||
| 3 | __attribute__ ((weak)) | ||
| 4 | bool process_record_keymap( uint16_t keycode, keyrecord_t *record ) { | ||
| 5 | /* If you want macros specific to your keymap, you need to define this function in your keymap */ | ||
| 6 | return true; | ||
| 7 | } | ||
| 8 | |||
| 9 | __attribute__ ((weak)) | ||
| 10 | void matrix_init_keymap() { | ||
| 11 | /* If you want a matrix init specific to your keymap, you need to define this function in your keymap */ | ||
| 12 | } | ||
| 13 | |||
| 14 | __attribute__ ((weak)) | ||
| 15 | void matrix_scan_keymap() { | ||
| 16 | /* If you want a matrix scan specific to your keymap, you need to define this function in your keymap */ | ||
| 17 | } | ||
| 18 | |||
| 19 | __attribute__((weak)) | ||
| 20 | void eeconfig_init_keymap( void ) {} | ||
| 21 | |||
| 22 | /* process_record_user() is called in macros.c */ | ||
| 23 | |||
| 24 | void matrix_init_user( void ) { | ||
| 25 | matrix_init_keymap(); | ||
| 26 | } | ||
| 27 | |||
| 28 | void matrix_scan_user( void ) { | ||
| 29 | matrix_scan_keymap(); | ||
| 30 | } | ||
| 31 | |||
| 32 | void eeconfig_init_user( void ) { | ||
| 33 | |||
| 34 | eeconfig_init_keymap(); | ||
| 35 | keyboard_init(); | ||
| 36 | |||
| 37 | } \ No newline at end of file | ||
diff --git a/users/d4mation/d4mation.h b/users/d4mation/d4mation.h new file mode 100644 index 000000000..94c63526d --- /dev/null +++ b/users/d4mation/d4mation.h | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | #ifdef UNICODE_ENABLE | ||
| 6 | #include "macros.h" | ||
| 7 | #endif | ||
| 8 | |||
| 9 | #ifdef TAP_DANCE_ENABLE | ||
| 10 | #include "tap-dance.h" | ||
| 11 | #endif | ||
| 12 | |||
| 13 | bool process_record_keymap( uint16_t keycode, keyrecord_t *record ); | ||
| 14 | |||
| 15 | void matrix_init_keymap( void ); | ||
| 16 | |||
| 17 | void matrix_scan_keymap( void ); \ No newline at end of file | ||
diff --git a/users/d4mation/macros.c b/users/d4mation/macros.c new file mode 100644 index 000000000..3c115d7ea --- /dev/null +++ b/users/d4mation/macros.c | |||
| @@ -0,0 +1,160 @@ | |||
| 1 | #include "d4mation.h" | ||
| 2 | #include "tap-hold.h" | ||
| 3 | #include "zalgo.h" | ||
| 4 | #include "macros.h" | ||
| 5 | |||
| 6 | bool zalgo_enabled = false; | ||
| 7 | |||
| 8 | bool process_record_user( uint16_t keycode, keyrecord_t *record ) { | ||
| 9 | |||
| 10 | switch ( keycode ) { | ||
| 11 | |||
| 12 | case _GRAVE_ESC: | ||
| 13 | |||
| 14 | /* Send ` on Tap, Esc on Hold */ | ||
| 15 | tap_or_hold( record, KC_GRAVE, KC_ESC ); | ||
| 16 | |||
| 17 | return false; | ||
| 18 | break; | ||
| 19 | |||
| 20 | case PHPOPEN: | ||
| 21 | |||
| 22 | if ( record->event.pressed ) { | ||
| 23 | |||
| 24 | tap_code16( S( KC_COMMA ) ); | ||
| 25 | tap_code16( S( KC_SLASH ) ); | ||
| 26 | |||
| 27 | tap_code( KC_P ); | ||
| 28 | tap_code( KC_H ); | ||
| 29 | tap_code( KC_P ); | ||
| 30 | |||
| 31 | } | ||
| 32 | |||
| 33 | return false; | ||
| 34 | break; | ||
| 35 | |||
| 36 | case PHPCLSE: | ||
| 37 | |||
| 38 | if ( record->event.pressed ) { | ||
| 39 | tap_code16( S( KC_SLASH ) ); | ||
| 40 | tap_code16( S( KC_DOT ) ); | ||
| 41 | } | ||
| 42 | |||
| 43 | return false; | ||
| 44 | break; | ||
| 45 | |||
| 46 | #ifdef UNICODE_ENABLE | ||
| 47 | |||
| 48 | case AMENO: /* ༼ つ ◕_◕ ༽つ */ | ||
| 49 | |||
| 50 | if ( record->event.pressed ) { | ||
| 51 | |||
| 52 | send_unicode_hex_string( "0F3C 0020 3064 0020 25D5 005F 25D5 0020 0F3D 3064" ); | ||
| 53 | |||
| 54 | } | ||
| 55 | |||
| 56 | return false; | ||
| 57 | break; | ||
| 58 | |||
| 59 | case MAGIC: /* (∩ ͡° ͜ʖ ͡°)⊃━☆゚. * */ | ||
| 60 | |||
| 61 | if ( record->event.pressed ) { | ||
| 62 | |||
| 63 | send_unicode_hex_string( "0028 2229 0020 0361 00B0 0020 035C 0296 0020 0361 00B0 0029 2283 2501 2606 FF9F 002E 0020 002A" ); | ||
| 64 | |||
| 65 | } | ||
| 66 | |||
| 67 | return false; | ||
| 68 | break; | ||
| 69 | |||
| 70 | case LENNY: /* ( ͡° ͜ʖ ͡°) */ | ||
| 71 | |||
| 72 | if ( record->event.pressed ) { | ||
| 73 | |||
| 74 | send_unicode_hex_string( "0028 0020 0361 00B0 0020 035C 0296 0020 0361 00b0 0029" ); | ||
| 75 | |||
| 76 | } | ||
| 77 | |||
| 78 | return false; | ||
| 79 | break; | ||
| 80 | |||
| 81 | case DISFACE: /* ಠ_ಠ */ | ||
| 82 | |||
| 83 | if ( record->event.pressed ) { | ||
| 84 | send_unicode_hex_string( "0CA0 005F 0CA0" ); | ||
| 85 | } | ||
| 86 | |||
| 87 | return false; | ||
| 88 | break; | ||
| 89 | |||
| 90 | case TFLIP: /* (╯°□°)╯ ︵ ┻━┻ */ | ||
| 91 | |||
| 92 | if ( record->event.pressed ) { | ||
| 93 | |||
| 94 | send_unicode_hex_string( "0028 256F 00b0 25A1 00B0 0029 256F FE35 253B 2501 253B" ); | ||
| 95 | |||
| 96 | } | ||
| 97 | |||
| 98 | return false; | ||
| 99 | break; | ||
| 100 | |||
| 101 | case TPUT: /* ┬──┬ ノ( ゜-゜ノ) */ | ||
| 102 | |||
| 103 | if ( record->event.pressed ) { | ||
| 104 | |||
| 105 | send_unicode_hex_string( "252C 2500 2500 252C 0020 30CE 0028 0020 309C 002D 309C 30CE 0029" ); | ||
| 106 | |||
| 107 | } | ||
| 108 | |||
| 109 | return false; | ||
| 110 | break; | ||
| 111 | |||
| 112 | case SHRUG: /* ¯\_(ツ)_/¯ */ | ||
| 113 | |||
| 114 | if ( record->event.pressed ) { | ||
| 115 | |||
| 116 | send_unicode_hex_string( "00AF 005C 005F 0028 30C4 0029 005F 002F 00AF" ); | ||
| 117 | |||
| 118 | } | ||
| 119 | |||
| 120 | return false; | ||
| 121 | break; | ||
| 122 | |||
| 123 | case ZALGO: /* Toggles Zalgo Text mode */ | ||
| 124 | |||
| 125 | if ( record->event.pressed ) { | ||
| 126 | zalgo_enabled = ! zalgo_enabled; | ||
| 127 | } | ||
| 128 | |||
| 129 | return false; | ||
| 130 | break; | ||
| 131 | |||
| 132 | #endif | ||
| 133 | |||
| 134 | default: | ||
| 135 | |||
| 136 | #ifdef UNICODE_ENABLE | ||
| 137 | |||
| 138 | if ( zalgo_enabled ) { | ||
| 139 | |||
| 140 | if ( keycode < KC_A || ( keycode > KC_0 && keycode < KC_MINUS ) || keycode > KC_SLASH ) { | ||
| 141 | process_record_keymap( keycode, record ); | ||
| 142 | return true; | ||
| 143 | } | ||
| 144 | |||
| 145 | if ( record->event.pressed ) { | ||
| 146 | zalgo_text( keycode ); | ||
| 147 | } | ||
| 148 | |||
| 149 | return false; | ||
| 150 | } | ||
| 151 | |||
| 152 | #endif | ||
| 153 | |||
| 154 | break; | ||
| 155 | } | ||
| 156 | |||
| 157 | process_record_keymap( keycode, record ); | ||
| 158 | return true; | ||
| 159 | |||
| 160 | }; \ No newline at end of file | ||
diff --git a/users/d4mation/macros.h b/users/d4mation/macros.h new file mode 100644 index 000000000..e69d30dec --- /dev/null +++ b/users/d4mation/macros.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | #include "tap-hold.h" | ||
| 5 | #include "zalgo.h" | ||
| 6 | |||
| 7 | #define SCRGB LCTL( LSFT( LGUI( KC_4 ) ) ) /* Mac Screen Area Grab shortcut (Puts into Clipboard) */ | ||
| 8 | #define SLEEP LALT( LGUI( KC_SYSTEM_POWER ) ) /* Instant sleep on Mac, rather than having to hold down the button */ | ||
| 9 | |||
| 10 | enum custom_keycodes { | ||
| 11 | _GRAVE_ESC = SAFE_RANGE, /* Prefixed with underscore to prevent conflicts */ | ||
| 12 | PHPOPEN, /* <?php */ | ||
| 13 | PHPCLSE, /* ?> */ | ||
| 14 | AMENO, | ||
| 15 | MAGIC, | ||
| 16 | LENNY, | ||
| 17 | DISFACE, | ||
| 18 | TFLIP, | ||
| 19 | TPUT, | ||
| 20 | SHRUG, | ||
| 21 | ZALGO, | ||
| 22 | NEW_SAFE_RANGE | ||
| 23 | }; \ No newline at end of file | ||
diff --git a/users/d4mation/rules.mk b/users/d4mation/rules.mk new file mode 100644 index 000000000..3d65a2242 --- /dev/null +++ b/users/d4mation/rules.mk | |||
| @@ -0,0 +1,15 @@ | |||
| 1 | SRC += d4mation.c \ | ||
| 2 | tap-hold.c \ | ||
| 3 | macros.c | ||
| 4 | |||
| 5 | BOOTMAGIC_ENABLE = no | ||
| 6 | LTO_ENABLE = yes | ||
| 7 | MOUSEKEY_ENABLE = no | ||
| 8 | |||
| 9 | ifeq ($(strip $(UNICODE_ENABLE)), yes) | ||
| 10 | SRC += zalgo.c | ||
| 11 | endif | ||
| 12 | |||
| 13 | ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) | ||
| 14 | SRC += tap-dance.c | ||
| 15 | endif \ No newline at end of file | ||
diff --git a/users/d4mation/tap-dance.c b/users/d4mation/tap-dance.c new file mode 100644 index 000000000..46f2274f5 --- /dev/null +++ b/users/d4mation/tap-dance.c | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | #include "tap-dance.h" | ||
| 2 | |||
| 3 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 4 | /* Tap once/hold for Shift, tap twice for Caps Lock */ | ||
| 5 | [SHIFT_CAPS] = ACTION_TAP_DANCE_DOUBLE( KC_LSHIFT, KC_CAPS ) | ||
| 6 | }; \ No newline at end of file | ||
diff --git a/users/d4mation/tap-dance.h b/users/d4mation/tap-dance.h new file mode 100644 index 000000000..0087c4a6e --- /dev/null +++ b/users/d4mation/tap-dance.h | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | enum tap_dance { | ||
| 6 | SHIFT_CAPS = 0 | ||
| 7 | }; \ No newline at end of file | ||
diff --git a/users/d4mation/tap-hold.c b/users/d4mation/tap-hold.c new file mode 100644 index 000000000..0c5119f99 --- /dev/null +++ b/users/d4mation/tap-hold.c | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | #include "tap-hold.h" | ||
| 2 | |||
| 3 | #ifndef TAP_HOLD_TIME | ||
| 4 | #define TAP_HOLD_TIME 200 | ||
| 5 | #endif | ||
| 6 | |||
| 7 | uint16_t tap_hold_timer; | ||
| 8 | |||
| 9 | void tap_or_hold( keyrecord_t *record, uint16_t tap, uint16_t hold ) { | ||
| 10 | |||
| 11 | if ( record->event.pressed ) { | ||
| 12 | tap_hold_timer = timer_read(); | ||
| 13 | } else { | ||
| 14 | |||
| 15 | if ( tap_hold_timer && | ||
| 16 | timer_elapsed( tap_hold_timer ) > TAP_HOLD_TIME ) { | ||
| 17 | /* Held down then released */ | ||
| 18 | tap_code( hold ); | ||
| 19 | } else { | ||
| 20 | /* Quickly Tapped */ | ||
| 21 | tap_code( tap ); | ||
| 22 | } | ||
| 23 | |||
| 24 | tap_hold_timer = 0; | ||
| 25 | |||
| 26 | } | ||
| 27 | |||
| 28 | } \ No newline at end of file | ||
diff --git a/users/d4mation/tap-hold.h b/users/d4mation/tap-hold.h new file mode 100644 index 000000000..52dc0830f --- /dev/null +++ b/users/d4mation/tap-hold.h | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | void tap_or_hold( keyrecord_t *record, uint16_t tap, uint16_t hold ); \ No newline at end of file | ||
diff --git a/users/d4mation/zalgo.c b/users/d4mation/zalgo.c new file mode 100644 index 000000000..3a1688e05 --- /dev/null +++ b/users/d4mation/zalgo.c | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | #include "zalgo.h" | ||
| 2 | |||
| 3 | void zalgo_text( uint16_t keycode ) { | ||
| 4 | |||
| 5 | tap_code( keycode ); | ||
| 6 | |||
| 7 | int number = ( rand() % ( 8 + 1 - 2 ) ) + 2; | ||
| 8 | unsigned int index; | ||
| 9 | |||
| 10 | unicode_input_start(); | ||
| 11 | |||
| 12 | for ( index = 0; index < number; index++ ) { | ||
| 13 | |||
| 14 | uint16_t hex = ( rand() % ( 0x036F + 1 - 0x0300 ) ) + 0x0300; | ||
| 15 | register_hex( hex ); | ||
| 16 | |||
| 17 | } | ||
| 18 | |||
| 19 | unicode_input_finish(); | ||
| 20 | |||
| 21 | } \ No newline at end of file | ||
diff --git a/users/d4mation/zalgo.h b/users/d4mation/zalgo.h new file mode 100644 index 000000000..f59fc035b --- /dev/null +++ b/users/d4mation/zalgo.h | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "quantum.h" | ||
| 4 | |||
| 5 | void zalgo_text( uint16_t keycode ); \ No newline at end of file | ||
