keymap.c (1879B)
1 /* 2 * Copyright (C) 2019-2020 Maxr1998 <max.rumpf1998@gmail.com> 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #include QMK_KEYBOARD_H 19 20 enum layers { 21 DEFAULT 22 }; 23 24 enum combo_events { 25 LED_ADJUST 26 }; 27 28 const uint16_t PROGMEM led_adjust_combo[] = {KC_LEFT, KC_RGHT, COMBO_END}; 29 30 const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 31 [DEFAULT] = LAYOUT( 32 KC_END, KC_UP, KC_MUTE, 33 KC_LEFT, KC_DOWN, KC_RGHT 34 ) 35 }; 36 37 combo_t key_combos[] = { 38 [LED_ADJUST] = COMBO_ACTION(led_adjust_combo) 39 }; 40 41 bool led_adjust_active = false; 42 43 void process_combo_event(uint16_t combo_index, bool pressed) { 44 if (combo_index == LED_ADJUST) { 45 led_adjust_active = pressed; 46 } 47 } 48 49 bool encoder_update_user(uint8_t index, bool clockwise) { 50 if (index == 0) { 51 if (led_adjust_active) { 52 if (clockwise) { 53 rgblight_increase_val(); 54 } else { 55 rgblight_decrease_val(); 56 } 57 return false; 58 } 59 } else if (index == 1) { 60 if (led_adjust_active) { 61 if (clockwise) { 62 rgblight_increase_hue(); 63 } else { 64 rgblight_decrease_hue(); 65 } 66 return false; 67 } 68 } 69 70 return true; 71 }