keymap.c (1545B)
1 /*Copyright 2021 Blake Drayson / Draytronics 2 3 Contact info@draytronics.co.uk 4 5 This program is free software: you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation, either version 2 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #include QMK_KEYBOARD_H 20 #define _BASE 0 // Base layer 21 #define _CODE 1 // Code layer 22 23 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 24 [_BASE] = LAYOUT( 25 KC_MUTE, KC_HOME, 26 MO(_CODE), KC_MPRV, KC_MNXT, KC_MPLY, 27 C(KC_LEFT), C(KC_UP), C(KC_DOWN), C(KC_RIGHT) 28 ), 29 [_CODE] = LAYOUT( 30 KC_MUTE, KC_END, 31 _______, UG_NEXT, UG_VALU, UG_TOGG, 32 G(S(KC_5)), G(A(KC_ESC)), G(KC_F), QK_BOOT 33 ) 34 }; 35 36 bool encoder_update_user(uint8_t index, bool clockwise) { 37 if (index == 0) { 38 if (clockwise) { 39 tap_code(KC_VOLD); 40 } else { 41 tap_code(KC_VOLU); 42 } 43 } 44 else if (index == 1) { 45 if (clockwise) { 46 tap_code(KC_PGUP); 47 } else { 48 tap_code(KC_PGDN); 49 } 50 } 51 return true; 52 }