diff options
Diffstat (limited to 'layouts/community/ortho_5x12/xyverz/keymap.c')
| -rw-r--r-- | layouts/community/ortho_5x12/xyverz/keymap.c | 141 |
1 files changed, 36 insertions, 105 deletions
diff --git a/layouts/community/ortho_5x12/xyverz/keymap.c b/layouts/community/ortho_5x12/xyverz/keymap.c index bbf1d7bb0..2cca237bb 100644 --- a/layouts/community/ortho_5x12/xyverz/keymap.c +++ b/layouts/community/ortho_5x12/xyverz/keymap.c | |||
| @@ -1,34 +1,15 @@ | |||
| 1 | #include QMK_KEYBOARD_H | 1 | #include QMK_KEYBOARD_H |
| 2 | #include "action_layer.h" | ||
| 3 | #include "eeconfig.h" | ||
| 4 | 2 | ||
| 5 | extern keymap_config_t keymap_config; | 3 | enum layer_names { _QWERTY, _COLEMAK, _DVORAK, _LOWER, _RAISE, _ADJUST }; |
| 6 | 4 | ||
| 7 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | 5 | enum custom_keycodes { QWERTY = SAFE_RANGE, COLEMAK, DVORAK, LOWER, RAISE, ADJUST }; |
| 8 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 9 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 10 | // entirely and just use numbers. | ||
| 11 | #define _QWERTY 0 | ||
| 12 | #define _COLEMAK 1 | ||
| 13 | #define _DVORAK 2 | ||
| 14 | #define _LOWER 3 | ||
| 15 | #define _RAISE 4 | ||
| 16 | #define _ADJUST 16 | ||
| 17 | |||
| 18 | enum custom_keycodes { | ||
| 19 | QWERTY = SAFE_RANGE, | ||
| 20 | COLEMAK, | ||
| 21 | DVORAK, | ||
| 22 | LOWER, | ||
| 23 | RAISE, | ||
| 24 | ADJUST, | ||
| 25 | }; | ||
| 26 | 6 | ||
| 27 | // Aliases to keep the keymap tidy | 7 | // Aliases to keep the keymap tidy |
| 28 | #define GUIBSPC GUI_T(KC_BSPC) // GUI when held, BSPC when tapped. | 8 | #define GUIBSPC GUI_T(KC_BSPC) // GUI when held, BSPC when tapped. |
| 29 | #define RGB_SWR RGB_M_SW // Swirl Animation alias | 9 | #define RGB_SWR RGB_M_SW // Swirl Animation alias |
| 30 | #define RGB_SNK RGB_M_SN // Snake Animation alias | 10 | #define RGB_SNK RGB_M_SN // Snake Animation alias |
| 31 | 11 | ||
| 12 | // clang-format off | ||
| 32 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | 13 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { |
| 33 | 14 | ||
| 34 | /* Qwerty | 15 | /* Qwerty |
| @@ -50,7 +31,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 50 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ | 31 | KC_ESC, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \ |
| 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, \ | 32 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ |
| 52 | KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ | 33 | KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ |
| 53 | ), | 34 | ), |
| 54 | 35 | ||
| 55 | /* Colemak | 36 | /* Colemak |
| 56 | * ,-----------------------------------------------------------------------------------. | 37 | * ,-----------------------------------------------------------------------------------. |
| @@ -71,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 71 | KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ | 52 | KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \ |
| 72 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ | 53 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, \ |
| 73 | KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ | 54 | KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ |
| 74 | ), | 55 | ), |
| 75 | 56 | ||
| 76 | /* Dvorak | 57 | /* Dvorak |
| 77 | * ,-----------------------------------------------------------------------------------. | 58 | * ,-----------------------------------------------------------------------------------. |
| @@ -92,7 +73,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 92 | KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ | 73 | KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_MINS, \ |
| 93 | KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, \ | 74 | KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_RSFT, \ |
| 94 | KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ | 75 | KC_LCTL, KC_LALT, KC_LEFT, KC_RGHT, LOWER, GUIBSPC, KC_SPC, RAISE, KC_UP, KC_DOWN, KC_RGUI, KC_ENT \ |
| 95 | ), | 76 | ), |
| 96 | 77 | ||
| 97 | /* Lower | 78 | /* Lower |
| 98 | * ,-----------------------------------------------------------------------------------. | 79 | * ,-----------------------------------------------------------------------------------. |
| @@ -113,7 +94,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 113 | KC_CAPS, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, KC_PLUS, KC_LCBR, KC_RCBR, _______, \ | 94 | KC_CAPS, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, KC_PLUS, KC_LCBR, KC_RCBR, _______, \ |
| 114 | _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, \ | 95 | _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, \ |
| 115 | BL_STEP, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \ | 96 | BL_STEP, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \ |
| 116 | ), | 97 | ), |
| 117 | 98 | ||
| 118 | /* Raise | 99 | /* Raise |
| 119 | * ,-----------------------------------------------------------------------------------. | 100 | * ,-----------------------------------------------------------------------------------. |
| @@ -134,7 +115,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 134 | KC_CAPS, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, KC_EQL, KC_LBRC, KC_RBRC, _______, \ | 115 | KC_CAPS, _______, KC_MUTE, KC_VOLD, KC_VOLU, _______, _______, _______, KC_EQL, KC_LBRC, KC_RBRC, _______, \ |
| 135 | _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, \ | 116 | _______, _______, KC_MPRV, KC_MPLY, KC_MNXT, _______, _______, _______, KC_PSCR, KC_SLCK, KC_PAUS, _______, \ |
| 136 | BL_STEP, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \ | 117 | BL_STEP, _______, KC_HOME, KC_END, _______, KC_DEL, KC_INS, _______, KC_PGUP, KC_PGDN, _______, _______ \ |
| 137 | ), | 118 | ), |
| 138 | 119 | ||
| 139 | /* Adjust (Lower + Raise) | 120 | /* Adjust (Lower + Raise) |
| 140 | * ,-----------------------------------------------------------------------------------. | 121 | * ,-----------------------------------------------------------------------------------. |
| @@ -155,92 +136,42 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |||
| 155 | _______, _______, RGB_M_P, RGB_M_B, RGB_M_R, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ | 136 | _______, _______, RGB_M_P, RGB_M_B, RGB_M_R, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \ |
| 156 | RGB_TOG, RGB_MOD, RGB_SWR, RGB_M_K, RGB_M_G, RGB_HUI, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, \ | 137 | RGB_TOG, RGB_MOD, RGB_SWR, RGB_M_K, RGB_M_G, RGB_HUI, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, \ |
| 157 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ | 138 | _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ \ |
| 158 | ) | 139 | ) |
| 159 | |||
| 160 | |||
| 161 | }; | 140 | }; |
| 162 | 141 | ||
| 142 | // clang-format on | ||
| 143 | |||
| 163 | #ifdef AUDIO_ENABLE | 144 | #ifdef AUDIO_ENABLE |
| 164 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); | 145 | float tone_qwerty[][2] = SONG(QWERTY_SOUND); |
| 165 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); | 146 | float tone_dvorak[][2] = SONG(DVORAK_SOUND); |
| 166 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); | 147 | float tone_colemak[][2] = SONG(COLEMAK_SOUND); |
| 167 | #endif | 148 | #endif |
| 168 | 149 | ||
| 169 | void persistent_default_layer_set(uint16_t default_layer) { | ||
| 170 | eeconfig_update_default_layer(default_layer); | ||
| 171 | default_layer_set(default_layer); | ||
| 172 | } | ||
| 173 | |||
| 174 | void matrix_init_user(void) { | 150 | void matrix_init_user(void) { |
| 175 | #ifdef BOOTLOADER_CATERINA | 151 | #ifdef BOOTLOADER_CATERINA |
| 176 | // This will disable the red LEDs on the ProMicros | 152 | // This will disable the red LEDs on the ProMicros |
| 177 | DDRD &= ~(1<<5); | 153 | setPinInput(D5); |
| 178 | PORTD &= ~(1<<5); | 154 | writePinLow(D5); |
| 179 | DDRB &= ~(1<<0); | 155 | setPinInput(B0); |
| 180 | PORTB &= ~(1<<0); | 156 | writePinLow(B0); |
| 181 | #endif | 157 | #endif |
| 182 | }; | 158 | }; |
| 183 | 159 | ||
| 160 | layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); }; | ||
| 161 | |||
| 184 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | 162 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { |
| 185 | switch (keycode) { | 163 | if (record->event.pressed) { |
| 186 | case QWERTY: | 164 | switch (keycode) { |
| 187 | if (record->event.pressed) { | 165 | case QWERTY: |
| 188 | #ifdef AUDIO_ENABLE | 166 | set_single_persistent_default_layer(_QWERTY); |
| 189 | PLAY_NOTE_ARRAY(tone_qwerty, false, 0); | 167 | return false; |
| 190 | #endif | 168 | case COLEMAK: |
| 191 | persistent_default_layer_set(1UL<<_QWERTY); | 169 | set_single_persistent_default_layer(_COLEMAK); |
| 192 | } | 170 | return false; |
| 193 | return false; | 171 | case DVORAK: |
| 194 | break; | 172 | set_single_persistent_default_layer(_DVORAK); |
| 195 | case COLEMAK: | 173 | return false; |
| 196 | if (record->event.pressed) { | 174 | } |
| 197 | #ifdef AUDIO_ENABLE | 175 | } |
| 198 | PLAY_NOTE_ARRAY(tone_colemak, false, 0); | 176 | return true; |
| 199 | #endif | 177 | } \ No newline at end of file |
| 200 | persistent_default_layer_set(1UL<<_COLEMAK); | ||
| 201 | } | ||
| 202 | return false; | ||
| 203 | break; | ||
| 204 | case DVORAK: | ||
| 205 | if (record->event.pressed) { | ||
| 206 | #ifdef AUDIO_ENABLE | ||
| 207 | PLAY_NOTE_ARRAY(tone_dvorak, false, 0); | ||
| 208 | #endif | ||
| 209 | persistent_default_layer_set(1UL<<_DVORAK); | ||
| 210 | } | ||
| 211 | return false; | ||
| 212 | break; | ||
| 213 | case LOWER: | ||
| 214 | if (record->event.pressed) { | ||
| 215 | layer_on(_LOWER); | ||
| 216 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 217 | } else { | ||
| 218 | layer_off(_LOWER); | ||
| 219 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 220 | } | ||
| 221 | return false; | ||
| 222 | break; | ||
| 223 | case RAISE: | ||
| 224 | if (record->event.pressed) { | ||
| 225 | layer_on(_RAISE); | ||
| 226 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 227 | } else { | ||
| 228 | layer_off(_RAISE); | ||
| 229 | update_tri_layer(_LOWER, _RAISE, _ADJUST); | ||
| 230 | } | ||
| 231 | return false; | ||
| 232 | break; | ||
| 233 | /* case BACKLIT: | ||
| 234 | if (record->event.pressed) { | ||
| 235 | register_code(KC_RSFT); | ||
| 236 | #ifdef BACKLIGHT_ENABLE | ||
| 237 | backlight_step(); | ||
| 238 | #endif | ||
| 239 | } else { | ||
| 240 | unregister_code(KC_RSFT); | ||
| 241 | } | ||
| 242 | return false; | ||
| 243 | break; */ | ||
| 244 | } | ||
| 245 | return true; | ||
| 246 | } | ||
