keymap.c (1986B)
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 }; 23 24 // Defines the keycodes used by our macros in process_record_user 25 enum custom_keycodes { 26 YUSHAURL = SAFE_RANGE 27 }; 28 29 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 30 /* Base */ 31 [_BASE] = LAYOUT( 32 KC_MUTE, MO(_FUNC1), UG_NEXT, 33 S(KC_TAB), KC_UP, KC_TAB, 34 KC_LEFT, KC_DOWN, KC_RGHT 35 ), 36 [_FUNC1] = LAYOUT( 37 QK_BOOT, KC_TRNS, UG_TOGG, 38 KC_HOME, KC_VOLU, KC_END, 39 KC_MPRV, KC_VOLD, KC_MNXT 40 ) 41 }; 42 43 bool process_record_user(uint16_t keycode, keyrecord_t *record) { 44 switch (keycode) { 45 case YUSHAURL: 46 if (record->event.pressed) { 47 SEND_STRING("https://yushakobo.jp/\n"); 48 } 49 break; 50 } 51 return true; 52 } 53 54 bool encoder_update_user(uint8_t index, bool clockwise) { 55 if (index == 0) { // Left encoder 56 if (clockwise) { 57 tap_code(KC_VOLU); 58 } else { 59 tap_code(KC_VOLD); 60 } 61 } 62 else if (index == 1) { // Right encoder 63 if (clockwise) { 64 rgblight_decrease_hue_noeeprom(); 65 } else { 66 rgblight_increase_hue_noeeprom(); 67 } 68 } 69 return true; 70 }