bumblebee.c (1542B)
1 /* 2 Copyright 2021 Swiftrax <swiftrax@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 #include "quantum.h" 18 19 // Initialize all RGB indicators to 'off' 20 void keyboard_post_init_kb(void) { 21 rgblight_setrgb_at(0, 0, 0, 0); // [..., 0] = top LED 22 rgblight_setrgb_at(0, 0, 0, 1); // [..., 1] = middle LED 23 rgblight_setrgb_at(0, 0, 0, 2); // [..., 2] = bottom LED 24 keyboard_post_init_user(); 25 } 26 27 // RGB Layer Indicators 28 layer_state_t layer_state_set_kb(layer_state_t state) { 29 if (get_highest_layer(state) == 0) { 30 rgblight_setrgb_at(255, 0, 0, 0); //red 31 } else { 32 rgblight_setrgb_at(0, 0, 0, 0); 33 } 34 if (get_highest_layer(state) == 1){ 35 rgblight_setrgb_at(0, 0, 255, 1); //green 36 } else{ 37 rgblight_setrgb_at(0, 0, 0, 1); 38 } 39 if (get_highest_layer(state) == 2){ 40 rgblight_setrgb_at(0, 255, 0, 2); //blue 41 } else{ 42 rgblight_setrgb_at(0, 0, 0, 2); 43 } 44 return layer_state_set_user(state); 45 }