logo

qmk_firmware

custom branch of QMK firmware git clone https://anongit.hacktivis.me/git/qmk_firmware.git

bumblebee.c (1542B)


  1. /*
  2. Copyright 2021 Swiftrax <swiftrax@gmail.com>
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. #include "quantum.h"
  15. // Initialize all RGB indicators to 'off'
  16. void keyboard_post_init_kb(void) {
  17. rgblight_setrgb_at(0, 0, 0, 0); // [..., 0] = top LED
  18. rgblight_setrgb_at(0, 0, 0, 1); // [..., 1] = middle LED
  19. rgblight_setrgb_at(0, 0, 0, 2); // [..., 2] = bottom LED
  20. keyboard_post_init_user();
  21. }
  22. // RGB Layer Indicators
  23. layer_state_t layer_state_set_kb(layer_state_t state) {
  24. if (get_highest_layer(state) == 0) {
  25. rgblight_setrgb_at(255, 0, 0, 0); //red
  26. } else {
  27. rgblight_setrgb_at(0, 0, 0, 0);
  28. }
  29. if (get_highest_layer(state) == 1){
  30. rgblight_setrgb_at(0, 0, 255, 1); //green
  31. } else{
  32. rgblight_setrgb_at(0, 0, 0, 1);
  33. }
  34. if (get_highest_layer(state) == 2){
  35. rgblight_setrgb_at(0, 255, 0, 2); //blue
  36. } else{
  37. rgblight_setrgb_at(0, 0, 0, 2);
  38. }
  39. return layer_state_set_user(state);
  40. }