logo

qmk_firmware

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

process_backlight.c (1671B)


  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. #include "backlight.h"
  18. bool process_backlight(uint16_t keycode, keyrecord_t *record) {
  19. if (record->event.pressed) {
  20. switch (keycode) {
  21. case QK_BACKLIGHT_ON:
  22. backlight_level(BACKLIGHT_LEVELS);
  23. return false;
  24. case QK_BACKLIGHT_OFF:
  25. backlight_level(0);
  26. return false;
  27. case QK_BACKLIGHT_DOWN:
  28. backlight_decrease();
  29. return false;
  30. case QK_BACKLIGHT_UP:
  31. backlight_increase();
  32. return false;
  33. case QK_BACKLIGHT_TOGGLE:
  34. backlight_toggle();
  35. return false;
  36. case QK_BACKLIGHT_STEP:
  37. backlight_step();
  38. return false;
  39. #ifdef BACKLIGHT_BREATHING
  40. case QK_BACKLIGHT_TOGGLE_BREATHING:
  41. backlight_toggle_breathing();
  42. return false;
  43. #endif
  44. }
  45. }
  46. return true;
  47. }