diff options
Diffstat (limited to 'keyboards/yushakobo/quick7/keymaps/via/keymap.c')
| -rw-r--r-- | keyboards/yushakobo/quick7/keymaps/via/keymap.c | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/keyboards/yushakobo/quick7/keymaps/via/keymap.c b/keyboards/yushakobo/quick7/keymaps/via/keymap.c new file mode 100644 index 000000000..9c64042bc --- /dev/null +++ b/keyboards/yushakobo/quick7/keymaps/via/keymap.c | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | /* Copyright 2020 yushakobo | ||
| 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 | #include QMK_KEYBOARD_H | ||
| 17 | |||
| 18 | // Defines names for use in layer keycodes and the keymap | ||
| 19 | enum layer_names { | ||
| 20 | _BASE, | ||
| 21 | _FUNC1, | ||
| 22 | _VIA1, | ||
| 23 | _VIA2 | ||
| 24 | }; | ||
| 25 | |||
| 26 | // Defines the keycodes used by our macros in process_record_user | ||
| 27 | enum custom_keycodes { | ||
| 28 | YUSHAURL = SAFE_RANGE | ||
| 29 | }; | ||
| 30 | |||
| 31 | const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | ||
| 32 | /* Base */ | ||
| 33 | [_BASE] = LAYOUT( | ||
| 34 | KC_MUTE, MO(_FUNC1), RGB_MOD, | ||
| 35 | S(KC_TAB), KC_UP, KC_TAB, | ||
| 36 | KC_LEFT, KC_DOWN, KC_RGHT | ||
| 37 | ), | ||
| 38 | [_FUNC1] = LAYOUT( | ||
| 39 | RESET, KC_TRNS, RGB_TOG, | ||
| 40 | KC_HOME, KC_VOLU, KC_END, | ||
| 41 | KC_MPRV, KC_VOLD, KC_MNXT | ||
| 42 | ), | ||
| 43 | [_VIA1] = LAYOUT( | ||
| 44 | YUSHAURL,XXXXXXX, XXXXXXX, | ||
| 45 | XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 46 | XXXXXXX, XXXXXXX, XXXXXXX | ||
| 47 | ), | ||
| 48 | [_VIA2] = LAYOUT( | ||
| 49 | XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 50 | XXXXXXX, XXXXXXX, XXXXXXX, | ||
| 51 | XXXXXXX, XXXXXXX, XXXXXXX | ||
| 52 | ) | ||
| 53 | }; | ||
| 54 | |||
| 55 | bool process_record_user(uint16_t keycode, keyrecord_t *record) { | ||
| 56 | switch (keycode) { | ||
| 57 | case YUSHAURL: | ||
| 58 | if (record->event.pressed) { | ||
| 59 | // when keycode QMKURL is pressed | ||
| 60 | SEND_STRING("https://yushakobo.jp/\n"); | ||
| 61 | } else { | ||
| 62 | // when keycode QMKURL is released | ||
| 63 | } | ||
| 64 | break; | ||
| 65 | } | ||
| 66 | return true; | ||
| 67 | } | ||
| 68 | |||
| 69 | void encoder_update_user(uint8_t index, bool clockwise) { | ||
| 70 | if (index == 0) { // Left encoder | ||
| 71 | if (clockwise) { | ||
| 72 | tap_code(KC_VOLU); | ||
| 73 | } else { | ||
| 74 | tap_code(KC_VOLD); | ||
| 75 | } | ||
| 76 | } | ||
| 77 | else if (index == 1) { // Right encoder | ||
| 78 | if (clockwise) { | ||
| 79 | rgblight_decrease_hue_noeeprom(); | ||
| 80 | } else { | ||
| 81 | rgblight_increase_hue_noeeprom(); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | } | ||
