You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.1 KiB

  1. /* Copyright 2021 Drashna Jael're
  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 QMK_KEYBOARD_H
  17. #include "rgb_functions.h"
  18. #if defined(RGBLIGHT_ENABLE) && defined(RGB_MATRIX_EANBLE)
  19. # undef RGB_DI_PIN
  20. # define RGBLIGHT_DI_PIN
  21. # include "ws2812.c"
  22. void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) {
  23. ws2812_setleds(start_led, num_leds);
  24. }
  25. #endif
  26. #ifdef RGB_MATRIX_ENABLE
  27. bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  28. if (!process_record_user(keycode, record)) { return false; }
  29. if (record->event.pressed) {
  30. switch(keycode) {
  31. case RGB_MATRIX_TOGGLE: // toggle rgb matrix
  32. rgb_matrix_toggle();
  33. return false;
  34. case RGB_MATRIX_MODE_INC:
  35. rgb_matrix_step();
  36. return false;
  37. case RGB_MATRIX_MODE_DEC:
  38. rgb_matrix_step_reverse();
  39. return false;
  40. case RGB_MATRIX_HUE_INC:
  41. rgb_matrix_increase_hue();
  42. return false;
  43. case RGB_MATRIX_HUE_DEC:
  44. rgb_matrix_decrease_hue();
  45. return false;
  46. case RGB_MATRIX_SAT_INC:
  47. rgb_matrix_increase_sat();
  48. return false;
  49. case RGB_MATRIX_SAT_DEC:
  50. rgb_matrix_decrease_sat();
  51. return false;
  52. case RGB_MATRIX_VAL_INC:
  53. rgb_matrix_increase_val();
  54. return false;
  55. case RGB_MATRIX_VAL_DEC:
  56. rgb_matrix_decrease_val();
  57. return false;
  58. default:
  59. break;
  60. }
  61. }
  62. return true;
  63. }
  64. #endif