tan67.c (2024B)
1 /* Copyright 2023 Pangorin <https://github.com/pangorin> 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 "quantum.h" 18 19 #ifdef RGB_MATRIX_ENABLE 20 bool process_record_kb(uint16_t keycode, keyrecord_t *record) { 21 switch (keycode) { 22 case QK_RGB_MATRIX_TOGGLE: 23 if (record->event.pressed) { 24 switch (rgb_matrix_get_flags()) { 25 case LED_FLAG_ALL: { 26 rgb_matrix_set_flags(LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR); 27 rgb_matrix_set_color_all(0, 0, 0); 28 } 29 break; 30 case (LED_FLAG_KEYLIGHT | LED_FLAG_MODIFIER | LED_FLAG_INDICATOR): { 31 rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); 32 rgb_matrix_set_color_all(0, 0, 0); 33 } 34 break; 35 case (LED_FLAG_UNDERGLOW): { 36 rgb_matrix_set_flags(LED_FLAG_NONE); 37 rgb_matrix_set_color_all(0, 0, 0); 38 } 39 break; 40 default: { 41 rgb_matrix_set_flags(LED_FLAG_ALL); 42 rgb_matrix_enable_noeeprom(); 43 } 44 break; 45 } 46 } 47 return false; 48 } 49 return process_record_user(keycode, record); 50 } 51 #endif 52