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.

71 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 "rgb_functions.h"
  17. #ifdef RGBLIGHT_ENABLE
  18. #undef WS2812_DI_PIN
  19. #define WS2812_DI_PIN RGBLIGHT_DI_PIN
  20. #define ws2812_setleds ws2812_rgb_setleds
  21. #include "ws2812_bitbang.c"
  22. const rgblight_driver_t rgblight_driver = {
  23. .setleds = ws2812_setleds,
  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