logo

qmk_firmware

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

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