process_backlight.c 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. /* Copyright 2019
  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 "process_backlight.h"
  17. #ifdef LED_MATRIX_ENABLE
  18. # include "led_matrix.h"
  19. #else
  20. # include "backlight.h"
  21. #endif
  22. bool process_backlight(uint16_t keycode, keyrecord_t *record) {
  23. if (record->event.pressed) {
  24. switch (keycode) {
  25. #ifdef LED_MATRIX_ENABLE
  26. case BL_ON:
  27. led_matrix_enable();
  28. return false;
  29. case BL_OFF:
  30. led_matrix_disable();
  31. return false;
  32. case BL_DEC:
  33. led_matrix_decrease_val();
  34. return false;
  35. case BL_INC:
  36. led_matrix_increase_val();
  37. return false;
  38. case BL_TOGG:
  39. led_matrix_toggle();
  40. return false;
  41. case BL_STEP:
  42. led_matrix_step();
  43. return false;
  44. #else
  45. case BL_ON:
  46. backlight_level(BACKLIGHT_LEVELS);
  47. return false;
  48. case BL_OFF:
  49. backlight_level(0);
  50. return false;
  51. case BL_DEC:
  52. backlight_decrease();
  53. return false;
  54. case BL_INC:
  55. backlight_increase();
  56. return false;
  57. case BL_TOGG:
  58. backlight_toggle();
  59. return false;
  60. case BL_STEP:
  61. backlight_step();
  62. return false;
  63. # ifdef BACKLIGHT_BREATHING
  64. case BL_BRTG:
  65. backlight_toggle_breathing();
  66. return false;
  67. # endif
  68. #endif
  69. }
  70. }
  71. return true;
  72. }