diff options
Diffstat (limited to 'keyboards/zinc/keymaps/via/keymap.c')
| -rw-r--r-- | keyboards/zinc/keymaps/via/keymap.c | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/keyboards/zinc/keymaps/via/keymap.c b/keyboards/zinc/keymaps/via/keymap.c new file mode 100644 index 000000000..7c961c710 --- /dev/null +++ b/keyboards/zinc/keymaps/via/keymap.c | |||
| @@ -0,0 +1,203 @@ | |||
| 1 | /* Copyright 2020 monksoffunk | ||
| 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 | #include QMK_KEYBOARD_H | ||
| 18 | |||
| 19 | #ifdef RGBLIGHT_ENABLE | ||
| 20 | //Following line allows macro to read current RGB settings | ||
| 21 | |||
| 22 | // Light LEDs 6 to 9 and 12 to 15 red when caps lock is active. Hard to ignore! | ||
| 23 | const rgblight_segment_t PROGMEM capslock_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 24 | {12, 1, HSV_RED} // Light 4 LEDs, starting with LED 6 | ||
| 25 | ); | ||
| 26 | // Light LEDs 9 & 10 in cyan when keyboard layer 1 is active | ||
| 27 | const rgblight_segment_t PROGMEM lower_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 28 | {24, 6, HSV_GOLDENROD} | ||
| 29 | ); | ||
| 30 | // Light LEDs 11 & 12 in purple when keyboard layer 2 is active | ||
| 31 | const rgblight_segment_t PROGMEM raise_layer[] = RGBLIGHT_LAYER_SEGMENTS( | ||
| 32 | {54, 6, HSV_GOLDENROD} | ||
| 33 | ); | ||
| 34 | |||
| 35 | // Now define the array of layers. Later layers take precedence | ||
| 36 | const rgblight_segment_t* const PROGMEM rgb_layers[] = RGBLIGHT_LAYERS_LIST( | ||
| 37 | capslock_layer, | ||
| 38 | lower_layer, | ||
| 39 | raise_layer | ||
| 40 | ); | ||
| 41 | |||
| 42 | void keyboard_post_init_user(void) { | ||
| 43 | // Enable the LED layers | ||
| 44 | rgblight_layers = rgb_layers; | ||
| 45 | } | ||
| 46 | #endif | ||
| 47 | |||
| 48 | extern uint8_t is_master; | ||
| 49 | |||
| 50 | // Each layer gets a name for readability, which is then used in the keymap matrix below. | ||
| 51 | // The underscores don't mean anything - you can have a layer called STUFF or any other name. | ||
| 52 | // Layer names don't all need to be of the same length, obviously, and you can also skip them | ||
| 53 | // entirely and just use numbers. | ||
| 54 | enum layer_number { | ||
| 55 | _QWERTY = 0, | ||
| 56 | _LOWER, | ||
| 57 | _RAISE, | ||
| 58 | _ADJUST, | ||
| 59 | _ADJUST2 | ||
| 60 | }; | ||
| 61 | |||
| 62 | enum custom_keycodes { | ||
| 63 | QWERTY = SAFE_RANGE, | ||
| 64 | KANA, | ||
| 65 | EISU, | ||
| 66 | ADJUST, | ||
| 67 | RGBRST | ||
| 68 | }; | ||
| 69 | |||
| 70 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 71 | /* Qwerty | ||
| 72 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 73 | * | Tab | Q | W | E | R | T | | Y | U | I | O | P | Bksp | | ||
| 74 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 75 | * | Ctrl | A | S | D | F | G | | H | J | K | L | ; | ' | | ||
| 76 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 77 | * | Shift| Z | X | C | V | B | | N | M | , | . | / |Enter | | ||
| 78 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 79 | * | Esc |ADJUST| Win | Alt |LOWER |Space | | Space| RAISE| Left | Down | Up | Right| | ||
| 80 | * `-----------------------------------------' `-----------------------------------------' | ||
| 81 | */ | ||
| 82 | [_QWERTY] = LAYOUT_ortho_4x12( | ||
| 83 | KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, | ||
| 84 | KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, | ||
| 85 | KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , | ||
| 86 | KC_ESC, MO(_ADJUST), KC_LGUI, KC_LALT, MO(_LOWER), KC_SPC, KC_SPC, MO(_RAISE), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT | ||
| 87 | ), | ||
| 88 | |||
| 89 | /* Lower | ||
| 90 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 91 | * | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | | | ||
| 92 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 93 | * | | | | | | | | - | _ | + | { | } | | | | ||
| 94 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 95 | * | | | | | | | | | | | Home | End | | | ||
| 96 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 97 | * | | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 98 | * `-----------------------------------------' `-----------------------------------------' | ||
| 99 | */ | ||
| 100 | [_LOWER] = LAYOUT_ortho_4x12( | ||
| 101 | KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, _______, | ||
| 102 | _______, _______, _______, _______, _______, _______, KC_MINS, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, | ||
| 103 | _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_END, _______, | ||
| 104 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY | ||
| 105 | ), | ||
| 106 | |||
| 107 | /* Raise | ||
| 108 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 109 | * | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | Del | | ||
| 110 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 111 | * | | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | \ | | ||
| 112 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 113 | * | | F7 | F8 | F9 | F10 | F11 | | F12 | | | | | | ||
| 114 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 115 | * | | | | | | | | | | Next | Vol- | Vol+ | Play | | ||
| 116 | * `-----------------------------------------' `-----------------------------------------' | ||
| 117 | */ | ||
| 118 | [_RAISE] = LAYOUT_ortho_4x12( | ||
| 119 | KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, | ||
| 120 | _______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, | ||
| 121 | _______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, _______, _______, _______, | ||
| 122 | _______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY | ||
| 123 | ), | ||
| 124 | |||
| 125 | /* Adjust (Lower + Raise) | ||
| 126 | * ,-----------------------------------------. ,-----------------------------------------. | ||
| 127 | * | | Reset|RGBRST|Aud on|Audoff| | | |Qwerty|Colemk|Dvorak| | Ins | | ||
| 128 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 129 | * | |RGB ON| HUE+ | SAT+ | VAL+ | Mac | | Win | - | = |Print |ScLock|Pause | | ||
| 130 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 131 | * |MODE R| MODE | HUE- | SAT- | VAL- | | | | | | |PageUp| | | ||
| 132 | * |------+------+------+------+------+------| |------+------+------+------+------+------| | ||
| 133 | * | | | | EISU | EISU | EISU | | KANA | KANA | Home |PageDn|PageUp| End | | ||
| 134 | * `-----------------------------------------' `-----------------------------------------' | ||
| 135 | */ | ||
| 136 | [_ADJUST] = LAYOUT_ortho_4x12( | ||
| 137 | _______, RESET, RGBRST, _______, _______, _______, _______, QWERTY, _______, _______, _______, KC_INS, | ||
| 138 | _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, AG_NORM, AG_SWAP, KC_MINS, KC_EQL, KC_PSCR, KC_SLCK, KC_PAUS, | ||
| 139 | RGB_RMOD,RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, KC_PGUP, _______, | ||
| 140 | _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KANA, KC_HOME, KC_PGDN, KC_END | ||
| 141 | ), | ||
| 142 | |||
| 143 | [_ADJUST2] = LAYOUT_ortho_4x12( | ||
| 144 | _______, RESET, RGBRST, _______, _______, _______, _______, QWERTY, _______, _______, _______, KC_INS, | ||
| 145 | _______, RGB_TOG, RGB_HUI, RGB_SAI, RGB_VAI, AG_NORM, AG_SWAP, KC_MINS, KC_EQL, KC_PSCR, KC_SLCK, KC_PAUS, | ||
| 146 | RGB_RMOD,RGB_MOD, RGB_HUD, RGB_SAD, RGB_VAD, _______, _______, _______, _______, _______, KC_PGUP, _______, | ||
| 147 | _______, _______, _______, EISU, EISU, EISU, KANA, KANA, KANA, KC_HOME, KC_PGDN, KC_END | ||
| 148 | ) | ||
| 149 | }; | ||
| 150 | |||
| 151 | |||
| 152 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 153 | switch (keycode) { | ||
| 154 | case EISU: | ||
| 155 | if (record->event.pressed) { | ||
| 156 | if(keymap_config.swap_lalt_lgui==false){ | ||
| 157 | register_code(KC_LANG2); | ||
| 158 | } else { | ||
| 159 | SEND_STRING(SS_LALT("`")); | ||
| 160 | } | ||
| 161 | } else { | ||
| 162 | unregister_code(KC_LANG2); | ||
| 163 | } | ||
| 164 | return false; | ||
| 165 | case KANA: | ||
| 166 | if (record->event.pressed) { | ||
| 167 | if(keymap_config.swap_lalt_lgui==false){ | ||
| 168 | register_code(KC_LANG1); | ||
| 169 | } else { | ||
| 170 | SEND_STRING(SS_LALT("`")); | ||
| 171 | } | ||
| 172 | } else { | ||
| 173 | unregister_code(KC_LANG1); | ||
| 174 | } | ||
| 175 | return false; | ||
| 176 | case RGBRST: | ||
| 177 | #ifdef RGBLIGHT_ENABLE | ||
| 178 | if (record->event.pressed) { | ||
| 179 | eeconfig_update_rgblight_default(); | ||
| 180 | rgblight_enable(); | ||
| 181 | } | ||
| 182 | #endif | ||
| 183 | break; | ||
| 184 | } | ||
| 185 | return true; | ||
| 186 | } | ||
| 187 | |||
| 188 | |||
| 189 | |||
| 190 | layer_state_t layer_state_set_user(layer_state_t state) { | ||
| 191 | state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST2); | ||
| 192 | #ifdef RGBLIGHT_LAYERS | ||
| 193 | // Both layers will light up if both kb layers are active | ||
| 194 | rgblight_set_layer_state(1, layer_state_cmp(state, 1)); | ||
| 195 | rgblight_set_layer_state(2, layer_state_cmp(state, 2)); | ||
| 196 | #endif | ||
| 197 | return state; | ||
| 198 | } | ||
| 199 | |||
| 200 | bool led_update_user(led_t led_state) { | ||
| 201 | rgblight_set_layer_state(0, led_state.caps_lock); | ||
| 202 | return true; | ||
| 203 | } | ||
