diff options
| author | Joel Elkins <joel@elkins.co> | 2021-06-02 15:59:52 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-03 06:59:52 +1000 |
| commit | 35dbe8ba035c8eefc1051226aa8e3dd7cd63a912 (patch) | |
| tree | f152e98a0953238771853d1462a26e10d3540633 | |
| parent | 93496c8364369f72e2db90c3c59dfa3ecc8657b4 (diff) | |
| download | qmk_firmware-35dbe8ba035c8eefc1051226aa8e3dd7cd63a912.tar.gz qmk_firmware-35dbe8ba035c8eefc1051226aa8e3dd7cd63a912.zip | |
[Keymap] merge jdelkins userspace and associated keymaps (#11276)
* [Keymap] merge jdelkins userspace and associated keymaps
* Add copyright & license info
* Change rgblight_config.enable to rgblight_is_enabled()
* Update keyboards/dz60/keymaps/jdelkins/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/dz60/keymaps/jdelkins/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Update keyboards/dz60/keymaps/jdelkins/keymap.c
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Remove superfluous includes
* Change EXTRAFLAGS+=-flto to LTO_ENABLE=yes
* Remove unnecessary jdelkins_ss symlink in users
* Add copyright and license notices
* Use preferred way to determine capslock / numlock state
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Add #pragma once to a header
Co-authored-by: Drashna Jaelre <drashna@live.com>
* Include QMK_KEYBOARD_H only once, in userspace header
* Remove unnecessary initialization in matrix_init_keymap
* Do process_record_keymap before cases handled in process_record_user
* Reorganize & simplify secrets feature enablement
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove superfluous break
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* include "print.h" instead of <print.h>
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_cod16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* add #pragma once to a header
Co-authored-by: Ryan <fauxpark@gmail.com>
* include "print.h" instead of <print.h>
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Remove copyright from rules.mk
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use tap_code16
Co-authored-by: Ryan <fauxpark@gmail.com>
* Use :flash target where possible
* Remove special case flash target and use PROGRAM_CMD
* dz60/jdelkins_ss: use tap_code16
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
22 files changed, 2724 insertions, 0 deletions
diff --git a/keyboards/dz60/keymaps/jdelkins/config.h b/keyboards/dz60/keymaps/jdelkins/config.h new file mode 100644 index 000000000..95b45b2c1 --- /dev/null +++ b/keyboards/dz60/keymaps/jdelkins/config.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | /* Directional arrangement | LAYOUT_directional | ||
| 21 | * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ | ||
| 22 | * │00 │01 │02 │03 │04 │05 │06 │07 │08 │09 │0a │0b │0c │ 0e │ | ||
| 23 | * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ | ||
| 24 | * │10 │12 │13 │14 │15 │16 │17 │18 │19 │1a │1b │1c │1d │1e │ | ||
| 25 | * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ | ||
| 26 | * │20 │22 │23 │24 │25 │26 │27 │28 │29 │2a │2b │2c │2d │ | ||
| 27 | * ├──────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬───┬───┤ | ||
| 28 | * │30 │32 │33 │34 │35 │36 │37 │38 │39 │3a │3b │3c │3d │3e │ | ||
| 29 | * ├────┬──┴─┬─┴──┬┴───┴───┴───┴───┴───┴───┼───┼───┼───┼───┼───┤ | ||
| 30 | * │40 │41 │43 │ 46 │4a │4b │4c │4d │4e │ | ||
| 31 | * └────┴────┴────┴────────────────────────┴───┴───┴───┴───┴───┘ | ||
| 32 | */ | ||
| 33 | |||
| 34 | #define LAYOUT_directional_nosplitspace( \ | ||
| 35 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0e, \ | ||
| 36 | k10, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \ | ||
| 37 | k20, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, \ | ||
| 38 | k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e, \ | ||
| 39 | k40, k41, k43, k46, k4a, k4b, k4c, k4d, k4e \ | ||
| 40 | ) { \ | ||
| 41 | { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, KC_NO,k0e }, \ | ||
| 42 | { k10, KC_NO, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e }, \ | ||
| 43 | { k20, KC_NO, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, KC_NO }, \ | ||
| 44 | { k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3c, k3d, k3e }, \ | ||
| 45 | { k40, k41, KC_NO, k43, KC_NO,KC_NO, k46, KC_NO, KC_NO,KC_NO, k4a, k4b, k4c, k4d, k4e } \ | ||
| 46 | } | ||
| 47 | |||
| 48 | #define AUTO_SHIFT_TIMEOUT 160 | ||
| 49 | #define RGBLIGHT_LAYERS | ||
| 50 | #define LEADER_TIMEOUT 400 | ||
| 51 | #define LEADER_PER_KEY_TIMING | ||
diff --git a/keyboards/dz60/keymaps/jdelkins/keymap.c b/keyboards/dz60/keymaps/jdelkins/keymap.c new file mode 100644 index 000000000..c0bf4445a --- /dev/null +++ b/keyboards/dz60/keymaps/jdelkins/keymap.c | |||
| @@ -0,0 +1,279 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "jdelkins.h" | ||
| 19 | |||
| 20 | #undef LAYOUT | ||
| 21 | #define LAYOUT LAYOUT_directional_nosplitspace | ||
| 22 | |||
| 23 | #define IDLE_TIMEOUT 360 | ||
| 24 | uint16_t rgb_idle_seconds = 0; | ||
| 25 | uint16_t rgb_timer; | ||
| 26 | bool rgb_was_enabled; | ||
| 27 | |||
| 28 | // Tap Dance | ||
| 29 | |||
| 30 | int ctl_state = 0; | ||
| 31 | |||
| 32 | void ctl_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 33 | ctl_state = cur_dance(state); | ||
| 34 | switch(ctl_state) { | ||
| 35 | case SINGLE_TAP: qk_leader_start(); break; | ||
| 36 | case SINGLE_HOLD: register_code(KC_LCTL); break; | ||
| 37 | case DOUBLE_TAP: tap_code(KC_RCTL); break; | ||
| 38 | case DOUBLE_HOLD: register_code(KC_RCTL); break; | ||
| 39 | case TRIPLE_TAP: tap_code(KC_RCTL); tap_code(KC_RCTL); break; | ||
| 40 | case TRIPLE_HOLD: tap_code(KC_RCTL); register_code(KC_RCTL); break; | ||
| 41 | } | ||
| 42 | } | ||
| 43 | |||
| 44 | void ctl_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 45 | switch(ctl_state) { | ||
| 46 | case SINGLE_HOLD: unregister_code(KC_LCTL); break; | ||
| 47 | case DOUBLE_HOLD: | ||
| 48 | case TRIPLE_HOLD: unregister_code(KC_RCTL); break; | ||
| 49 | } | ||
| 50 | ctl_state = 0; | ||
| 51 | } | ||
| 52 | |||
| 53 | void g_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 54 | switch (cur_dance(state)) { | ||
| 55 | case SINGLE_TAP: | ||
| 56 | tap_code16(C(KC_END)); | ||
| 57 | break; | ||
| 58 | case DOUBLE_TAP: | ||
| 59 | tap_code16(C(KC_HOME)); | ||
| 60 | break; | ||
| 61 | } | ||
| 62 | } | ||
| 63 | |||
| 64 | enum { | ||
| 65 | TD_LDCTL, | ||
| 66 | TD_G, | ||
| 67 | }; | ||
| 68 | |||
| 69 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 70 | [TD_LDCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_finished, ctl_reset), | ||
| 71 | [TD_G] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, g_finished, NULL), | ||
| 72 | }; | ||
| 73 | |||
| 74 | // Layers | ||
| 75 | |||
| 76 | const uint16_t PROGMEM keymaps[_LAYER_MAX][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 77 | [_QWERTY] = LAYOUT( | ||
| 78 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, | ||
| 79 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, | ||
| 80 | MY_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, | ||
| 81 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_BSPC, MO(_ADJUST), | ||
| 82 | TD(TD_LDCTL), MY_GUI, MY_ALT, MY_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | ||
| 83 | ), | ||
| 84 | [_GAME] = LAYOUT( | ||
| 85 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 86 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 87 | KC_LCTL, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 88 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 89 | _______, _______, KC_LALT, KC_SPC, _______, _______, _______, _______, _______ | ||
| 90 | ), | ||
| 91 | [_FUNC] = LAYOUT( | ||
| 92 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, | ||
| 93 | _______, _______, FW_WRD, KB_EOL, _______, _______, KB_COPY, KC_PGUP, _______, _______, KB_PASTE, KC_SLCK, _______, MY_CALC, | ||
| 94 | _______, KB_BOL, _______, KC_PGDN, _______, TD(TD_G), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, | ||
| 95 | _______, _______, KC_DEL, _______, _______, BK_WRD, _______, _______, _______, _______, _______, _______, KC_INS, _______, | ||
| 96 | _______, MY_RGUI, MY_RALT, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END | ||
| 97 | ), | ||
| 98 | [_KP] = LAYOUT( | ||
| 99 | _______, _______, _______, _______, _______, _______, _______, _______, KC_KP_ASTERISK, _______, _______, _______, _______, _______, | ||
| 100 | KC_NUMLOCK, _______, KC_BTN1, KC_MS_U, KC_BTN2, KC_WH_U, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_MINUS, _______, _______, _______, | ||
| 101 | _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, _______, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_PLUS, _______, _______, | ||
| 102 | _______, _______, _______, _______, _______, _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_SLASH, _______, _______, TG(_KP), | ||
| 103 | _______, _______, _______, KC_KP_0, KC_KP_DOT, _______, _______, _______, _______ | ||
| 104 | ), | ||
| 105 | [_ADJUST] = LAYOUT( | ||
| 106 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, | ||
| 107 | _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, _______, _______, KC_PSCR, KC_SLCK, _______, KC_MUTE, | ||
| 108 | _______, RGB_RMOD, RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, TG(_KP), _______, _______, _______, KC_MPLY, | ||
| 109 | _______, RGB_TOG, KB_MAKE, KB_FLSH, KB_VRSN, KB_BOOT, _______, TG_SYS, _______, _______, _______, _______, KC_DEL, _______, | ||
| 110 | _______, MY_RGUI, MY_RALT, _______, _______, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT | ||
| 111 | ), | ||
| 112 | }; | ||
| 113 | |||
| 114 | const rgblight_segment_t PROGMEM game_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 115 | {0, 1, HSV_RED}, | ||
| 116 | {7, 2, HSV_RED}, | ||
| 117 | {15, 1, HSV_RED} | ||
| 118 | ); | ||
| 119 | |||
| 120 | const rgblight_segment_t PROGMEM func_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 121 | {0, 8, HSV_GREEN} | ||
| 122 | ); | ||
| 123 | |||
| 124 | const rgblight_segment_t PROGMEM kp_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 125 | {0, 16, HSV_ORANGE} | ||
| 126 | ); | ||
| 127 | |||
| 128 | const rgblight_segment_t PROGMEM adjust_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 129 | {0, 16, HSV_BLUE} | ||
| 130 | ); | ||
| 131 | |||
| 132 | const rgblight_segment_t PROGMEM capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 133 | {10, 4, HSV_WHITE} | ||
| 134 | ); | ||
| 135 | |||
| 136 | const rgblight_segment_t PROGMEM numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 137 | {0, 2, HSV_PURPLE}, | ||
| 138 | {14, 2, HSV_PURPLE} | ||
| 139 | ); | ||
| 140 | |||
| 141 | |||
| 142 | enum rgb_layer_index { | ||
| 143 | L_GAME, | ||
| 144 | L_FUNC, | ||
| 145 | L_KP, | ||
| 146 | L_ADJUST, | ||
| 147 | L_CAPSLOCK, | ||
| 148 | L_NUMLOCK, | ||
| 149 | }; | ||
| 150 | |||
| 151 | const rgblight_segment_t * const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( | ||
| 152 | [L_GAME] = game_layer, | ||
| 153 | [L_FUNC] = func_layer, | ||
| 154 | [L_KP] = kp_layer, | ||
| 155 | [L_ADJUST] = adjust_layer, | ||
| 156 | [L_CAPSLOCK] = capslock_layer, | ||
| 157 | [L_NUMLOCK] = numlock_layer | ||
| 158 | ); | ||
| 159 | |||
| 160 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
| 161 | rgblight_set_layer_state(L_GAME, layer_state_cmp(state, _GAME)); | ||
| 162 | rgblight_set_layer_state(L_FUNC, layer_state_cmp(state, _FUNC)); | ||
| 163 | rgblight_set_layer_state(L_KP, layer_state_cmp(state, _KP)); | ||
| 164 | rgblight_set_layer_state(L_ADJUST, layer_state_cmp(state, _ADJUST)); | ||
| 165 | rgblight_set_layer_state(L_CAPSLOCK, CAPSLOCK_ON); | ||
| 166 | rgblight_set_layer_state(L_NUMLOCK, NUMLOCK_ON && layer_state_cmp(state, _KP)); | ||
| 167 | if (layer_state_cmp(state, _GAME)) | ||
| 168 | autoshift_disable(); | ||
| 169 | else | ||
| 170 | autoshift_enable(); | ||
| 171 | return state; | ||
| 172 | } | ||
| 173 | |||
| 174 | bool led_update_user(led_t led_state) { | ||
| 175 | rgblight_set_layer_state(L_CAPSLOCK, led_state.caps_lock); | ||
| 176 | rgblight_set_layer_state(L_NUMLOCK, led_state.num_lock && layer_state_is(_KP)); | ||
| 177 | return true; | ||
| 178 | } | ||
| 179 | |||
| 180 | void keyboard_post_init_keymap(void) { | ||
| 181 | rgblight_layers = my_rgb_layers; | ||
| 182 | rgb_was_enabled = rgblight_is_enabled(); | ||
| 183 | } | ||
| 184 | |||
| 185 | LEADER_EXTERNS(); | ||
| 186 | |||
| 187 | void matrix_scan_keymap(void) { | ||
| 188 | if (rgblight_is_enabled() && timer_elapsed(rgb_timer) > 1000) { | ||
| 189 | rgb_idle_seconds++; | ||
| 190 | rgb_timer = timer_read(); | ||
| 191 | } | ||
| 192 | if (rgb_idle_seconds > IDLE_TIMEOUT) { | ||
| 193 | rgb_was_enabled = rgblight_is_enabled(); | ||
| 194 | rgblight_disable_noeeprom(); | ||
| 195 | rgb_idle_seconds = 0; | ||
| 196 | } | ||
| 197 | LEADER_DICTIONARY() { | ||
| 198 | leading = false; | ||
| 199 | leader_end(); | ||
| 200 | |||
| 201 | SEQ_ONE_KEY(KC_K) { | ||
| 202 | layer_invert(_KP); | ||
| 203 | } | ||
| 204 | SEQ_ONE_KEY(KC_G) { | ||
| 205 | layer_invert(_GAME); | ||
| 206 | } | ||
| 207 | SEQ_ONE_KEY(KC_KP_5) { | ||
| 208 | layer_invert(_KP); | ||
| 209 | } | ||
| 210 | SEQ_TWO_KEYS(KC_SCLN, KC_1) { | ||
| 211 | send_secret_string(0); | ||
| 212 | } | ||
| 213 | SEQ_TWO_KEYS(KC_SCLN, KC_2) { | ||
| 214 | send_secret_string(1); | ||
| 215 | } | ||
| 216 | SEQ_TWO_KEYS(KC_SCLN, KC_3) { | ||
| 217 | send_secret_string(2); | ||
| 218 | } | ||
| 219 | SEQ_TWO_KEYS(KC_SCLN, KC_4) { | ||
| 220 | send_secret_string(3); | ||
| 221 | } | ||
| 222 | SEQ_TWO_KEYS(KC_SCLN, KC_5) { | ||
| 223 | send_secret_string(4); | ||
| 224 | } | ||
| 225 | SEQ_TWO_KEYS(KC_SCLN, KC_6) { | ||
| 226 | send_secret_string(5); | ||
| 227 | } | ||
| 228 | SEQ_TWO_KEYS(KC_SCLN, KC_M) { | ||
| 229 | send_secret_string(0); | ||
| 230 | } | ||
| 231 | SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { | ||
| 232 | send_secret_string(1); | ||
| 233 | } | ||
| 234 | SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { | ||
| 235 | send_secret_string(2); | ||
| 236 | } | ||
| 237 | SEQ_TWO_KEYS(KC_SCLN, KC_J) { | ||
| 238 | send_secret_string(3); | ||
| 239 | } | ||
| 240 | SEQ_TWO_KEYS(KC_SCLN, KC_K) { | ||
| 241 | send_secret_string(4); | ||
| 242 | } | ||
| 243 | SEQ_TWO_KEYS(KC_SCLN, KC_L) { | ||
| 244 | send_secret_string(5); | ||
| 245 | } | ||
| 246 | SEQ_ONE_KEY(KC_C) { | ||
| 247 | tap_code16(C(KC_C)); | ||
| 248 | } | ||
| 249 | } | ||
| 250 | } | ||
| 251 | |||
| 252 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 253 | static uint16_t gesc_timer; | ||
| 254 | |||
| 255 | rgb_idle_seconds = 0; | ||
| 256 | if (!rgblight_is_enabled() && rgb_was_enabled) | ||
| 257 | rgblight_enable_noeeprom(); | ||
| 258 | |||
| 259 | switch (keycode) { | ||
| 260 | // custom handle KC_GESC to emulate auto shift on it | ||
| 261 | case KC_GESC: | ||
| 262 | if (get_autoshift_state()) { | ||
| 263 | if (record->event.pressed) | ||
| 264 | gesc_timer = timer_read(); | ||
| 265 | else { | ||
| 266 | if (timer_elapsed(gesc_timer) > AUTO_SHIFT_TIMEOUT || MODS_SHIFT) { | ||
| 267 | tap_code16(S(KC_GRV)); | ||
| 268 | } else if (MODS_GUI) | ||
| 269 | tap_code(KC_GRV); | ||
| 270 | else | ||
| 271 | tap_code(KC_ESC); | ||
| 272 | } | ||
| 273 | return false; | ||
| 274 | } | ||
| 275 | return false; | ||
| 276 | } | ||
| 277 | |||
| 278 | return true; | ||
| 279 | } | ||
diff --git a/keyboards/dz60/keymaps/jdelkins/rules.mk b/keyboards/dz60/keymaps/jdelkins/rules.mk new file mode 100644 index 000000000..b0a4f73dd --- /dev/null +++ b/keyboards/dz60/keymaps/jdelkins/rules.mk | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | LEADER_ENABLE = yes | ||
| 2 | MOUSEKEY_ENABLE = yes | ||
| 3 | CONSOLE_ENABLE = no | ||
| 4 | NKRO_ENABLE = no | ||
| 5 | TAP_DANCE_ENABLE = yes | ||
| 6 | LTO_ENABLE = yes | ||
| 7 | AUTO_SHIFT_ENABLE = yes | ||
diff --git a/keyboards/dz60/keymaps/jdelkins_ss/config.h b/keyboards/dz60/keymaps/jdelkins_ss/config.h new file mode 100644 index 000000000..e023d3452 --- /dev/null +++ b/keyboards/dz60/keymaps/jdelkins_ss/config.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | /* My hhkb variant | ||
| 21 | * ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┐ | ||
| 22 | * │00 │01 │02 │03 │04 │05 │06 │07 │08 │09 │0a │0b │0c │0d │0e │ | ||
| 23 | * ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴───┤ | ||
| 24 | * │10 │12 │13 │14 │15 │16 │17 │18 │19 │1a │1b │1c │1d │1e │ | ||
| 25 | * ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ | ||
| 26 | * │20 │22 │23 │24 │25 │26 │27 │28 │29 │2a │2b │2c │2d │ | ||
| 27 | * ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────┬───┤ | ||
| 28 | * │30 │32 │33 │34 │35 │36 │37 │38 │39 │3a │3b │3d │3e │ | ||
| 29 | * ├────┬───┴┬──┴─┬─┴───┴──┬┴───┼───┴───┴──┬┴──┬┴──┬┴──┬───┼───┤ | ||
| 30 | * │40 │41 │43 │44 │46 │48 │4a │4b │4c │4d │4e │ | ||
| 31 | * └────┴────┴────┴────────┴────┴──────────┴───┴───┴───┴───┴───┘ | ||
| 32 | */ | ||
| 33 | |||
| 34 | #define LAYOUT_hhkb_split( \ | ||
| 35 | k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e, \ | ||
| 36 | k10, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e, \ | ||
| 37 | k20, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, \ | ||
| 38 | k30, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, k3d, k3e, \ | ||
| 39 | k40, k41, k43, k44, k46, k48, k4a, k4b, k4c, k4d, k4e \ | ||
| 40 | ) { \ | ||
| 41 | { k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, k0d, k0e }, \ | ||
| 42 | { k10, KC_NO, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k1c, k1d, k1e }, \ | ||
| 43 | { k20, KC_NO, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k2c, k2d, KC_NO }, \ | ||
| 44 | { k30, KC_NO, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, KC_NO, k3d, k3e }, \ | ||
| 45 | { k40, k41, KC_NO, k43, k44, KC_NO, k46, KC_NO, k48, KC_NO, k4a, k4b, k4c, k4d, k4e } \ | ||
| 46 | } | ||
| 47 | |||
| 48 | #define AUTO_SHIFT_TIMEOUT 165 | ||
| 49 | #define RGBLIGHT_LAYERS | ||
| 50 | #define LEADER_TIMEOUT 400 | ||
| 51 | #define LEADER_PER_KEY_TIMING | ||
diff --git a/keyboards/dz60/keymaps/jdelkins_ss/keymap.c b/keyboards/dz60/keymaps/jdelkins_ss/keymap.c new file mode 100644 index 000000000..2744c4372 --- /dev/null +++ b/keyboards/dz60/keymaps/jdelkins_ss/keymap.c | |||
| @@ -0,0 +1,367 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "jdelkins.h" | ||
| 19 | |||
| 20 | #undef LAYOUT | ||
| 21 | #define LAYOUT LAYOUT_hhkb_split | ||
| 22 | |||
| 23 | #define IDLE_TIMEOUT 360 | ||
| 24 | uint16_t rgb_idle_seconds = 0; | ||
| 25 | uint16_t rgb_timer; | ||
| 26 | uint16_t bspc_timer; | ||
| 27 | bool rgb_was_enabled; | ||
| 28 | |||
| 29 | enum { | ||
| 30 | MY_BSPC = USER_SAFE_RANGE, | ||
| 31 | }; | ||
| 32 | |||
| 33 | // Tap Dance | ||
| 34 | |||
| 35 | int ctl_state = 0; | ||
| 36 | |||
| 37 | void ctl_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 38 | ctl_state = cur_dance(state); | ||
| 39 | switch (ctl_state) { | ||
| 40 | case SINGLE_TAP: qk_leader_start(); break; | ||
| 41 | case SINGLE_HOLD: register_code(KC_LCTL); break; | ||
| 42 | case DOUBLE_TAP: tap_code(KC_RCTL); break; | ||
| 43 | case DOUBLE_HOLD: register_code(KC_RCTL); break; | ||
| 44 | case TRIPLE_TAP: tap_code(KC_RCTL); tap_code(KC_RCTL); break; | ||
| 45 | case TRIPLE_HOLD: tap_code(KC_RCTL); register_code(KC_RCTL); break; | ||
| 46 | } | ||
| 47 | } | ||
| 48 | |||
| 49 | void ctl_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 50 | switch (ctl_state) { | ||
| 51 | case SINGLE_HOLD: unregister_code(KC_LCTL); break; | ||
| 52 | case DOUBLE_HOLD: | ||
| 53 | case TRIPLE_HOLD: unregister_code(KC_RCTL); break; | ||
| 54 | } | ||
| 55 | ctl_state = 0; | ||
| 56 | } | ||
| 57 | |||
| 58 | void g_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 59 | switch (cur_dance(state)) { | ||
| 60 | case SINGLE_TAP: | ||
| 61 | tap_code16(C(KC_END)); | ||
| 62 | break; | ||
| 63 | case DOUBLE_TAP: | ||
| 64 | tap_code16(C(KC_HOME)); | ||
| 65 | break; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | |||
| 69 | int kp_state = 0; | ||
| 70 | |||
| 71 | void kp_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 72 | kp_state = hold_cur_dance(state); | ||
| 73 | switch (kp_state) { | ||
| 74 | case SINGLE_TAP: | ||
| 75 | tap_code(KC_SPC); | ||
| 76 | break; | ||
| 77 | default: | ||
| 78 | layer_invert(_KP); | ||
| 79 | break; | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | void kp_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 84 | switch (kp_state) { | ||
| 85 | case SINGLE_HOLD: | ||
| 86 | case DOUBLE_HOLD: | ||
| 87 | case TRIPLE_HOLD: | ||
| 88 | layer_invert(_KP); | ||
| 89 | break; | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | enum { | ||
| 94 | TD_LDCTL, | ||
| 95 | TD_G, | ||
| 96 | TD_KP, | ||
| 97 | }; | ||
| 98 | |||
| 99 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 100 | [TD_LDCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_finished, ctl_reset), | ||
| 101 | [TD_G] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, g_finished, NULL), | ||
| 102 | [TD_KP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, kp_finished, kp_reset), | ||
| 103 | }; | ||
| 104 | |||
| 105 | // Layers | ||
| 106 | |||
| 107 | const uint16_t PROGMEM keymaps[_LAYER_MAX][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 108 | [_QWERTY] = LAYOUT( | ||
| 109 | KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_GRV, | ||
| 110 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, | ||
| 111 | MY_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, | ||
| 112 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, MO(_ADJUST), | ||
| 113 | TD(TD_LDCTL), MY_GUI, MY_ALT, MY_BSPC, TD(TD_KP), MY_SPC, KC_RALT, KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT | ||
| 114 | ), | ||
| 115 | [_RPT] = LAYOUT( | ||
| 116 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 117 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 118 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 119 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 120 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 121 | ), | ||
| 122 | [_GAME] = LAYOUT( | ||
| 123 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 124 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 125 | KC_LCTL, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 126 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 127 | _______, _______, KC_LALT, KC_SPC, KC_LALT, _______, _______, _______, _______, _______, _______ | ||
| 128 | ), | ||
| 129 | [_FUNC] = LAYOUT( | ||
| 130 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_F13, | ||
| 131 | _______, _______, FW_WRD, KB_EOL, TG(_RPT), _______, KB_COPY, KC_PGUP, _______, _______, KB_PASTE, KC_SLCK, _______, MY_CALC, | ||
| 132 | _______, KB_BOL, _______, KC_PGDN, _______, TD(TD_G), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, | ||
| 133 | _______, _______, KC_DEL, _______, _______, BK_WRD, _______, _______, _______, _______, _______, _______, KC_NO, | ||
| 134 | _______, MY_RGUI, MY_RALT, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END | ||
| 135 | ), | ||
| 136 | [_KP] = LAYOUT( | ||
| 137 | _______, _______, _______, _______, _______, _______, _______, _______, KC_KP_ASTERISK, _______, _______, _______, _______, _______, _______, | ||
| 138 | KC_NUMLOCK, _______, KC_BTN1, KC_MS_U, KC_BTN2, KC_WH_U, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_MINUS, _______, _______, _______, | ||
| 139 | _______, _______, KC_MS_L, KC_MS_D, KC_MS_R, KC_WH_D, _______, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_PLUS, _______, _______, | ||
| 140 | _______, _______, _______, _______, _______, _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_SLASH, _______, TG(_KP), | ||
| 141 | _______, _______, _______, _______, _______, KC_KP_0, KC_KP_DOT, _______, _______, _______, _______ | ||
| 142 | ), | ||
| 143 | [_ADJUST] = LAYOUT( | ||
| 144 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_F13, | ||
| 145 | _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, _______, _______, KC_PSCR, KC_SLCK, _______, KC_MUTE, | ||
| 146 | _______, RGB_RMOD, RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, TG(_KP), _______, _______, _______, KC_MPLY, | ||
| 147 | _______, RGB_TOG, KB_MAKE, KB_FLSH, KB_VRSN, KB_BOOT, _______, TG_SYS, _______, _______, _______, _______, _______, | ||
| 148 | _______, MY_RGUI, MY_RALT, KC_DEL, _______, _______, _______, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT | ||
| 149 | ), | ||
| 150 | }; | ||
| 151 | |||
| 152 | const rgblight_segment_t PROGMEM rpt_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 153 | {8, 8, HSV_PINK} | ||
| 154 | ); | ||
| 155 | |||
| 156 | const rgblight_segment_t PROGMEM game_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 157 | {0, 1, HSV_RED}, | ||
| 158 | {7, 2, HSV_RED}, | ||
| 159 | {15, 1, HSV_RED} | ||
| 160 | ); | ||
| 161 | |||
| 162 | const rgblight_segment_t PROGMEM func_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 163 | {0, 8, HSV_GREEN} | ||
| 164 | ); | ||
| 165 | |||
| 166 | const rgblight_segment_t PROGMEM kp_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 167 | {0, 16, HSV_ORANGE} | ||
| 168 | ); | ||
| 169 | |||
| 170 | const rgblight_segment_t PROGMEM adjust_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 171 | {0, 16, HSV_BLUE} | ||
| 172 | ); | ||
| 173 | |||
| 174 | const rgblight_segment_t PROGMEM capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 175 | {10, 4, HSV_WHITE} | ||
| 176 | ); | ||
| 177 | |||
| 178 | const rgblight_segment_t PROGMEM numlock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 179 | {0, 2, HSV_PURPLE}, | ||
| 180 | {14, 2, HSV_PURPLE} | ||
| 181 | ); | ||
| 182 | |||
| 183 | |||
| 184 | enum rgb_layer_index { | ||
| 185 | L_RPT, | ||
| 186 | L_GAME, | ||
| 187 | L_FUNC, | ||
| 188 | L_KP, | ||
| 189 | L_ADJUST, | ||
| 190 | L_CAPSLOCK, | ||
| 191 | L_NUMLOCK, | ||
| 192 | }; | ||
| 193 | |||
| 194 | const rgblight_segment_t * const PROGMEM my_rgb_layers[] = RGBLIGHT_LAYERS_LIST( | ||
| 195 | [L_RPT] = rpt_layer, | ||
| 196 | [L_GAME] = game_layer, | ||
| 197 | [L_FUNC] = func_layer, | ||
| 198 | [L_KP] = kp_layer, | ||
| 199 | [L_ADJUST] = adjust_layer, | ||
| 200 | [L_CAPSLOCK] = capslock_layer, | ||
| 201 | [L_NUMLOCK] = numlock_layer | ||
| 202 | ); | ||
| 203 | |||
| 204 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
| 205 | rgblight_set_layer_state(L_RPT, layer_state_cmp(state, _RPT)); | ||
| 206 | rgblight_set_layer_state(L_GAME, layer_state_cmp(state, _GAME)); | ||
| 207 | rgblight_set_layer_state(L_FUNC, layer_state_cmp(state, _FUNC)); | ||
| 208 | rgblight_set_layer_state(L_KP, layer_state_cmp(state, _KP)); | ||
| 209 | rgblight_set_layer_state(L_ADJUST, layer_state_cmp(state, _ADJUST)); | ||
| 210 | rgblight_set_layer_state(L_CAPSLOCK, CAPSLOCK_ON); | ||
| 211 | rgblight_set_layer_state(L_NUMLOCK, NUMLOCK_ON && layer_state_cmp(state, _KP)); | ||
| 212 | if (layer_state_cmp(state, _GAME) || layer_state_cmp(state, _RPT)) | ||
| 213 | autoshift_disable(); | ||
| 214 | else | ||
| 215 | autoshift_enable(); | ||
| 216 | return state; | ||
| 217 | } | ||
| 218 | |||
| 219 | bool led_update_user(led_t led_state) { | ||
| 220 | rgblight_set_layer_state(L_CAPSLOCK, led_state.caps_lock); | ||
| 221 | rgblight_set_layer_state(L_NUMLOCK, led_state.num_lock && layer_state_is(_KP)); | ||
| 222 | return true; | ||
| 223 | } | ||
| 224 | |||
| 225 | void keyboard_post_init_keymap(void) { | ||
| 226 | rgblight_layers = my_rgb_layers; | ||
| 227 | rgb_was_enabled = rgblight_is_enabled(); | ||
| 228 | bspc_timer = 0; | ||
| 229 | } | ||
| 230 | |||
| 231 | LEADER_EXTERNS(); | ||
| 232 | |||
| 233 | void matrix_scan_keymap(void) { | ||
| 234 | if (rgblight_is_enabled() && timer_elapsed(rgb_timer) > 1000) { | ||
| 235 | rgb_idle_seconds++; | ||
| 236 | rgb_timer = timer_read(); | ||
| 237 | } | ||
| 238 | if (rgb_idle_seconds > IDLE_TIMEOUT) { | ||
| 239 | rgb_was_enabled = rgblight_is_enabled(); | ||
| 240 | rgblight_disable_noeeprom(); | ||
| 241 | rgb_idle_seconds = 0; | ||
| 242 | } | ||
| 243 | // if MY_BSPC is held down too long, pretend like it wasn't and start | ||
| 244 | // pressing backspace | ||
| 245 | if (bspc_timer > 0 && timer_elapsed(bspc_timer) > LEADER_TIMEOUT) { | ||
| 246 | layer_off(_FUNC); | ||
| 247 | bspc_timer = 0; | ||
| 248 | register_code(KC_BSPC); | ||
| 249 | } | ||
| 250 | LEADER_DICTIONARY() { | ||
| 251 | leading = false; | ||
| 252 | leader_end(); | ||
| 253 | |||
| 254 | SEQ_ONE_KEY(KC_R) { | ||
| 255 | layer_invert(_RPT); | ||
| 256 | } | ||
| 257 | SEQ_ONE_KEY(KC_G) { | ||
| 258 | layer_invert(_GAME); | ||
| 259 | } | ||
| 260 | SEQ_ONE_KEY(KC_K) { | ||
| 261 | layer_invert(_KP); | ||
| 262 | } | ||
| 263 | SEQ_ONE_KEY(KC_KP_5) { | ||
| 264 | layer_invert(_KP); | ||
| 265 | } | ||
| 266 | SEQ_TWO_KEYS(KC_SCLN, KC_1) { | ||
| 267 | send_secret_string(0); | ||
| 268 | } | ||
| 269 | SEQ_TWO_KEYS(KC_SCLN, KC_2) { | ||
| 270 | send_secret_string(1); | ||
| 271 | } | ||
| 272 | SEQ_TWO_KEYS(KC_SCLN, KC_3) { | ||
| 273 | send_secret_string(2); | ||
| 274 | } | ||
| 275 | SEQ_TWO_KEYS(KC_SCLN, KC_4) { | ||
| 276 | send_secret_string(3); | ||
| 277 | } | ||
| 278 | SEQ_TWO_KEYS(KC_SCLN, KC_5) { | ||
| 279 | send_secret_string(4); | ||
| 280 | } | ||
| 281 | SEQ_TWO_KEYS(KC_SCLN, KC_6) { | ||
| 282 | send_secret_string(5); | ||
| 283 | } | ||
| 284 | SEQ_TWO_KEYS(KC_SCLN, KC_M) { | ||
| 285 | send_secret_string(0); | ||
| 286 | } | ||
| 287 | SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { | ||
| 288 | send_secret_string(1); | ||
| 289 | } | ||
| 290 | SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { | ||
| 291 | send_secret_string(2); | ||
| 292 | } | ||
| 293 | SEQ_TWO_KEYS(KC_SCLN, KC_J) { | ||
| 294 | send_secret_string(3); | ||
| 295 | } | ||
| 296 | SEQ_TWO_KEYS(KC_SCLN, KC_K) { | ||
| 297 | send_secret_string(4); | ||
| 298 | } | ||
| 299 | SEQ_TWO_KEYS(KC_SCLN, KC_L) { | ||
| 300 | send_secret_string(5); | ||
| 301 | } | ||
| 302 | SEQ_ONE_KEY(KC_C) { | ||
| 303 | tap_code16(C(KC_C)); | ||
| 304 | } | ||
| 305 | } | ||
| 306 | } | ||
| 307 | |||
| 308 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 309 | static bool bspc_del = false; | ||
| 310 | static bool bspc_initiated_func = false; | ||
| 311 | bool rc = true; | ||
| 312 | |||
| 313 | rgb_idle_seconds = 0; | ||
| 314 | if (!rgblight_is_enabled() && rgb_was_enabled) | ||
| 315 | rgblight_enable_noeeprom(); | ||
| 316 | |||
| 317 | switch (keycode) { | ||
| 318 | case MY_BSPC: | ||
| 319 | if (record->event.pressed) { | ||
| 320 | if (IS_LAYER_ON(_FUNC)) { | ||
| 321 | // special case: if _FUNC was turned on by another key, | ||
| 322 | // treat this as KC_DEL and don't do anything else | ||
| 323 | bspc_del = true; | ||
| 324 | register_code(KC_DEL); | ||
| 325 | return false; | ||
| 326 | } else { | ||
| 327 | bspc_timer = timer_read(); | ||
| 328 | bspc_initiated_func = true; | ||
| 329 | layer_on(_FUNC); | ||
| 330 | } | ||
| 331 | } else { | ||
| 332 | if (bspc_del) { | ||
| 333 | // special case: if _FUNC was turned on by another key, | ||
| 334 | // treat this as KC_DEL and don't do anything else | ||
| 335 | unregister_code(KC_DEL); | ||
| 336 | bspc_del = false; | ||
| 337 | return false; | ||
| 338 | } | ||
| 339 | |||
| 340 | if (bspc_initiated_func) { | ||
| 341 | layer_off(_FUNC); | ||
| 342 | bspc_initiated_func = false; | ||
| 343 | } | ||
| 344 | |||
| 345 | if (bspc_timer > 0) { | ||
| 346 | // here the key was pressed and released before the timer | ||
| 347 | // expired, so treat as a backspace tap and pretend we | ||
| 348 | // never activated _FUNC | ||
| 349 | bspc_timer = 0; | ||
| 350 | tap_code(KC_BSPC); | ||
| 351 | } else { | ||
| 352 | // the timer went off, so KC_BSPC was registered in | ||
| 353 | // matrix_scan_keymap. unregister it now | ||
| 354 | unregister_code(KC_BSPC); | ||
| 355 | } | ||
| 356 | } | ||
| 357 | return false; // special case, return now without resetting timer | ||
| 358 | // other paths should set rc and break | ||
| 359 | break; | ||
| 360 | } | ||
| 361 | |||
| 362 | // if something was pressed while MY_BSPC was held down, keep it pressed by | ||
| 363 | // disabling the timer | ||
| 364 | bspc_timer = 0; | ||
| 365 | return rc; | ||
| 366 | } | ||
| 367 | |||
diff --git a/keyboards/dz60/keymaps/jdelkins_ss/rules.mk b/keyboards/dz60/keymaps/jdelkins_ss/rules.mk new file mode 100644 index 000000000..49346a80e --- /dev/null +++ b/keyboards/dz60/keymaps/jdelkins_ss/rules.mk | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | LEADER_ENABLE = yes | ||
| 2 | MOUSEKEY_ENABLE = yes | ||
| 3 | CONSOLE_ENABLE = no | ||
| 4 | NKRO_ENABLE = no | ||
| 5 | TAP_DANCE_ENABLE = yes | ||
| 6 | AUTO_SHIFT_ENABLE = yes | ||
| 7 | LTO_ENABLE = yes | ||
| 8 | USER_NAME := jdelkins | ||
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins/config.h b/keyboards/massdrop/alt/keymaps/jdelkins/config.h new file mode 100644 index 000000000..29c35ccc5 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/jdelkins/config.h | |||
| @@ -0,0 +1,23 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | #define RGB_MATRIX_STARTUP_SPD 20 | ||
| 21 | #define AUTO_SHIFT_TIMEOUT 160 | ||
| 22 | #define LEADER_TIMEOUT 400 | ||
| 23 | #define LEADER_PER_KEY_TIMING | ||
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c b/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c new file mode 100644 index 000000000..967c1570d --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/jdelkins/keymap.c | |||
| @@ -0,0 +1,504 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "jdelkins.h" | ||
| 19 | #include "print.h" | ||
| 20 | |||
| 21 | // Idle handling | ||
| 22 | |||
| 23 | #define IDLE_TIMEOUT 360 | ||
| 24 | #define _LAYERS _RPT | ||
| 25 | |||
| 26 | uint16_t rgb_idle_seconds = 0; | ||
| 27 | uint16_t rgb_timer; | ||
| 28 | uint8_t save_layer; | ||
| 29 | |||
| 30 | // Macro keycodes | ||
| 31 | |||
| 32 | enum alt_keycodes { | ||
| 33 | U_T_AUTO = USER_SAFE_RANGE, //USB Extra Port Toggle Auto Detect / Always Active | ||
| 34 | U_T_AGCR, //USB Toggle Automatic GCR control | ||
| 35 | DBG_TOG, //DEBUG Toggle On / Off | ||
| 36 | DBG_MTRX, //DEBUG Toggle Matrix Prints | ||
| 37 | DBG_KBD, //DEBUG Toggle Keyboard Prints | ||
| 38 | DBG_MOU, //DEBUG Toggle Mouse Prints | ||
| 39 | }; | ||
| 40 | |||
| 41 | // Tap Dance | ||
| 42 | |||
| 43 | int ctl_state = 0; | ||
| 44 | |||
| 45 | void ctl_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 46 | ctl_state = cur_dance(state); | ||
| 47 | switch(ctl_state) { | ||
| 48 | case SINGLE_TAP: qk_leader_start(); break; | ||
| 49 | case SINGLE_HOLD: register_code(KC_LCTL); break; | ||
| 50 | case DOUBLE_TAP: tap_code(KC_RCTL); break; | ||
| 51 | case DOUBLE_HOLD: register_code(KC_RCTL); break; | ||
| 52 | case TRIPLE_TAP: tap_code(KC_RCTL); tap_code(KC_RCTL); break; | ||
| 53 | case TRIPLE_HOLD: tap_code(KC_RCTL); register_code(KC_RCTL); break; | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | void ctl_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 58 | switch(ctl_state) { | ||
| 59 | case SINGLE_HOLD: unregister_code(KC_LCTL); break; | ||
| 60 | case DOUBLE_HOLD: | ||
| 61 | case TRIPLE_HOLD: unregister_code(KC_RCTL); break; | ||
| 62 | } | ||
| 63 | ctl_state = 0; | ||
| 64 | } | ||
| 65 | |||
| 66 | void g_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 67 | switch (cur_dance(state)) { | ||
| 68 | case SINGLE_TAP: | ||
| 69 | tap_code16(C(KC_END)); | ||
| 70 | break; | ||
| 71 | case DOUBLE_TAP: | ||
| 72 | tap_code16(C(KC_HOME)); | ||
| 73 | break; | ||
| 74 | } | ||
| 75 | } | ||
| 76 | |||
| 77 | enum { | ||
| 78 | TD_LDCTL, | ||
| 79 | TD_GUI, | ||
| 80 | TD_G, | ||
| 81 | }; | ||
| 82 | |||
| 83 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 84 | [TD_LDCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_finished, ctl_reset), | ||
| 85 | [TD_GUI] = ACTION_TAP_DANCE_DOUBLE(KC_LGUI, KC_RGUI), | ||
| 86 | [TD_G] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, g_finished, NULL), | ||
| 87 | }; | ||
| 88 | |||
| 89 | // Layers | ||
| 90 | |||
| 91 | const uint16_t PROGMEM keymaps[_LAYER_MAX][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 92 | [_QWERTY] = LAYOUT( | ||
| 93 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, | ||
| 94 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, | ||
| 95 | MY_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, | ||
| 96 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, | ||
| 97 | TD(TD_LDCTL), TD(TD_GUI), KC_LALT, MY_SPC, KC_RALT, MO(_ADJUST),KC_LEFT, KC_DOWN, KC_RGHT | ||
| 98 | ), | ||
| 99 | [_GAME] = LAYOUT( | ||
| 100 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 101 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 102 | KC_LCTL, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 103 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 104 | _______, KC_NO, _______, KC_SPC, _______, _______, _______, _______, _______ | ||
| 105 | ), | ||
| 106 | [_FUNC] = LAYOUT( | ||
| 107 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_INS, | ||
| 108 | _______, _______, FW_WRD, KC_END, _______, _______, C(KC_INS),KC_PGUP, _______, _______, S(KC_INS),KC_SLCK, KC_PAUS, KC_CALC, KC_END, | ||
| 109 | _______, KC_HOME, _______, KC_PGDN, _______, TD(TD_G), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, _______, _______, _______, | ||
| 110 | _______, _______, KC_DEL, _______, _______, BK_WRD, _______, _______, _______, _______, _______, _______, KC_PGUP, _______, | ||
| 111 | _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_END | ||
| 112 | ), | ||
| 113 | [_LAYERS] = LAYOUT( | ||
| 114 | KC_NO, TO(_QWERTY),TO(_GAME), KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 115 | KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 116 | KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 117 | KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 118 | KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, _______, KC_NO, KC_NO, KC_NO | ||
| 119 | ), | ||
| 120 | [_KP] = LAYOUT( | ||
| 121 | _______, _______, _______, _______, _______, _______, _______, _______, KC_KP_ASTERISK, _______, _______, _______, _______, _______, _______, | ||
| 122 | KC_NUMLOCK, KC_KP_7, KC_KP_8, KC_KP_9, _______, _______, _______, KC_KP_7, KC_KP_8, KC_KP_9, KC_KP_MINUS, _______, _______, _______, _______, | ||
| 123 | _______, KC_KP_4, KC_KP_5, KC_KP_6, _______, _______, _______, KC_KP_4, KC_KP_5, KC_KP_6, KC_KP_PLUS, _______, _______, _______, | ||
| 124 | _______, KC_KP_1, KC_KP_2, KC_KP_3, _______, _______, _______, KC_KP_1, KC_KP_2, KC_KP_3, KC_KP_SLASH, _______, _______, _______, | ||
| 125 | _______, _______, _______, KC_KP_0, KC_KP_DOT, TG(_KP), _______, _______, _______ | ||
| 126 | ), | ||
| 127 | [_SECRETS] = LAYOUT( | ||
| 128 | KC_NO, KC_SEC1, KC_SEC2, KC_SEC3, KC_SEC4, KC_SEC5, KC_SEC6, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 129 | KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 130 | KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 131 | KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, | ||
| 132 | KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, _______, KC_NO, KC_NO, KC_NO | ||
| 133 | ), | ||
| 134 | [_ADJUST] = LAYOUT( | ||
| 135 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, KC_INS, | ||
| 136 | _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, U_T_AUTO,U_T_AGCR,_______, KC_PSCR, KC_SLCK, KC_PAUS, KC_CALC, KC_END, | ||
| 137 | _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, TG(_KP), OSL(_LAYERS), OSL(_SECRETS), _______, _______, KC_MPLY, | ||
| 138 | _______, RGB_TOG, KB_MAKE, KB_FLSH, KB_VRSN, KB_BOOT, NK_TOGG, DBG_TOG, _______, _______, _______, _______, KC_VOLU, KC_MUTE, | ||
| 139 | _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT | ||
| 140 | ), | ||
| 141 | /* | ||
| 142 | [X] = LAYOUT( | ||
| 143 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 144 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 145 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 146 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 147 | _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 148 | ), | ||
| 149 | */ | ||
| 150 | }; | ||
| 151 | |||
| 152 | #ifdef _______ | ||
| 153 | #undef _______ | ||
| 154 | #endif | ||
| 155 | |||
| 156 | #define RGB_NULL 254, 254, 254 | ||
| 157 | #define RGB_IS_NULL(rgb) ((rgb).r == 254 && (rgb).g == 254 && (rgb).b == 254) | ||
| 158 | |||
| 159 | #define DEFAULT_HSV 255, 255, 128 | ||
| 160 | #define R(COL) { RGB_ ## COL } | ||
| 161 | #define _______ R(NULL) | ||
| 162 | #define xxxxxxx R(BLACK) | ||
| 163 | |||
| 164 | struct layer_rgb PROGMEM rgbs[_LAYER_MAX] = { | ||
| 165 | [_QWERTY] = LAYOUT_hsv(LED_FLAG_ALL, RGB_MATRIX_CYCLE_ALL, DEFAULT_HSV), | ||
| 166 | [_GAME] = LAYOUT_hsv(LED_FLAG_KEYLIGHT, RGB_MATRIX_SOLID_COLOR, DEFAULT_HSV), | ||
| 167 | [_FUNC] = LAYOUT_rgb(LED_FLAG_KEYLIGHT, RGB_LINK_TO_LAYER(_QWERTY), | ||
| 168 | R(BLUE), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(BLUE), | ||
| 169 | R(BLUE), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, R(BLUE), | ||
| 170 | R(BLUE), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, R(BLUE), | ||
| 171 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 172 | R(BLUE), _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, R(BLUE), | ||
| 173 | R(BLUE), _______, _______, _______, _______, _______, _______, _______, _______, _______, R(BLUE), | ||
| 174 | R(BLUE), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(RED), R(BLUE) | ||
| 175 | ), | ||
| 176 | [_LAYERS] = LAYOUT_rgb(LED_FLAG_NONE, RGB_MATRIX_SOLID_COLOR, | ||
| 177 | R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), | ||
| 178 | R(CYAN), xxxxxxx, R(RED), R(GREEN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(CYAN), | ||
| 179 | R(CYAN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(CYAN), | ||
| 180 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 181 | R(CYAN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(CYAN), | ||
| 182 | R(CYAN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(CYAN), | ||
| 183 | R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN), R(CYAN) | ||
| 184 | ), | ||
| 185 | [_KP] = LAYOUT_rgb(LED_FLAG_NONE, RGB_MATRIX_SOLID_COLOR, | ||
| 186 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 187 | xxxxxxx, R(GREEN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(YELLOW),xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 188 | xxxxxxx, xxxxxxx, R(WHITE), R(WHITE), R(WHITE), xxxxxxx, xxxxxxx, xxxxxxx, R(WHITE), R(WHITE), R(WHITE), R(YELLOW), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 189 | xxxxxxx, R(WHITE), R(WHITE), R(WHITE), xxxxxxx, xxxxxxx, xxxxxxx, R(WHITE), R(WHITE), R(WHITE), R(YELLOW), xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 190 | xxxxxxx, xxxxxxx, R(WHITE), R(WHITE), R(WHITE), xxxxxxx, xxxxxxx, xxxxxxx, R(WHITE), R(WHITE), R(WHITE), R(YELLOW), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 191 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(WHITE), R(YELLOW), R(GREEN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 192 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx | ||
| 193 | ), | ||
| 194 | [_SECRETS] = LAYOUT_rgb(LED_FLAG_NONE, RGB_MATRIX_SOLID_COLOR, | ||
| 195 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 196 | xxxxxxx, xxxxxxx, R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 197 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 198 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 199 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 200 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 201 | xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx | ||
| 202 | ), | ||
| 203 | [_ADJUST] = LAYOUT_rgb(LED_FLAG_NONE, RGB_MATRIX_SOLID_COLOR, | ||
| 204 | R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), | ||
| 205 | R(GREEN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(GREEN), | ||
| 206 | R(GREEN), xxxxxxx, R(BLUE), R(YELLOW), R(BLUE), R(GREEN), R(ORANGE),xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(GREEN), | ||
| 207 | xxxxxxx, R(MAGENTA),R(YELLOW), R(MAGENTA),R(GREEN),R(ORANGE),xxxxxxx, xxxxxxx, R(CORAL), R(CORAL), R(CORAL), xxxxxxx, xxxxxxx, xxxxxxx, | ||
| 208 | R(GREEN), xxxxxxx, R(WHITE), R(CYAN), R(CYAN), R(CYAN), R(CYAN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(GREEN), | ||
| 209 | R(GREEN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(GREEN), | ||
| 210 | R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN) | ||
| 211 | ), | ||
| 212 | /* | ||
| 213 | [X] = LAYOUT_rgb( | ||
| 214 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 215 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 216 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 217 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 218 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 219 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 220 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 221 | ), | ||
| 222 | */ | ||
| 223 | }; | ||
| 224 | |||
| 225 | #undef _______ | ||
| 226 | #define _______ KC_TRANS | ||
| 227 | |||
| 228 | static void set_rgb_layer(int layer) { | ||
| 229 | const struct layer_rgb *cur = &rgbs[layer]; | ||
| 230 | |||
| 231 | switch (cur->type) { | ||
| 232 | case type_hsv: | ||
| 233 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL ; i++) { | ||
| 234 | if (!(g_led_config.flags[i] & cur->flags)) | ||
| 235 | rgb_matrix_set_color(i, 0, 0, 0); | ||
| 236 | } | ||
| 237 | rgb_matrix_set_flags(cur->flags); | ||
| 238 | if (cur->mode >= RGB_MATRIX_EFFECT_MAX) | ||
| 239 | rgb_matrix_mode_noeeprom(rgbs[cur->mode - RGB_MATRIX_EFFECT_MAX].mode); | ||
| 240 | else | ||
| 241 | rgb_matrix_mode_noeeprom(cur->mode); | ||
| 242 | rgb_matrix_sethsv_noeeprom(cur->hsv.h, cur->hsv.s, cur->hsv.v); | ||
| 243 | break; | ||
| 244 | case type_rgb: | ||
| 245 | rgb_matrix_set_flags(cur->flags); | ||
| 246 | if (cur->mode >= RGB_MATRIX_EFFECT_MAX) | ||
| 247 | rgb_matrix_mode_noeeprom(rgbs[cur->mode - RGB_MATRIX_EFFECT_MAX].mode); | ||
| 248 | else | ||
| 249 | rgb_matrix_mode_noeeprom(cur->mode); | ||
| 250 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { | ||
| 251 | const RGB *m = &cur->rgb[i]; | ||
| 252 | if (!RGB_IS_NULL(*m)) | ||
| 253 | rgb_matrix_set_color(i, m->r, m->g, m->b); | ||
| 254 | } | ||
| 255 | break; | ||
| 256 | } | ||
| 257 | } | ||
| 258 | |||
| 259 | // Runs just one time when the keyboard initializes. | ||
| 260 | void matrix_init_keymap(void) { | ||
| 261 | // force numlock on upon startup | ||
| 262 | if (!NUMLOCK_ON) { | ||
| 263 | tap_code(KC_NUMLOCK); | ||
| 264 | } | ||
| 265 | }; | ||
| 266 | |||
| 267 | LEADER_EXTERNS(); | ||
| 268 | |||
| 269 | // Runs constantly in the background, in a loop. | ||
| 270 | void matrix_scan_keymap(void) { | ||
| 271 | if (rgb_matrix_get_flags() != LED_FLAG_NONE && timer_elapsed(rgb_timer) > 1000) { | ||
| 272 | rgb_idle_seconds++; | ||
| 273 | rgb_timer = timer_read(); | ||
| 274 | } | ||
| 275 | if (rgb_idle_seconds > IDLE_TIMEOUT) { | ||
| 276 | rgb_matrix_disable_noeeprom(); | ||
| 277 | rgb_idle_seconds = 0; | ||
| 278 | } | ||
| 279 | if (IS_LAYER_ON(_KP)) { | ||
| 280 | if (NUMLOCK_ON) | ||
| 281 | rgb_matrix_set_color(15, RGB_GOLD); | ||
| 282 | else | ||
| 283 | rgb_matrix_set_color(15, 0, 0, 0); | ||
| 284 | } | ||
| 285 | LEADER_DICTIONARY() { | ||
| 286 | leading = false; | ||
| 287 | leader_end(); | ||
| 288 | |||
| 289 | SEQ_ONE_KEY(KC_K) { | ||
| 290 | layer_invert(_KP); | ||
| 291 | } | ||
| 292 | SEQ_ONE_KEY(KC_G) { | ||
| 293 | layer_invert(_GAME); | ||
| 294 | } | ||
| 295 | SEQ_ONE_KEY(KC_KP_5) { | ||
| 296 | layer_invert(_KP); | ||
| 297 | } | ||
| 298 | SEQ_TWO_KEYS(KC_SCLN, KC_1) { | ||
| 299 | send_secret_string(0); | ||
| 300 | } | ||
| 301 | SEQ_TWO_KEYS(KC_SCLN, KC_2) { | ||
| 302 | send_secret_string(1); | ||
| 303 | } | ||
| 304 | SEQ_TWO_KEYS(KC_SCLN, KC_3) { | ||
| 305 | send_secret_string(2); | ||
| 306 | } | ||
| 307 | SEQ_TWO_KEYS(KC_SCLN, KC_4) { | ||
| 308 | send_secret_string(3); | ||
| 309 | } | ||
| 310 | SEQ_TWO_KEYS(KC_SCLN, KC_5) { | ||
| 311 | send_secret_string(4); | ||
| 312 | } | ||
| 313 | SEQ_TWO_KEYS(KC_SCLN, KC_6) { | ||
| 314 | send_secret_string(5); | ||
| 315 | } | ||
| 316 | SEQ_TWO_KEYS(KC_SCLN, KC_M) { | ||
| 317 | send_secret_string(0); | ||
| 318 | } | ||
| 319 | SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { | ||
| 320 | send_secret_string(1); | ||
| 321 | } | ||
| 322 | SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { | ||
| 323 | send_secret_string(2); | ||
| 324 | } | ||
| 325 | SEQ_TWO_KEYS(KC_SCLN, KC_J) { | ||
| 326 | send_secret_string(3); | ||
| 327 | } | ||
| 328 | SEQ_TWO_KEYS(KC_SCLN, KC_K) { | ||
| 329 | send_secret_string(4); | ||
| 330 | } | ||
| 331 | SEQ_TWO_KEYS(KC_SCLN, KC_L) { | ||
| 332 | send_secret_string(5); | ||
| 333 | } | ||
| 334 | } | ||
| 335 | }; | ||
| 336 | |||
| 337 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
| 338 | dprintf("layer: %d\n", get_highest_layer(state)); | ||
| 339 | set_rgb_layer(get_highest_layer(state)); | ||
| 340 | #ifdef AUTO_SHIFT_ENABLE | ||
| 341 | autoshift_enable(); | ||
| 342 | #endif | ||
| 343 | if (layer_state_cmp(state, _GAME)) { | ||
| 344 | save_layer = _GAME; | ||
| 345 | #ifdef AUTO_SHIFT_ENABLE | ||
| 346 | autoshift_disable(); | ||
| 347 | #endif | ||
| 348 | } | ||
| 349 | else if (layer_state_cmp(state, _QWERTY)) | ||
| 350 | save_layer = _QWERTY; | ||
| 351 | return state; | ||
| 352 | } | ||
| 353 | |||
| 354 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 355 | struct layer_rgb *rgb_base_layer = &rgbs[save_layer]; | ||
| 356 | |||
| 357 | rgb_idle_seconds = 0; | ||
| 358 | rgb_matrix_enable_noeeprom(); | ||
| 359 | |||
| 360 | switch (keycode) { | ||
| 361 | // custom handle KC_GESC to emulate auto shift on it | ||
| 362 | case KC_GESC: | ||
| 363 | #ifdef AUTO_SHIFT_ENABLE | ||
| 364 | if (get_autoshift_state()) { | ||
| 365 | static uint16_t gesc_timer; | ||
| 366 | if (record->event.pressed) | ||
| 367 | gesc_timer = timer_read(); | ||
| 368 | else { | ||
| 369 | if (timer_elapsed(gesc_timer) > AUTO_SHIFT_TIMEOUT || MODS_SHIFT) { | ||
| 370 | tap_code16(S(KC_GRV)); | ||
| 371 | } else if (MODS_GUI) | ||
| 372 | tap_code(KC_GRV); | ||
| 373 | else | ||
| 374 | tap_code(KC_ESC); | ||
| 375 | } | ||
| 376 | return false; | ||
| 377 | } | ||
| 378 | #else // AUTO_SHIFT_ENABLE | ||
| 379 | return true; | ||
| 380 | #endif // AUTO_SHIFT_ENABLE | ||
| 381 | break; | ||
| 382 | |||
| 383 | case U_T_AUTO: | ||
| 384 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | ||
| 385 | TOGGLE_FLAG_AND_PRINT(usb_extra_manual, "USB extra port manual mode"); | ||
| 386 | } | ||
| 387 | return false; | ||
| 388 | case U_T_AGCR: | ||
| 389 | if (record->event.pressed && MODS_SHIFT && MODS_CTRL) { | ||
| 390 | TOGGLE_FLAG_AND_PRINT(usb_gcr_auto, "USB GCR auto mode"); | ||
| 391 | } | ||
| 392 | return false; | ||
| 393 | case DBG_TOG: | ||
| 394 | if (record->event.pressed) { | ||
| 395 | TOGGLE_FLAG_AND_PRINT(debug_enable, "Debug mode"); | ||
| 396 | } | ||
| 397 | return false; | ||
| 398 | case DBG_MTRX: | ||
| 399 | if (record->event.pressed) { | ||
| 400 | TOGGLE_FLAG_AND_PRINT(debug_matrix, "Debug matrix"); | ||
| 401 | } | ||
| 402 | return false; | ||
| 403 | case DBG_KBD: | ||
| 404 | if (record->event.pressed) { | ||
| 405 | TOGGLE_FLAG_AND_PRINT(debug_keyboard, "Debug keyboard"); | ||
| 406 | } | ||
| 407 | return false; | ||
| 408 | case DBG_MOU: | ||
| 409 | if (record->event.pressed) { | ||
| 410 | TOGGLE_FLAG_AND_PRINT(debug_mouse, "Debug mouse"); | ||
| 411 | } | ||
| 412 | return false; | ||
| 413 | case RGB_MOD: | ||
| 414 | if (record->event.pressed) { | ||
| 415 | if (++rgb_base_layer->mode >= RGB_MATRIX_EFFECT_MAX) | ||
| 416 | rgb_base_layer->mode = RGB_MATRIX_NONE; | ||
| 417 | set_rgb_layer(save_layer); | ||
| 418 | } | ||
| 419 | return false; | ||
| 420 | case RGB_RMOD: | ||
| 421 | if (record->event.pressed) { | ||
| 422 | if (--rgb_base_layer->mode <= RGB_MATRIX_NONE) | ||
| 423 | rgb_base_layer->mode = RGB_MATRIX_EFFECT_MAX - 1; | ||
| 424 | set_rgb_layer(save_layer); | ||
| 425 | } | ||
| 426 | return false; | ||
| 427 | case RGB_HUI: | ||
| 428 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 429 | if (rgb_base_layer->hsv.h > 235) | ||
| 430 | rgb_base_layer->hsv.h = 255; | ||
| 431 | else | ||
| 432 | rgb_base_layer->hsv.h += 20; | ||
| 433 | } | ||
| 434 | set_rgb_layer(save_layer); | ||
| 435 | return false; | ||
| 436 | case RGB_HUD: | ||
| 437 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 438 | if (rgb_base_layer->hsv.h < 20) | ||
| 439 | rgb_base_layer->hsv.h = 0; | ||
| 440 | else | ||
| 441 | rgb_base_layer->hsv.h -= 20; | ||
| 442 | } | ||
| 443 | set_rgb_layer(save_layer); | ||
| 444 | return false; | ||
| 445 | case RGB_SAI: | ||
| 446 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 447 | if (rgb_base_layer->hsv.s > 235) | ||
| 448 | rgb_base_layer->hsv.s = 255; | ||
| 449 | else | ||
| 450 | rgb_base_layer->hsv.s += 20; | ||
| 451 | } | ||
| 452 | set_rgb_layer(save_layer); | ||
| 453 | return false; | ||
| 454 | case RGB_SAD: | ||
| 455 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 456 | if (rgb_base_layer->hsv.s < 20) | ||
| 457 | rgb_base_layer->hsv.s = 0; | ||
| 458 | else | ||
| 459 | rgb_base_layer->hsv.s -= 20; | ||
| 460 | } | ||
| 461 | set_rgb_layer(save_layer); | ||
| 462 | return false; | ||
| 463 | case RGB_VAI: | ||
| 464 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 465 | if (rgb_base_layer->hsv.v > 235) | ||
| 466 | rgb_base_layer->hsv.v = 255; | ||
| 467 | else | ||
| 468 | rgb_base_layer->hsv.v += 20; | ||
| 469 | } | ||
| 470 | set_rgb_layer(save_layer); | ||
| 471 | return false; | ||
| 472 | case RGB_VAD: | ||
| 473 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 474 | if (rgb_base_layer->hsv.v < 20) | ||
| 475 | rgb_base_layer->hsv.v = 0; | ||
| 476 | else | ||
| 477 | rgb_base_layer->hsv.v -= 20; | ||
| 478 | } | ||
| 479 | set_rgb_layer(save_layer); | ||
| 480 | return false; | ||
| 481 | case RGB_TOG: | ||
| 482 | if (record->event.pressed) { | ||
| 483 | switch (rgb_base_layer->flags) { | ||
| 484 | case LED_FLAG_ALL: | ||
| 485 | rgb_base_layer->flags = LED_FLAG_KEYLIGHT; | ||
| 486 | break; | ||
| 487 | case LED_FLAG_KEYLIGHT: | ||
| 488 | rgb_base_layer->flags = LED_FLAG_UNDERGLOW; | ||
| 489 | break; | ||
| 490 | case LED_FLAG_UNDERGLOW: | ||
| 491 | rgb_base_layer->flags = LED_FLAG_NONE; | ||
| 492 | break; | ||
| 493 | default: | ||
| 494 | rgb_base_layer->flags = LED_FLAG_ALL; | ||
| 495 | break; | ||
| 496 | } | ||
| 497 | } | ||
| 498 | set_rgb_layer(save_layer); | ||
| 499 | return false; | ||
| 500 | default: | ||
| 501 | return true; //Process all other keycodes normally | ||
| 502 | } | ||
| 503 | return true; | ||
| 504 | } | ||
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins/rgb_matrix.h b/keyboards/massdrop/alt/keymaps/jdelkins/rgb_matrix.h new file mode 100644 index 000000000..ff30cc0e4 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/jdelkins/rgb_matrix.h | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | /* RGB LED Layout on the Massdrop ALT | ||
| 21 | * | ||
| 22 | * ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
| 23 | * │ │ | ||
| 24 | * │ 100 99 98 97 96 95 94 93 92 91 90 89 88 │ | ||
| 25 | * │ 101 87 | | ||
| 26 | * │ ┌───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬────────────┬───────┐ │ | ||
| 27 | * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ | ||
| 28 | * │ │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ BackSpace │ Home │ │ | ||
| 29 | * │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ │ | ||
| 30 | * │ 102 ├───────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬─────────┼───────┤ 86 │ | ||
| 31 | * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ | ||
| 32 | * │ │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ Del │ │ | ||
| 33 | * │ │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ │ | ||
| 34 | * │ 103 ├──────────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─────────┼───────┤ 85 │ | ||
| 35 | * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ | ||
| 36 | * │ │ Ctrl/Esc │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Return │ PgUp │ │ | ||
| 37 | * │ │ 31 │ 32 │ 33 │ 34 │ 35 │ 36 │ 37 │ 38 │ 39 │ 40 │ 41 │ 42 │ 43 │ 44 │ │ | ||
| 38 | * │ 104 ├────────────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴───────┬───────┼───────┤ 84 │ | ||
| 39 | * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ | ||
| 40 | * │ │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │ Up │ PgDn │ │ | ||
| 41 | * │ │ 45 │ 46 │ 47 │ 48 │ 49 │ 50 │ 51 │ 52 │ 53 │ 54 │ 55 │ 56 │ 57 │ 58 │ │ | ||
| 42 | * │ 105 ├─────────┬─────┴───┬───┴─────┬─┴───────┴───────┴───────┴───────┴───────┴─────┬─┴───────┼───────┴─┬──┬───────┼───────┼───────┤ 83 │ | ||
| 43 | * │ │ │ │ │ │ │ │▒▒│ │ │ │ │ | ||
| 44 | * │ │ Ctrl │ GUI │ Alt │ Space │ Alt │ Func │▒▒│ Left │ Down │ Right │ │ | ||
| 45 | * │ │ 59 │ 60 │ 61 │ 62 │ 63 │ 64 │▒▒│ 65 │ 66 │ 67 │ │ | ||
| 46 | * │ └─────────┴─────────┴─────────┴───────────────────────────────────────────────┴─────────┴─────────┴──┴───────┴───────┴───────┘ │ | ||
| 47 | * │ 68 82 │ | ||
| 48 | * │ 69 70 71 72 73 74 75 76 77 78 79 80 81 │ | ||
| 49 | * │ │ | ||
| 50 | * └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
| 51 | */ | ||
| 52 | |||
| 53 | enum layer_rgb_type { | ||
| 54 | type_hsv, | ||
| 55 | type_rgb, | ||
| 56 | }; | ||
| 57 | |||
| 58 | #define RGB_LINK_TO_LAYER(layer) (layer + RGB_MATRIX_EFFECT_MAX) | ||
| 59 | |||
| 60 | struct layer_rgb { | ||
| 61 | uint8_t type; | ||
| 62 | led_flags_t flags; | ||
| 63 | uint8_t mode; | ||
| 64 | union { | ||
| 65 | HSV hsv; | ||
| 66 | RGB rgb[DRIVER_LED_TOTAL]; | ||
| 67 | }; | ||
| 68 | }; | ||
| 69 | |||
| 70 | #define LAYOUT_rgb(_flags, _mode, \ | ||
| 71 | R101, R100, R99, R98, R97, R96, R95, R94, R93, R92, R91, R90, R89, R88, R87, \ | ||
| 72 | R102, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R86, \ | ||
| 73 | R103, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R30, R85, \ | ||
| 74 | R31, R32, R33, R34, R35, R36, R37, R38, R39, R40, R41, R42, R43, R44, \ | ||
| 75 | R104, R45, R46, R47, R48, R49, R50, R51, R52, R53, R54, R55, R56, R57, R58, R84, \ | ||
| 76 | R105, R59, R60, R61, R62, R63, R64, R65, R66, R67, R83, \ | ||
| 77 | R68, R69, R70, R71, R72, R73, R74, R75, R76, R77, R78, R79, R80, R81, R82 \ | ||
| 78 | ) (struct layer_rgb) { .type = type_rgb, .flags = _flags, .mode = _mode, .rgb = { \ | ||
| 79 | R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, \ | ||
| 80 | R22, R23, R24, R25, R26, R27, R28, R29, R30, R31, R32, R33, R34, R35, R36, R37, R38, R39, R40, \ | ||
| 81 | R41, R42, R43, R44, R45, R46, R47, R48, R49, R50, R51, R52, R53, R54, R55, R56, R57, R58, R59, \ | ||
| 82 | R60, R61, R62, R63, R64, R65, R66, R67, R68, R69, R70, R71, R72, R73, R74, R75, R76, R77, R78, \ | ||
| 83 | R79, R80, R81, R82, R83, R84, R85, R86, R87, R88, R89, R90, R91, R92, R93, R94, R95, R96, R97, \ | ||
| 84 | R98, R99, R100, R101, R102, R103, R104, R105 \ | ||
| 85 | }} | ||
| 86 | |||
| 87 | #define LAYOUT_hsv(_flags, _mode, _hsv) \ | ||
| 88 | (struct layer_rgb) { \ | ||
| 89 | .type = type_hsv, \ | ||
| 90 | .flags = _flags, \ | ||
| 91 | .mode = _mode, \ | ||
| 92 | .hsv = {_hsv} \ | ||
| 93 | } | ||
| 94 | |||
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins/rules.mk b/keyboards/massdrop/alt/keymaps/jdelkins/rules.mk new file mode 100644 index 000000000..17d80b8ca --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/jdelkins/rules.mk | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | ifeq ($(OS),Windows_NT) | ||
| 2 | PROGRAM_CMD = bin/mdloader_windows --first --download $(TARGET).hex --restart | ||
| 3 | else | ||
| 4 | UNAME_S := $(shell uname -s) | ||
| 5 | ifeq ($(UNAME_S),Darwin) | ||
| 6 | PROGRAM_CMD = bin/mdloader_mac --first --download $(TARGET).hex --restart | ||
| 7 | else | ||
| 8 | PROGRAM_CMD = sudo bin/mdloader_linux --first --download $(TARGET).hex --restart | ||
| 9 | endif | ||
| 10 | endif | ||
| 11 | |||
| 12 | LEADER_ENABLE = yes | ||
| 13 | MOUSEKEY_ENABLE = no | ||
| 14 | CONSOLE_ENABLE = no | ||
| 15 | NKRO_ENABLE = no | ||
| 16 | TAP_DANCE_ENABLE = yes | ||
| 17 | AUTO_SHIFT_ENABLE = no | ||
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins_ss/config.h b/keyboards/massdrop/alt/keymaps/jdelkins_ss/config.h new file mode 100644 index 000000000..a768f8bd2 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/jdelkins_ss/config.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | #define RGB_MATRIX_STARTUP_SPD 20 | ||
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins_ss/keymap.c b/keyboards/massdrop/alt/keymaps/jdelkins_ss/keymap.c new file mode 100644 index 000000000..f5a39338b --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/jdelkins_ss/keymap.c | |||
| @@ -0,0 +1,280 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include QMK_KEYBOARD_H | ||
| 19 | |||
| 20 | #include "print.h" | ||
| 21 | |||
| 22 | // Idle handling | ||
| 23 | |||
| 24 | #define IDLE_TIMEOUT 360 | ||
| 25 | uint16_t rgb_idle_seconds = 0; | ||
| 26 | uint16_t rgb_timer; | ||
| 27 | uint8_t save_layer; | ||
| 28 | |||
| 29 | #define NUMLOCK_ON (host_keyboard_leds() & (1<<USB_LED_NUM_LOCK)) | ||
| 30 | #define MODS_SHIFT (get_mods() & MOD_MASK_SHIFT) | ||
| 31 | #define MODS_CTRL (get_mods() & MOD_MASK_CTRL) | ||
| 32 | |||
| 33 | // Macro keycodes | ||
| 34 | |||
| 35 | enum alt_keycodes { | ||
| 36 | KB_BOOT = SAFE_RANGE, | ||
| 37 | }; | ||
| 38 | |||
| 39 | enum layers { | ||
| 40 | _QWERTY, | ||
| 41 | _ADJUST, | ||
| 42 | }; | ||
| 43 | |||
| 44 | // Layers | ||
| 45 | |||
| 46 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 47 | [_QWERTY] = LAYOUT( | ||
| 48 | KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, | ||
| 49 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_HOME, | ||
| 50 | KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP, | ||
| 51 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN, | ||
| 52 | KC_LCTL, KC_LALT, KC_LGUI, KC_SPC, KC_RALT, MO(_ADJUST),KC_LEFT, KC_DOWN, KC_RGHT | ||
| 53 | ), | ||
| 54 | [_ADJUST] = LAYOUT( | ||
| 55 | KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, KC_INS, | ||
| 56 | _______, RGB_SPD, RGB_VAI, RGB_SPI, RGB_HUI, RGB_SAI, _______, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, KC_CALC, KC_END, | ||
| 57 | _______, RGB_RMOD,RGB_VAD, RGB_MOD, RGB_HUD, RGB_SAD, _______, _______, _______, _______, _______, _______, _______, KC_MPLY, | ||
| 58 | _______, RGB_TOG, _______, _______, _______, KB_BOOT, _______, _______, _______, _______, _______, _______, KC_VOLU, KC_MUTE, | ||
| 59 | _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_MNXT | ||
| 60 | ), | ||
| 61 | /* | ||
| 62 | [X] = LAYOUT( | ||
| 63 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 64 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 65 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 66 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 67 | _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 68 | ), | ||
| 69 | */ | ||
| 70 | }; | ||
| 71 | |||
| 72 | #ifdef _______ | ||
| 73 | #undef _______ | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #define RGB_NULL 254, 254, 254 | ||
| 77 | #define RGB_IS_NULL(rgb) ((rgb).r == 254 && (rgb).g == 254 && (rgb).b == 254) | ||
| 78 | |||
| 79 | #define DEFAULT_HSV 255, 255, 128 | ||
| 80 | #define R(COL) { RGB_ ## COL } | ||
| 81 | #define _______ R(NULL) | ||
| 82 | #define xxxxxxx R(BLACK) | ||
| 83 | |||
| 84 | struct layer_rgb PROGMEM rgbs[] = { | ||
| 85 | [_QWERTY] = LAYOUT_hsv(LED_FLAG_ALL, RGB_MATRIX_CYCLE_ALL, DEFAULT_HSV), | ||
| 86 | [_ADJUST] = LAYOUT_rgb(LED_FLAG_NONE, RGB_MATRIX_SOLID_COLOR, | ||
| 87 | R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), | ||
| 88 | R(GREEN), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(WHITE), R(GREEN), | ||
| 89 | R(GREEN), xxxxxxx, R(BLUE), R(YELLOW), R(BLUE), R(GREEN), R(ORANGE),xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(GREEN), | ||
| 90 | xxxxxxx, R(MAGENTA),R(YELLOW), R(MAGENTA),R(GREEN),R(ORANGE),xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(BLUE), | ||
| 91 | R(GREEN), xxxxxxx, R(WHITE), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(YELLOW),R(ORANGE), R(GREEN), | ||
| 92 | R(GREEN), xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, xxxxxxx, R(RED), R(YELLOW),R(RED), R(GREEN), | ||
| 93 | R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN), R(GREEN) | ||
| 94 | ), | ||
| 95 | /* | ||
| 96 | [X] = LAYOUT_rgb( | ||
| 97 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 98 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 99 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 100 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 101 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 102 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 103 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 104 | ), | ||
| 105 | */ | ||
| 106 | }; | ||
| 107 | |||
| 108 | #undef _______ | ||
| 109 | #define _______ KC_TRANS | ||
| 110 | |||
| 111 | static void set_rgb_layer(int layer) { | ||
| 112 | const struct layer_rgb *cur = &rgbs[layer]; | ||
| 113 | |||
| 114 | switch (cur->type) { | ||
| 115 | case type_hsv: | ||
| 116 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL ; i++) { | ||
| 117 | if (!(g_led_config.flags[i] & cur->flags)) | ||
| 118 | rgb_matrix_set_color(i, 0, 0, 0); | ||
| 119 | } | ||
| 120 | rgb_matrix_set_flags(cur->flags); | ||
| 121 | if (cur->mode >= RGB_MATRIX_EFFECT_MAX) | ||
| 122 | rgb_matrix_mode_noeeprom(rgbs[cur->mode - RGB_MATRIX_EFFECT_MAX].mode); | ||
| 123 | else | ||
| 124 | rgb_matrix_mode_noeeprom(cur->mode); | ||
| 125 | rgb_matrix_sethsv_noeeprom(cur->hsv.h, cur->hsv.s, cur->hsv.v); | ||
| 126 | break; | ||
| 127 | case type_rgb: | ||
| 128 | rgb_matrix_set_flags(cur->flags); | ||
| 129 | if (cur->mode >= RGB_MATRIX_EFFECT_MAX) | ||
| 130 | rgb_matrix_mode_noeeprom(rgbs[cur->mode - RGB_MATRIX_EFFECT_MAX].mode); | ||
| 131 | else | ||
| 132 | rgb_matrix_mode_noeeprom(cur->mode); | ||
| 133 | for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++) { | ||
| 134 | const RGB *m = &cur->rgb[i]; | ||
| 135 | if (!RGB_IS_NULL(*m)) | ||
| 136 | rgb_matrix_set_color(i, m->r, m->g, m->b); | ||
| 137 | } | ||
| 138 | break; | ||
| 139 | } | ||
| 140 | } | ||
| 141 | |||
| 142 | // Runs just one time when the keyboard initializes. | ||
| 143 | void matrix_init_keymap(void) { | ||
| 144 | set_rgb_layer(_QWERTY); | ||
| 145 | // force numlock on upon startup | ||
| 146 | if (!NUMLOCK_ON) { | ||
| 147 | tap_code(KC_NUMLOCK); | ||
| 148 | } | ||
| 149 | }; | ||
| 150 | |||
| 151 | // Runs constantly in the background, in a loop. | ||
| 152 | void matrix_scan_keymap(void) { | ||
| 153 | if (rgb_matrix_get_flags() != LED_FLAG_NONE && timer_elapsed(rgb_timer) > 1000) { | ||
| 154 | rgb_idle_seconds++; | ||
| 155 | rgb_timer = timer_read(); | ||
| 156 | } | ||
| 157 | if (rgb_idle_seconds > IDLE_TIMEOUT) { | ||
| 158 | rgb_matrix_disable_noeeprom(); | ||
| 159 | rgb_idle_seconds = 0; | ||
| 160 | } | ||
| 161 | }; | ||
| 162 | |||
| 163 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
| 164 | set_rgb_layer(get_highest_layer(state)); | ||
| 165 | if (layer_state_cmp(state, _QWERTY)) | ||
| 166 | save_layer = _QWERTY; | ||
| 167 | return state; | ||
| 168 | } | ||
| 169 | |||
| 170 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 171 | static uint32_t boot_timer; | ||
| 172 | struct layer_rgb *rgb_base_layer = &rgbs[save_layer]; | ||
| 173 | rgb_idle_seconds = 0; | ||
| 174 | rgb_matrix_enable_noeeprom(); | ||
| 175 | |||
| 176 | switch (keycode) { | ||
| 177 | case KB_BOOT: | ||
| 178 | if (!get_mods()) { | ||
| 179 | if (record->event.pressed) { | ||
| 180 | boot_timer = timer_read32(); | ||
| 181 | } else { | ||
| 182 | if (timer_elapsed32(boot_timer) >= 750) { | ||
| 183 | reset_keyboard(); | ||
| 184 | } | ||
| 185 | } | ||
| 186 | return false; | ||
| 187 | } | ||
| 188 | break; | ||
| 189 | case RGB_MOD: | ||
| 190 | if (record->event.pressed) { | ||
| 191 | if (++rgb_base_layer->mode >= RGB_MATRIX_EFFECT_MAX) | ||
| 192 | rgb_base_layer->mode = RGB_MATRIX_NONE; | ||
| 193 | set_rgb_layer(save_layer); | ||
| 194 | } | ||
| 195 | return false; | ||
| 196 | case RGB_RMOD: | ||
| 197 | if (record->event.pressed) { | ||
| 198 | if (--rgb_base_layer->mode <= RGB_MATRIX_NONE) | ||
| 199 | rgb_base_layer->mode = RGB_MATRIX_EFFECT_MAX - 1; | ||
| 200 | set_rgb_layer(save_layer); | ||
| 201 | } | ||
| 202 | return false; | ||
| 203 | case RGB_HUI: | ||
| 204 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 205 | if (rgb_base_layer->hsv.h > 235) | ||
| 206 | rgb_base_layer->hsv.h = 255; | ||
| 207 | else | ||
| 208 | rgb_base_layer->hsv.h += 20; | ||
| 209 | } | ||
| 210 | set_rgb_layer(save_layer); | ||
| 211 | return false; | ||
| 212 | case RGB_HUD: | ||
| 213 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 214 | if (rgb_base_layer->hsv.h < 20) | ||
| 215 | rgb_base_layer->hsv.h = 0; | ||
| 216 | else | ||
| 217 | rgb_base_layer->hsv.h -= 20; | ||
| 218 | } | ||
| 219 | set_rgb_layer(save_layer); | ||
| 220 | return false; | ||
| 221 | case RGB_SAI: | ||
| 222 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 223 | if (rgb_base_layer->hsv.s > 235) | ||
| 224 | rgb_base_layer->hsv.s = 255; | ||
| 225 | else | ||
| 226 | rgb_base_layer->hsv.s += 20; | ||
| 227 | } | ||
| 228 | set_rgb_layer(save_layer); | ||
| 229 | return false; | ||
| 230 | case RGB_SAD: | ||
| 231 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 232 | if (rgb_base_layer->hsv.s < 20) | ||
| 233 | rgb_base_layer->hsv.s = 0; | ||
| 234 | else | ||
| 235 | rgb_base_layer->hsv.s -= 20; | ||
| 236 | } | ||
| 237 | set_rgb_layer(save_layer); | ||
| 238 | return false; | ||
| 239 | case RGB_VAI: | ||
| 240 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 241 | if (rgb_base_layer->hsv.v > 235) | ||
| 242 | rgb_base_layer->hsv.v = 255; | ||
| 243 | else | ||
| 244 | rgb_base_layer->hsv.v += 20; | ||
| 245 | } | ||
| 246 | set_rgb_layer(save_layer); | ||
| 247 | return false; | ||
| 248 | case RGB_VAD: | ||
| 249 | if (rgb_base_layer->type == type_hsv && record->event.pressed) { | ||
| 250 | if (rgb_base_layer->hsv.v < 20) | ||
| 251 | rgb_base_layer->hsv.v = 0; | ||
| 252 | else | ||
| 253 | rgb_base_layer->hsv.v -= 20; | ||
| 254 | } | ||
| 255 | set_rgb_layer(save_layer); | ||
| 256 | return false; | ||
| 257 | case RGB_TOG: | ||
| 258 | if (record->event.pressed) { | ||
| 259 | switch (rgb_base_layer->flags) { | ||
| 260 | case LED_FLAG_ALL: | ||
| 261 | rgb_base_layer->flags = LED_FLAG_KEYLIGHT; | ||
| 262 | break; | ||
| 263 | case LED_FLAG_KEYLIGHT: | ||
| 264 | rgb_base_layer->flags = LED_FLAG_UNDERGLOW; | ||
| 265 | break; | ||
| 266 | case LED_FLAG_UNDERGLOW: | ||
| 267 | rgb_base_layer->flags = LED_FLAG_NONE; | ||
| 268 | break; | ||
| 269 | default: | ||
| 270 | rgb_base_layer->flags = LED_FLAG_ALL; | ||
| 271 | break; | ||
| 272 | } | ||
| 273 | } | ||
| 274 | set_rgb_layer(save_layer); | ||
| 275 | return false; | ||
| 276 | default: | ||
| 277 | return true; //Process all other keycodes normally | ||
| 278 | } | ||
| 279 | return true; | ||
| 280 | } | ||
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins_ss/rgb_matrix.h b/keyboards/massdrop/alt/keymaps/jdelkins_ss/rgb_matrix.h new file mode 100644 index 000000000..ff30cc0e4 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/jdelkins_ss/rgb_matrix.h | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | /* RGB LED Layout on the Massdrop ALT | ||
| 21 | * | ||
| 22 | * ┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ | ||
| 23 | * │ │ | ||
| 24 | * │ 100 99 98 97 96 95 94 93 92 91 90 89 88 │ | ||
| 25 | * │ 101 87 | | ||
| 26 | * │ ┌───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬───────┬────────────┬───────┐ │ | ||
| 27 | * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ | ||
| 28 | * │ │ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ BackSpace │ Home │ │ | ||
| 29 | * │ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11 │ 12 │ 13 │ 14 │ 15 │ │ | ||
| 30 | * │ 102 ├───────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬─────────┼───────┤ 86 │ | ||
| 31 | * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ | ||
| 32 | * │ │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ [ │ ] │ \ │ Del │ │ | ||
| 33 | * │ │ 16 │ 17 │ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ │ | ||
| 34 | * │ 103 ├──────────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─┬─────┴─────────┼───────┤ 85 │ | ||
| 35 | * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ | ||
| 36 | * │ │ Ctrl/Esc │ A │ S │ D │ F │ G │ H │ J │ K │ L │ ; │ ' │ Return │ PgUp │ │ | ||
| 37 | * │ │ 31 │ 32 │ 33 │ 34 │ 35 │ 36 │ 37 │ 38 │ 39 │ 40 │ 41 │ 42 │ 43 │ 44 │ │ | ||
| 38 | * │ 104 ├────────────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴──┬────┴───────┬───────┼───────┤ 84 │ | ||
| 39 | * │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ | ||
| 40 | * │ │ Shift │ Z │ X │ C │ V │ B │ N │ M │ , │ . │ / │ Shift │ Up │ PgDn │ │ | ||
| 41 | * │ │ 45 │ 46 │ 47 │ 48 │ 49 │ 50 │ 51 │ 52 │ 53 │ 54 │ 55 │ 56 │ 57 │ 58 │ │ | ||
| 42 | * │ 105 ├─────────┬─────┴───┬───┴─────┬─┴───────┴───────┴───────┴───────┴───────┴─────┬─┴───────┼───────┴─┬──┬───────┼───────┼───────┤ 83 │ | ||
| 43 | * │ │ │ │ │ │ │ │▒▒│ │ │ │ │ | ||
| 44 | * │ │ Ctrl │ GUI │ Alt │ Space │ Alt │ Func │▒▒│ Left │ Down │ Right │ │ | ||
| 45 | * │ │ 59 │ 60 │ 61 │ 62 │ 63 │ 64 │▒▒│ 65 │ 66 │ 67 │ │ | ||
| 46 | * │ └─────────┴─────────┴─────────┴───────────────────────────────────────────────┴─────────┴─────────┴──┴───────┴───────┴───────┘ │ | ||
| 47 | * │ 68 82 │ | ||
| 48 | * │ 69 70 71 72 73 74 75 76 77 78 79 80 81 │ | ||
| 49 | * │ │ | ||
| 50 | * └────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ | ||
| 51 | */ | ||
| 52 | |||
| 53 | enum layer_rgb_type { | ||
| 54 | type_hsv, | ||
| 55 | type_rgb, | ||
| 56 | }; | ||
| 57 | |||
| 58 | #define RGB_LINK_TO_LAYER(layer) (layer + RGB_MATRIX_EFFECT_MAX) | ||
| 59 | |||
| 60 | struct layer_rgb { | ||
| 61 | uint8_t type; | ||
| 62 | led_flags_t flags; | ||
| 63 | uint8_t mode; | ||
| 64 | union { | ||
| 65 | HSV hsv; | ||
| 66 | RGB rgb[DRIVER_LED_TOTAL]; | ||
| 67 | }; | ||
| 68 | }; | ||
| 69 | |||
| 70 | #define LAYOUT_rgb(_flags, _mode, \ | ||
| 71 | R101, R100, R99, R98, R97, R96, R95, R94, R93, R92, R91, R90, R89, R88, R87, \ | ||
| 72 | R102, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R86, \ | ||
| 73 | R103, R16, R17, R18, R19, R20, R21, R22, R23, R24, R25, R26, R27, R28, R29, R30, R85, \ | ||
| 74 | R31, R32, R33, R34, R35, R36, R37, R38, R39, R40, R41, R42, R43, R44, \ | ||
| 75 | R104, R45, R46, R47, R48, R49, R50, R51, R52, R53, R54, R55, R56, R57, R58, R84, \ | ||
| 76 | R105, R59, R60, R61, R62, R63, R64, R65, R66, R67, R83, \ | ||
| 77 | R68, R69, R70, R71, R72, R73, R74, R75, R76, R77, R78, R79, R80, R81, R82 \ | ||
| 78 | ) (struct layer_rgb) { .type = type_rgb, .flags = _flags, .mode = _mode, .rgb = { \ | ||
| 79 | R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, R14, R15, R16, R17, R18, R19, R20, R21, \ | ||
| 80 | R22, R23, R24, R25, R26, R27, R28, R29, R30, R31, R32, R33, R34, R35, R36, R37, R38, R39, R40, \ | ||
| 81 | R41, R42, R43, R44, R45, R46, R47, R48, R49, R50, R51, R52, R53, R54, R55, R56, R57, R58, R59, \ | ||
| 82 | R60, R61, R62, R63, R64, R65, R66, R67, R68, R69, R70, R71, R72, R73, R74, R75, R76, R77, R78, \ | ||
| 83 | R79, R80, R81, R82, R83, R84, R85, R86, R87, R88, R89, R90, R91, R92, R93, R94, R95, R96, R97, \ | ||
| 84 | R98, R99, R100, R101, R102, R103, R104, R105 \ | ||
| 85 | }} | ||
| 86 | |||
| 87 | #define LAYOUT_hsv(_flags, _mode, _hsv) \ | ||
| 88 | (struct layer_rgb) { \ | ||
| 89 | .type = type_hsv, \ | ||
| 90 | .flags = _flags, \ | ||
| 91 | .mode = _mode, \ | ||
| 92 | .hsv = {_hsv} \ | ||
| 93 | } | ||
| 94 | |||
diff --git a/keyboards/massdrop/alt/keymaps/jdelkins_ss/rules.mk b/keyboards/massdrop/alt/keymaps/jdelkins_ss/rules.mk new file mode 100644 index 000000000..e7fb783e6 --- /dev/null +++ b/keyboards/massdrop/alt/keymaps/jdelkins_ss/rules.mk | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | ifeq ($(OS),Windows_NT) | ||
| 2 | PROGRAM_CMD = bin/mdloader_windows --first --download $(TARGET).hex --restart | ||
| 3 | else | ||
| 4 | UNAME_S := $(shell uname -s) | ||
| 5 | ifeq ($(UNAME_S),Darwin) | ||
| 6 | PROGRAM_CMD = bin/mdloader_mac --first --download $(TARGET).hex --restart | ||
| 7 | else | ||
| 8 | PROGRAM_CMD = sudo bin/mdloader_linux --first --download $(TARGET).hex --restart | ||
| 9 | endif | ||
| 10 | endif | ||
| 11 | |||
| 12 | USER_NAME := jdelkins | ||
diff --git a/keyboards/planck/keymaps/jdelkins/config.h b/keyboards/planck/keymaps/jdelkins/config.h new file mode 100644 index 000000000..e09fafc66 --- /dev/null +++ b/keyboards/planck/keymaps/jdelkins/config.h | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | /* Copyright 2020 Joel Elkins | ||
| 2 | * | ||
| 3 | * This program is free software: you can redistribute it and/or modify | ||
| 4 | * it under the terms of the GNU General Public License as published by | ||
| 5 | * the Free Software Foundation, either version 2 of the License, or | ||
| 6 | * (at your option) any later version. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #pragma once | ||
| 18 | |||
| 19 | #ifdef AUDIO_ENABLE | ||
| 20 | #define STARTUP_SONG SONG(PLANCK_SOUND) | ||
| 21 | // #define STARTUP_SONG SONG(NO_SOUND) | ||
| 22 | |||
| 23 | #define DEFAULT_LAYER_SONGS { SONG(QWERTY_SOUND), \ | ||
| 24 | SONG(COLEMAK_SOUND), \ | ||
| 25 | SONG(DVORAK_SOUND) \ | ||
| 26 | } | ||
| 27 | #endif | ||
| 28 | |||
| 29 | /* | ||
| 30 | * MIDI options | ||
| 31 | */ | ||
| 32 | |||
| 33 | /* Prevent use of disabled MIDI features in the keymap */ | ||
| 34 | //#define MIDI_ENABLE_STRICT 1 | ||
| 35 | |||
| 36 | /* enable basic MIDI features: | ||
| 37 | - MIDI notes can be sent when in Music mode is on | ||
| 38 | */ | ||
| 39 | |||
| 40 | #define MIDI_BASIC | ||
| 41 | |||
| 42 | /* enable advanced MIDI features: | ||
| 43 | - MIDI notes can be added to the keymap | ||
| 44 | - Octave shift and transpose | ||
| 45 | - Virtual sustain, portamento, and modulation wheel | ||
| 46 | - etc. | ||
| 47 | */ | ||
| 48 | //#define MIDI_ADVANCED | ||
| 49 | |||
| 50 | /* override number of MIDI tone keycodes (each octave adds 12 keycodes and allocates 12 bytes) */ | ||
| 51 | //#define MIDI_TONE_KEYCODE_OCTAVES 2 | ||
| 52 | |||
| 53 | // Most tactile encoders have detents every 4 stages | ||
| 54 | #define ENCODER_RESOLUTION 4 | ||
| 55 | |||
| 56 | #define AUTO_SHIFT_TIMEOUT 165 | ||
| 57 | #define LEADER_TIMEOUT 400 | ||
| 58 | #define LEADER_PER_KEY_TIMING | ||
diff --git a/keyboards/planck/keymaps/jdelkins/keymap.c b/keyboards/planck/keymaps/jdelkins/keymap.c new file mode 100644 index 000000000..3d109e9e8 --- /dev/null +++ b/keyboards/planck/keymaps/jdelkins/keymap.c | |||
| @@ -0,0 +1,423 @@ | |||
| 1 | /* Copyright 2015-2017 Jack Humbert | ||
| 2 | * Portions Copyright 2020 Joel Elkins | ||
| 3 | * | ||
| 4 | * This program is free software: you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation, either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "jdelkins.h" | ||
| 19 | #include "muse.h" | ||
| 20 | |||
| 21 | #ifdef LAYOUT | ||
| 22 | #undef LAYOUT | ||
| 23 | #endif | ||
| 24 | #define LAYOUT LAYOUT_planck_2x2u | ||
| 25 | |||
| 26 | uint16_t bspc_timer; | ||
| 27 | |||
| 28 | enum { | ||
| 29 | MY_BSPC = USER_SAFE_RANGE, | ||
| 30 | BACKLIT, | ||
| 31 | }; | ||
| 32 | |||
| 33 | // recycle unused layers defined in my userspace | ||
| 34 | #define _RAISE _FUNC | ||
| 35 | #define _LOWER _SECRETS | ||
| 36 | |||
| 37 | #define KP MO(_KP) | ||
| 38 | #define LOWER MO(_LOWER) | ||
| 39 | #define RAISE MO(_RAISE) | ||
| 40 | |||
| 41 | int ctl_state = 0; | ||
| 42 | |||
| 43 | void ctl_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 44 | ctl_state = cur_dance(state); | ||
| 45 | switch (ctl_state) { | ||
| 46 | case SINGLE_TAP: qk_leader_start(); break; | ||
| 47 | case SINGLE_HOLD: register_code(KC_LCTL); break; | ||
| 48 | case DOUBLE_TAP: tap_code(KC_RCTL); break; | ||
| 49 | case DOUBLE_HOLD: register_code(KC_RCTL); break; | ||
| 50 | case TRIPLE_TAP: tap_code(KC_RCTL); tap_code(KC_RCTL); break; | ||
| 51 | case TRIPLE_HOLD: tap_code(KC_RCTL); register_code(KC_RCTL); break; | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | void ctl_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 56 | switch (ctl_state) { | ||
| 57 | case SINGLE_HOLD: unregister_code(KC_LCTL); break; | ||
| 58 | case DOUBLE_HOLD: | ||
| 59 | case TRIPLE_HOLD: unregister_code(KC_RCTL); break; | ||
| 60 | } | ||
| 61 | ctl_state = 0; | ||
| 62 | } | ||
| 63 | |||
| 64 | void g_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 65 | switch (cur_dance(state)) { | ||
| 66 | case SINGLE_TAP: | ||
| 67 | tap_code16(C(KC_END)); | ||
| 68 | break; | ||
| 69 | case DOUBLE_TAP: | ||
| 70 | tap_code16(C(KC_HOME)); | ||
| 71 | break; | ||
| 72 | } | ||
| 73 | } | ||
| 74 | |||
| 75 | int kp_state = 0; | ||
| 76 | |||
| 77 | void kp_finished(qk_tap_dance_state_t *state, void *user_data) { | ||
| 78 | kp_state = hold_cur_dance(state); | ||
| 79 | switch (kp_state) { | ||
| 80 | case SINGLE_HOLD: layer_on(_KP); break; | ||
| 81 | case DOUBLE_HOLD: layer_on(_RPT); break; | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | void kp_reset(qk_tap_dance_state_t *state, void *user_data) { | ||
| 86 | switch (kp_state) { | ||
| 87 | case SINGLE_HOLD: layer_off(_KP); break; | ||
| 88 | case DOUBLE_HOLD: layer_off(_RPT); break; | ||
| 89 | } | ||
| 90 | kp_state = 0; | ||
| 91 | } | ||
| 92 | |||
| 93 | enum { | ||
| 94 | TD_LDCTL, | ||
| 95 | TD_G, | ||
| 96 | TD_KP | ||
| 97 | }; | ||
| 98 | |||
| 99 | qk_tap_dance_action_t tap_dance_actions[] = { | ||
| 100 | [TD_LDCTL] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, ctl_finished, ctl_reset), | ||
| 101 | [TD_G] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, g_finished, NULL), | ||
| 102 | [TD_KP] = ACTION_TAP_DANCE_FN_ADVANCED(NULL, kp_finished, kp_reset), | ||
| 103 | }; | ||
| 104 | |||
| 105 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 106 | |||
| 107 | /* Qwerty | ||
| 108 | * ,-----------------------------------------------------------------------------------. | ||
| 109 | * | Tab | Q | W | E | R | T | Y | U | I | O | P | ` | | ||
| 110 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 111 | * | Ctrl | A | S | D | F | G | H | J | K | L | ; | " | | ||
| 112 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 113 | * | Shift| Z | X | C | V | B | N | M | , | . | / |Enter | | ||
| 114 | * |------+------+------+------+------+------+------+------+------+------+------+------| | ||
| 115 | * | Ctrl | Gui | Alt |Keypad| Bksp | Space | Left | Down | Up |Right | | ||
| 116 | * `-----------------------------------------------------------------------------------' | ||
| 117 | */ | ||
| 118 | [_QWERTY] = LAYOUT( | ||
| 119 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_GRV, | ||
| 120 | KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
| 121 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, | ||
| 122 | TD(TD_LDCTL), MO(_ADJUST), MY_GUI, MY_ALT, MY_BSPC, MY_SPC, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | ||
| 123 | ), | ||
| 124 | |||
| 125 | [_GAME] = LAYOUT( | ||
| 126 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 127 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 128 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 129 | _______, KC_NO, KC_LALT, RAISE, KC_SPC, KC_SPC, _______, _______, _______, _______ | ||
| 130 | ), | ||
| 131 | |||
| 132 | [_RAISE] = LAYOUT( | ||
| 133 | KC_ESC, _______, FW_WRD, KB_EOL, _______, _______, KB_COPY, KC_PGUP, _______, KC_LPRN, KC_RPRN, KC_MINS, | ||
| 134 | _______, KB_BOL, _______, KC_PGDN, _______, TD(TD_G), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, _______, KC_BSLS, | ||
| 135 | _______, _______, KC_DEL, _______, KB_PASTE, BK_WRD, _______, _______, _______, _______, _______, KC_CALC, | ||
| 136 | _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END | ||
| 137 | ), | ||
| 138 | |||
| 139 | /* Same as _QWERTY but disable autoshift */ | ||
| 140 | [_RPT] = LAYOUT( | ||
| 141 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 142 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 143 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, | ||
| 144 | _______, _______, _______, _______, KC_BSPC, KC_SPC, _______, _______, _______, _______ | ||
| 145 | ), | ||
| 146 | |||
| 147 | [_KP] = LAYOUT( | ||
| 148 | KC_NUMLOCK, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13, KC_F14, KC_7, KC_8, KC_9, KC_MINS, KC_EQL, | ||
| 149 | _______, KC_F5, KC_F6, KC_F7, KC_F8, XXXXXXX, XXXXXXX, KC_4, KC_5, KC_6, KC_ASTR, _______, | ||
| 150 | _______, KC_F1, KC_F2, KC_F3, KC_F4, XXXXXXX, XXXXXXX, KC_1, KC_2, KC_3, KC_SLSH, _______, | ||
| 151 | _______, _______, _______, _______, _______, _______, KC_0, KC_DOT, KC_PLUS, KC_END | ||
| 152 | ), | ||
| 153 | |||
| 154 | [_LOWER] = LAYOUT( | ||
| 155 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LBRC, KC_RBRC, KC_EQL, | ||
| 156 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_LCBR, KC_RCBR, KC_PIPE, | ||
| 157 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, KC_MPLY, | ||
| 158 | _______, _______, _______, _______, _______, _______, KC_MPRV, KC_VOLD, KC_VOLU, KC_MNXT | ||
| 159 | ), | ||
| 160 | |||
| 161 | [_ADJUST] = LAYOUT( | ||
| 162 | _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL, | ||
| 163 | _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, _______, _______, _______, _______, _______, | ||
| 164 | _______, RGB_TOG, KB_MAKE, KB_FLSH, KB_VRSN, KB_BOOT, _______, TG_SYS, _______, _______, _______, _______, | ||
| 165 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ | ||
| 166 | ) | ||
| 167 | |||
| 168 | /* [_ADJUST] = LAYOUT( */ | ||
| 169 | /* _______, RESET, DEBUG, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , */ | ||
| 170 | /* _______, _______, MU_MOD, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, PLOVER, _______, */ | ||
| 171 | /* _______, MUV_DE, MUV_IN, MU_ON, MU_OFF, MI_ON, MI_OFF, TERM_ON, TERM_OFF, _______, _______, _______, */ | ||
| 172 | /* _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ */ | ||
| 173 | /* ) */ | ||
| 174 | |||
| 175 | }; | ||
| 176 | |||
| 177 | #ifdef AUDIO_ENABLE | ||
| 178 | float plover_song[][2] = SONG(PLOVER_SOUND); | ||
| 179 | float plover_gb_song[][2] = SONG(PLOVER_GOODBYE_SOUND); | ||
| 180 | #endif | ||
| 181 | |||
| 182 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
| 183 | if (layer_state_cmp(state, _GAME) || layer_state_cmp(state, _RPT)) | ||
| 184 | autoshift_disable(); | ||
| 185 | else | ||
| 186 | autoshift_enable(); | ||
| 187 | return update_tri_layer_state(state, _KP, _RAISE, _LOWER); | ||
| 188 | } | ||
| 189 | |||
| 190 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 191 | bool rc = true; | ||
| 192 | static bool bspc_del = false; | ||
| 193 | static bool bspc_initiated_func = false; | ||
| 194 | |||
| 195 | switch (keycode) { | ||
| 196 | case MY_BSPC: | ||
| 197 | if (record->event.pressed) { | ||
| 198 | if (IS_LAYER_ON(_KP)) { | ||
| 199 | // special case: if _KP was turned on by another key, | ||
| 200 | // treat this as KC_DEL and don't do anything else | ||
| 201 | bspc_del = true; | ||
| 202 | register_code(KC_DEL); | ||
| 203 | return false; | ||
| 204 | } else { | ||
| 205 | bspc_timer = timer_read(); | ||
| 206 | bspc_initiated_func = true; | ||
| 207 | layer_on(_KP); | ||
| 208 | } | ||
| 209 | } else { | ||
| 210 | if (bspc_del) { | ||
| 211 | // special case: if _KP was turned on by another key, | ||
| 212 | // treat this as KC_DEL and don't do anything else | ||
| 213 | unregister_code(KC_DEL); | ||
| 214 | bspc_del = false; | ||
| 215 | return false; | ||
| 216 | } | ||
| 217 | |||
| 218 | if (bspc_initiated_func) { | ||
| 219 | layer_off(_KP); | ||
| 220 | bspc_initiated_func = false; | ||
| 221 | } | ||
| 222 | |||
| 223 | if (bspc_timer > 0) { | ||
| 224 | // here the key was pressed and released before the timer | ||
| 225 | // expired, so treat as a backspace tap and pretend we | ||
| 226 | // never activated _KP | ||
| 227 | bspc_timer = 0; | ||
| 228 | tap_code(KC_BSPC); | ||
| 229 | } else { | ||
| 230 | // the timer went off, so KC_BSPC was registered in | ||
| 231 | // matrix_scan_keymap. unregister it now | ||
| 232 | unregister_code(KC_BSPC); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | return false; // special case, return now without resetting timer | ||
| 236 | // other paths should set rc and break | ||
| 237 | break; | ||
| 238 | |||
| 239 | case BACKLIT: | ||
| 240 | if (record->event.pressed) { | ||
| 241 | register_code(KC_RSFT); | ||
| 242 | #ifdef BACKLIGHT_ENABLE | ||
| 243 | backlight_step(); | ||
| 244 | #endif | ||
| 245 | } else { | ||
| 246 | unregister_code(KC_RSFT); | ||
| 247 | } | ||
| 248 | rc = false; | ||
| 249 | break; | ||
| 250 | } | ||
| 251 | |||
| 252 | bspc_timer = 0; | ||
| 253 | return rc; | ||
| 254 | } | ||
| 255 | |||
| 256 | bool muse_mode = false; | ||
| 257 | uint8_t last_muse_note = 0; | ||
| 258 | uint16_t muse_counter = 0; | ||
| 259 | uint8_t muse_offset = 70; | ||
| 260 | uint16_t muse_tempo = 50; | ||
| 261 | |||
| 262 | void encoder_update(bool clockwise) { | ||
| 263 | if (muse_mode) { | ||
| 264 | if (IS_LAYER_ON(_RAISE)) { | ||
| 265 | if (clockwise) { | ||
| 266 | muse_offset++; | ||
| 267 | } else { | ||
| 268 | muse_offset--; | ||
| 269 | } | ||
| 270 | } else { | ||
| 271 | if (clockwise) { | ||
| 272 | muse_tempo+=1; | ||
| 273 | } else { | ||
| 274 | muse_tempo-=1; | ||
| 275 | } | ||
| 276 | } | ||
| 277 | } else { | ||
| 278 | if (clockwise) { | ||
| 279 | #ifdef MOUSEKEY_ENABLE | ||
| 280 | tap_code(KC_MS_WH_DOWN); | ||
| 281 | #else | ||
| 282 | tap_code(KC_PGDN); | ||
| 283 | #endif | ||
| 284 | } else { | ||
| 285 | #ifdef MOUSEKEY_ENABLE | ||
| 286 | tap_code(KC_MS_WH_UP); | ||
| 287 | #else | ||
| 288 | tap_code(KC_PGUP); | ||
| 289 | #endif | ||
| 290 | } | ||
| 291 | } | ||
| 292 | } | ||
| 293 | |||
| 294 | void dip_switch_update_user(uint8_t index, bool active) { | ||
| 295 | switch (index) { | ||
| 296 | case 0: { | ||
| 297 | #ifdef AUDIO_ENABLE | ||
| 298 | static bool play_sound = false; | ||
| 299 | #endif | ||
| 300 | if (active) { | ||
| 301 | #ifdef AUDIO_ENABLE | ||
| 302 | if (play_sound) { PLAY_SONG(plover_song); } | ||
| 303 | #endif | ||
| 304 | layer_on(_ADJUST); | ||
| 305 | } else { | ||
| 306 | #ifdef AUDIO_ENABLE | ||
| 307 | if (play_sound) { PLAY_SONG(plover_gb_song); } | ||
| 308 | #endif | ||
| 309 | layer_off(_ADJUST); | ||
| 310 | } | ||
| 311 | #ifdef AUDIO_ENABLE | ||
| 312 | play_sound = true; | ||
| 313 | #endif | ||
| 314 | break; | ||
| 315 | } | ||
| 316 | case 1: | ||
| 317 | if (active) { | ||
| 318 | muse_mode = true; | ||
| 319 | } else { | ||
| 320 | muse_mode = false; | ||
| 321 | } | ||
| 322 | } | ||
| 323 | } | ||
| 324 | |||
| 325 | void keyboard_post_init_keymap(void) { | ||
| 326 | bspc_timer = 0; | ||
| 327 | } | ||
| 328 | |||
| 329 | LEADER_EXTERNS(); | ||
| 330 | |||
| 331 | void matrix_scan_keymap(void) { | ||
| 332 | #ifdef AUDIO_ENABLE | ||
| 333 | if (muse_mode) { | ||
| 334 | if (muse_counter == 0) { | ||
| 335 | uint8_t muse_note = muse_offset + SCALE[muse_clock_pulse()]; | ||
| 336 | if (muse_note != last_muse_note) { | ||
| 337 | stop_note(compute_freq_for_midi_note(last_muse_note)); | ||
| 338 | play_note(compute_freq_for_midi_note(muse_note), 0xF); | ||
| 339 | last_muse_note = muse_note; | ||
| 340 | } | ||
| 341 | } | ||
| 342 | muse_counter = (muse_counter + 1) % muse_tempo; | ||
| 343 | } else { | ||
| 344 | if (muse_counter) { | ||
| 345 | stop_all_notes(); | ||
| 346 | muse_counter = 0; | ||
| 347 | } | ||
| 348 | } | ||
| 349 | #endif | ||
| 350 | // if MY_BSPC is held down too long, pretend like it wasn't and start | ||
| 351 | // pressing backspace | ||
| 352 | if (bspc_timer > 0 && timer_elapsed(bspc_timer) > LEADER_TIMEOUT) { | ||
| 353 | layer_off(_KP); | ||
| 354 | bspc_timer = 0; | ||
| 355 | register_code(KC_BSPC); | ||
| 356 | } | ||
| 357 | LEADER_DICTIONARY() { | ||
| 358 | leading = false; | ||
| 359 | leader_end(); | ||
| 360 | |||
| 361 | SEQ_ONE_KEY(KC_K) { | ||
| 362 | layer_invert(_KP); | ||
| 363 | } | ||
| 364 | SEQ_ONE_KEY(KC_G) { | ||
| 365 | layer_invert(_GAME); | ||
| 366 | } | ||
| 367 | SEQ_ONE_KEY(KC_KP_5) { | ||
| 368 | layer_invert(_KP); | ||
| 369 | } | ||
| 370 | SEQ_ONE_KEY(KC_5) { | ||
| 371 | layer_invert(_KP); | ||
| 372 | } | ||
| 373 | SEQ_TWO_KEYS(KC_SCLN, KC_1) { | ||
| 374 | send_secret_string(0); | ||
| 375 | } | ||
| 376 | SEQ_TWO_KEYS(KC_SCLN, KC_2) { | ||
| 377 | send_secret_string(1); | ||
| 378 | } | ||
| 379 | SEQ_TWO_KEYS(KC_SCLN, KC_3) { | ||
| 380 | send_secret_string(2); | ||
| 381 | } | ||
| 382 | SEQ_TWO_KEYS(KC_SCLN, KC_4) { | ||
| 383 | send_secret_string(3); | ||
| 384 | } | ||
| 385 | SEQ_TWO_KEYS(KC_SCLN, KC_5) { | ||
| 386 | send_secret_string(4); | ||
| 387 | } | ||
| 388 | SEQ_TWO_KEYS(KC_SCLN, KC_6) { | ||
| 389 | send_secret_string(5); | ||
| 390 | } | ||
| 391 | SEQ_TWO_KEYS(KC_SCLN, KC_M) { | ||
| 392 | send_secret_string(0); | ||
| 393 | } | ||
| 394 | SEQ_TWO_KEYS(KC_SCLN, KC_COMM) { | ||
| 395 | send_secret_string(1); | ||
| 396 | } | ||
| 397 | SEQ_TWO_KEYS(KC_SCLN, KC_DOT) { | ||
| 398 | send_secret_string(2); | ||
| 399 | } | ||
| 400 | SEQ_TWO_KEYS(KC_SCLN, KC_J) { | ||
| 401 | send_secret_string(3); | ||
| 402 | } | ||
| 403 | SEQ_TWO_KEYS(KC_SCLN, KC_K) { | ||
| 404 | send_secret_string(4); | ||
| 405 | } | ||
| 406 | SEQ_TWO_KEYS(KC_SCLN, KC_L) { | ||
| 407 | send_secret_string(5); | ||
| 408 | } | ||
| 409 | SEQ_ONE_KEY(KC_C) { | ||
| 410 | tap_code16(C(KC_C)); | ||
| 411 | } | ||
| 412 | } | ||
| 413 | } | ||
| 414 | |||
| 415 | bool music_mask_user(uint16_t keycode) { | ||
| 416 | switch (keycode) { | ||
| 417 | case RAISE: | ||
| 418 | case LOWER: | ||
| 419 | return false; | ||
| 420 | default: | ||
| 421 | return true; | ||
| 422 | } | ||
| 423 | } | ||
diff --git a/keyboards/planck/keymaps/jdelkins/readme.md b/keyboards/planck/keymaps/jdelkins/readme.md new file mode 100644 index 000000000..5149c7668 --- /dev/null +++ b/keyboards/planck/keymaps/jdelkins/readme.md | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | # jdelkins layout | ||
| 2 | |||
| 3 | Features: | ||
| 4 | |||
| 5 | - 2x2u layout with the split spaces both operating as layer keys | ||
| 6 | - No top row numbers; rely on a keypad layer | ||
| 7 | - My typical leader setup for toggling modes, accessing secrets, etc. | ||
| 8 | |||
| 9 | |||
| 10 | # TODO | ||
| 11 | |||
| 12 | - Add/improve audio features | ||
| 13 | - Fix \_ADJUST layer - there's a bunch of junk on there that needs cleanng up. | ||
diff --git a/keyboards/planck/keymaps/jdelkins/rules.mk b/keyboards/planck/keymaps/jdelkins/rules.mk new file mode 100644 index 000000000..f17e67c23 --- /dev/null +++ b/keyboards/planck/keymaps/jdelkins/rules.mk | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | SRC += muse.c | ||
| 2 | LEADER_ENABLE = yes | ||
| 3 | TAP_DANCE_ENABLE = yes | ||
| 4 | AUTO_SHIFT_ENABLE = yes | ||
diff --git a/users/jdelkins/.gitignore b/users/jdelkins/.gitignore new file mode 100644 index 000000000..03b2b4666 --- /dev/null +++ b/users/jdelkins/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| secrets.h | |||
diff --git a/users/jdelkins/jdelkins.c b/users/jdelkins/jdelkins.c new file mode 100644 index 000000000..7577512ec --- /dev/null +++ b/users/jdelkins/jdelkins.c | |||
| @@ -0,0 +1,274 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include "jdelkins.h" | ||
| 19 | #include "version.h" | ||
| 20 | |||
| 21 | #ifdef DO_SECRETS | ||
| 22 | # include "secrets.h" | ||
| 23 | #else | ||
| 24 | # ifndef NO_SECRETS | ||
| 25 | # pragma message("Warning: secrets.h not found") | ||
| 26 | # endif | ||
| 27 | #endif | ||
| 28 | |||
| 29 | user_config_t user_config; | ||
| 30 | |||
| 31 | __attribute__ ((weak)) | ||
| 32 | bool process_record_keymap(uint16_t keycode, keyrecord_t *record) { | ||
| 33 | return true; | ||
| 34 | } | ||
| 35 | |||
| 36 | void send_secret_string(uint8_t n) { | ||
| 37 | #ifdef DO_SECRETS | ||
| 38 | send_string(secret[n]); | ||
| 39 | #else | ||
| 40 | SEND_STRING(""); | ||
| 41 | #endif | ||
| 42 | } | ||
| 43 | |||
| 44 | #ifdef TAP_DANCE_ENABLE | ||
| 45 | |||
| 46 | // To activate SINGLE_HOLD, you will need to hold for 200ms first. | ||
| 47 | // This tap dance favors keys that are used frequently in typing like 'f' | ||
| 48 | int cur_dance(qk_tap_dance_state_t *state) { | ||
| 49 | if (state->count == 1) { | ||
| 50 | // If count = 1, and it has been interrupted - it doesn't matter if it | ||
| 51 | // is pressed or not: Send SINGLE_TAP | ||
| 52 | if (state->interrupted) { | ||
| 53 | // if (!state->pressed) return SINGLE_TAP; | ||
| 54 | // need "permissive hold" here. | ||
| 55 | // else return SINsGLE_HOLD; | ||
| 56 | // If the interrupting key is released before the tap-dance key, | ||
| 57 | // then it is a single HOLD However, if the tap-dance key is | ||
| 58 | // released first, then it is a single TAP But how to get access to | ||
| 59 | // the state of the interrupting key???? | ||
| 60 | return SINGLE_TAP; | ||
| 61 | } else { | ||
| 62 | if (!state->pressed) | ||
| 63 | return SINGLE_TAP; | ||
| 64 | else | ||
| 65 | return SINGLE_HOLD; | ||
| 66 | } | ||
| 67 | } | ||
| 68 | // If count = 2, and it has been interrupted - assume that user is trying to | ||
| 69 | // type the letter associated with single tap. | ||
| 70 | else if (state->count == 2) { | ||
| 71 | if (state->interrupted) | ||
| 72 | return DOUBLE_SINGLE_TAP; | ||
| 73 | else if (state->pressed) | ||
| 74 | return DOUBLE_HOLD; | ||
| 75 | else | ||
| 76 | return DOUBLE_TAP; | ||
| 77 | } else if ((state->count == 3) && ((state->interrupted) || (!state->pressed))) | ||
| 78 | return TRIPLE_TAP; | ||
| 79 | else if (state->count == 3) | ||
| 80 | return TRIPLE_HOLD; | ||
| 81 | else | ||
| 82 | return 8; // magic number. At some point this method will expand to work for more presses | ||
| 83 | } | ||
| 84 | |||
| 85 | // This works well if you want this key to work as a "fast modifier". It favors | ||
| 86 | // being held over being tapped. | ||
| 87 | int hold_cur_dance(qk_tap_dance_state_t *state) { | ||
| 88 | if (state->count == 1) { | ||
| 89 | if (state->interrupted) { | ||
| 90 | if (!state->pressed) | ||
| 91 | return SINGLE_TAP; | ||
| 92 | else | ||
| 93 | return SINGLE_HOLD; | ||
| 94 | } else { | ||
| 95 | if (!state->pressed) | ||
| 96 | return SINGLE_TAP; | ||
| 97 | else | ||
| 98 | return SINGLE_HOLD; | ||
| 99 | } | ||
| 100 | } | ||
| 101 | // If count = 2, and it has been interrupted - assume that user is trying to | ||
| 102 | // type the letter associated with single tap. | ||
| 103 | else if (state->count == 2) { | ||
| 104 | if (state->pressed) | ||
| 105 | return DOUBLE_HOLD; | ||
| 106 | else | ||
| 107 | return DOUBLE_TAP; | ||
| 108 | } else if (state->count == 3) { | ||
| 109 | if (!state->pressed) | ||
| 110 | return TRIPLE_TAP; | ||
| 111 | else | ||
| 112 | return TRIPLE_HOLD; | ||
| 113 | } else | ||
| 114 | return 8; // magic number. At some point this method will expand to work for more presses | ||
| 115 | } | ||
| 116 | |||
| 117 | #endif // TAP_DANCE_ENABLE | ||
| 118 | |||
| 119 | __attribute__ ((weak)) | ||
| 120 | void keyboard_post_init_keymap(void) { | ||
| 121 | } | ||
| 122 | |||
| 123 | void keyboard_post_init_user(void) { | ||
| 124 | user_config.raw = eeconfig_read_user(); | ||
| 125 | keyboard_post_init_keymap(); | ||
| 126 | } | ||
| 127 | |||
| 128 | void eeconfig_init_user(void) { | ||
| 129 | user_config.raw = 0; | ||
| 130 | user_config.system_mac = false; | ||
| 131 | eeconfig_update_user(user_config.raw); | ||
| 132 | } | ||
| 133 | |||
| 134 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 135 | static uint32_t boot_timer; | ||
| 136 | |||
| 137 | if (!process_record_keymap(keycode, record)) { | ||
| 138 | return false; | ||
| 139 | } | ||
| 140 | |||
| 141 | switch (keycode) { | ||
| 142 | case FW_WRD: | ||
| 143 | do_mac_key(LCTL(KC_RIGHT), ROPT(KC_RIGHT), record); | ||
| 144 | break; | ||
| 145 | |||
| 146 | case BK_WRD: | ||
| 147 | do_mac_key(LCTL(KC_LEFT), ROPT(KC_LEFT), record); | ||
| 148 | break; | ||
| 149 | |||
| 150 | case KB_BOL: | ||
| 151 | do_mac_key(KC_HOME, RCMD(KC_LEFT), record); | ||
| 152 | break; | ||
| 153 | |||
| 154 | case KB_EOL: | ||
| 155 | do_mac_key(KC_END, RCMD(KC_RIGHT), record); | ||
| 156 | break; | ||
| 157 | |||
| 158 | case TG_SYS: | ||
| 159 | if (record->event.pressed) { | ||
| 160 | user_config.system_mac ^= 1; | ||
| 161 | eeconfig_update_user(user_config.raw); | ||
| 162 | } | ||
| 163 | break; | ||
| 164 | |||
| 165 | case KB_COPY: | ||
| 166 | do_mac_key(LCTL(KC_INS), RCMD(KC_C), record); | ||
| 167 | break; | ||
| 168 | |||
| 169 | case KB_PASTE: | ||
| 170 | do_mac_key(LSFT(KC_INS), RCMD(KC_V), record); | ||
| 171 | break; | ||
| 172 | |||
| 173 | case MY_GUI: | ||
| 174 | do_mac_key(KC_LGUI, KC_LOPT, record); | ||
| 175 | break; | ||
| 176 | |||
| 177 | case MY_ALT: | ||
| 178 | do_mac_key(KC_LALT, KC_LCMD, record); | ||
| 179 | break; | ||
| 180 | |||
| 181 | case MY_RGUI: | ||
| 182 | do_mac_key(KC_RGUI, KC_ROPT, record); | ||
| 183 | break; | ||
| 184 | |||
| 185 | case MY_RALT: | ||
| 186 | do_mac_key(KC_RALT, KC_RCMD, record); | ||
| 187 | break; | ||
| 188 | |||
| 189 | case MY_CALC: | ||
| 190 | do_mac_key(KC_CALC, KC_F14, record); | ||
| 191 | break; | ||
| 192 | |||
| 193 | case KB_MAKE: | ||
| 194 | if (!get_mods()) { | ||
| 195 | if (!record->event.pressed) | ||
| 196 | SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP SS_TAP(X_ENTER)); | ||
| 197 | return false; | ||
| 198 | } | ||
| 199 | break; | ||
| 200 | |||
| 201 | case KB_VRSN: | ||
| 202 | if (!get_mods()) { | ||
| 203 | if (!record->event.pressed) { | ||
| 204 | if (user_config.system_mac) { | ||
| 205 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " (mac mode)"); | ||
| 206 | } else { | ||
| 207 | SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION " (non-mac mode)"); | ||
| 208 | } | ||
| 209 | } | ||
| 210 | return false; | ||
| 211 | } | ||
| 212 | break; | ||
| 213 | |||
| 214 | case KB_BOOT: | ||
| 215 | if (!get_mods()) { | ||
| 216 | if (record->event.pressed) { | ||
| 217 | boot_timer = timer_read32(); | ||
| 218 | } else { | ||
| 219 | if (timer_elapsed32(boot_timer) >= 500) { | ||
| 220 | reset_keyboard(); | ||
| 221 | } | ||
| 222 | } | ||
| 223 | return false; | ||
| 224 | } | ||
| 225 | break; | ||
| 226 | |||
| 227 | case KB_FLSH: | ||
| 228 | if (!get_mods()) { | ||
| 229 | if (!record->event.pressed) { | ||
| 230 | SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP ":flash\n"); | ||
| 231 | reset_keyboard(); | ||
| 232 | } | ||
| 233 | return false; | ||
| 234 | } | ||
| 235 | break; | ||
| 236 | |||
| 237 | #ifdef DO_SECRETS | ||
| 238 | case KC_SECRET_1 ... KC_SECRET_5: // Secrets! Externally defined strings, not stored in repo | ||
| 239 | if (!record->event.pressed) { | ||
| 240 | clear_oneshot_layer_state(ONESHOT_OTHER_KEY_PRESSED); | ||
| 241 | send_secret_string(keycode - KC_SECRET_1); | ||
| 242 | } | ||
| 243 | return false; | ||
| 244 | break; | ||
| 245 | #endif | ||
| 246 | } | ||
| 247 | |||
| 248 | return true; | ||
| 249 | } | ||
| 250 | |||
| 251 | __attribute__ ((weak)) | ||
| 252 | void matrix_init_keymap(void) { | ||
| 253 | } | ||
| 254 | |||
| 255 | void matrix_init_user(void) { | ||
| 256 | matrix_init_keymap(); | ||
| 257 | } | ||
| 258 | |||
| 259 | __attribute__ ((weak)) | ||
| 260 | void matrix_scan_keymap(void) { | ||
| 261 | } | ||
| 262 | |||
| 263 | void matrix_scan_user(void) { | ||
| 264 | matrix_scan_keymap(); | ||
| 265 | } | ||
| 266 | |||
| 267 | __attribute__ ((weak)) | ||
| 268 | layer_state_t layer_state_set_keymap(layer_state_t state) { | ||
| 269 | return state; | ||
| 270 | } | ||
| 271 | |||
| 272 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 273 | return layer_state_set_keymap(state); | ||
| 274 | } | ||
diff --git a/users/jdelkins/jdelkins.h b/users/jdelkins/jdelkins.h new file mode 100644 index 000000000..ddec8dc4a --- /dev/null +++ b/users/jdelkins/jdelkins.h | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | /* | ||
| 2 | Copyright 2020 Joel Elkins <joel@elkins.com> | ||
| 3 | |||
| 4 | This program is free software: you can redistribute it and/or modify | ||
| 5 | it under the terms of the GNU General Public License as published by | ||
| 6 | the Free Software Foundation, either version 2 of the License, or | ||
| 7 | (at your option) any later version. | ||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, | ||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | GNU General Public License for more details. | ||
| 13 | |||
| 14 | You should have received a copy of the GNU General Public License | ||
| 15 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 16 | */ | ||
| 17 | |||
| 18 | #pragma once | ||
| 19 | |||
| 20 | #include QMK_KEYBOARD_H | ||
| 21 | |||
| 22 | // Secrets | ||
| 23 | |||
| 24 | #if !defined(NO_SECRETS) && __has_include("secrets.h") | ||
| 25 | # define DO_SECRETS | ||
| 26 | #endif | ||
| 27 | |||
| 28 | void send_secret_string(uint8_t n); | ||
| 29 | |||
| 30 | // standard layers | ||
| 31 | |||
| 32 | enum jdelkins_layers { | ||
| 33 | _QWERTY = 0, | ||
| 34 | _RPT, | ||
| 35 | _GAME, | ||
| 36 | _FUNC, | ||
| 37 | _KP, | ||
| 38 | _SECRETS, | ||
| 39 | _ADJUST, | ||
| 40 | _LAYER_MAX | ||
| 41 | }; | ||
| 42 | |||
| 43 | // key definitions | ||
| 44 | |||
| 45 | typedef union { | ||
| 46 | uint32_t raw; | ||
| 47 | struct { | ||
| 48 | bool system_mac :1; | ||
| 49 | }; | ||
| 50 | } user_config_t; | ||
| 51 | |||
| 52 | extern user_config_t user_config; | ||
| 53 | |||
| 54 | static inline void do_mac_key(uint16_t norm_key, uint16_t mac_key, keyrecord_t *record) { | ||
| 55 | uint16_t key = user_config.system_mac ? mac_key : norm_key; | ||
| 56 | if (record->event.pressed) | ||
| 57 | register_code16(key); | ||
| 58 | else | ||
| 59 | unregister_code16(key); | ||
| 60 | } | ||
| 61 | |||
| 62 | enum jdelkins_keycodes { | ||
| 63 | KB_MAKE = SAFE_RANGE, | ||
| 64 | KB_FLSH, | ||
| 65 | KB_VRSN, | ||
| 66 | KB_BOOT, | ||
| 67 | FW_WRD, | ||
| 68 | BK_WRD, | ||
| 69 | KB_BOL, | ||
| 70 | KB_EOL, | ||
| 71 | TG_SYS, | ||
| 72 | KB_COPY, | ||
| 73 | KB_PASTE, | ||
| 74 | MY_GUI, | ||
| 75 | MY_ALT, | ||
| 76 | MY_RGUI, | ||
| 77 | MY_RALT, | ||
| 78 | MY_CALC, | ||
| 79 | |||
| 80 | #ifdef DO_SECRETS | ||
| 81 | KC_SECRET_1, | ||
| 82 | KC_SECRET_2, | ||
| 83 | KC_SECRET_3, | ||
| 84 | KC_SECRET_4, | ||
| 85 | KC_SECRET_5, | ||
| 86 | KC_SECRET_6, | ||
| 87 | #endif | ||
| 88 | |||
| 89 | USER_SAFE_RANGE, | ||
| 90 | }; | ||
| 91 | |||
| 92 | #ifdef DO_SECRETS | ||
| 93 | # define KC_SEC1 KC_SECRET_1 | ||
| 94 | # define KC_SEC2 KC_SECRET_2 | ||
| 95 | # define KC_SEC3 KC_SECRET_3 | ||
| 96 | # define KC_SEC4 KC_SECRET_4 | ||
| 97 | # define KC_SEC5 KC_SECRET_5 | ||
| 98 | # define KC_SEC6 KC_SECRET_6 | ||
| 99 | #else | ||
| 100 | # define KC_SEC1 KC_NO | ||
| 101 | # define KC_SEC2 KC_NO | ||
| 102 | # define KC_SEC3 KC_NO | ||
| 103 | # define KC_SEC4 KC_NO | ||
| 104 | # define KC_SEC5 KC_NO | ||
| 105 | # define KC_SEC6 KC_NO | ||
| 106 | #endif | ||
| 107 | |||
| 108 | #define MODS_SHIFT (get_mods() & MOD_MASK_SHIFT) | ||
| 109 | #define MODS_CTRL (get_mods() & MOD_MASK_CTRL) | ||
| 110 | #define MODS_ALT (get_mods() & MOD_MASK_ALT) | ||
| 111 | #define MODS_GUI (get_mods() & MOD_MASK_GUI) | ||
| 112 | |||
| 113 | #define MY_CAPS LCTL_T(KC_CAPS) | ||
| 114 | #define MY_SPC LT(_FUNC, KC_SPC) | ||
| 115 | |||
| 116 | #define NUMLOCK_ON host_keyboard_led_state().num_lock | ||
| 117 | #define CAPSLOCK_ON host_keyboard_led_state().caps_lock | ||
| 118 | |||
| 119 | #ifdef TAP_DANCE_ENABLE | ||
| 120 | |||
| 121 | enum { | ||
| 122 | SINGLE_TAP = 1, | ||
| 123 | SINGLE_HOLD = 2, | ||
| 124 | DOUBLE_TAP = 3, | ||
| 125 | DOUBLE_HOLD = 4, | ||
| 126 | DOUBLE_SINGLE_TAP = 5, //send two single taps | ||
| 127 | TRIPLE_TAP = 6, | ||
| 128 | TRIPLE_HOLD = 7 | ||
| 129 | }; | ||
| 130 | |||
| 131 | int cur_dance(qk_tap_dance_state_t *state); // prefer tap | ||
| 132 | int hold_cur_dance(qk_tap_dance_state_t *state); // prefer hold | ||
| 133 | |||
| 134 | #endif // TAP_DANCE_ENABLE | ||
diff --git a/users/jdelkins/rules.mk b/users/jdelkins/rules.mk new file mode 100644 index 000000000..b9d377b28 --- /dev/null +++ b/users/jdelkins/rules.mk | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | SRC += jdelkins.c | ||
| 2 | |||
| 3 | ifeq ($(strip $(NO_SECRETS)), yes) | ||
| 4 | OPT_DEFS += -DNO_SECRETS | ||
| 5 | endif | ||
| 6 | |||
| 7 | users/jdelkins/secrets.h: users/jdelkins/secrets.h.gpg | ||
| 8 | gpg -d $< >$@ | ||
| 9 | |||
| 10 | BOOTMAGIC_ENABLE = no | ||
