lightmode.c 841 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "lightmode.h"
  2. #ifdef LIGHTMODE_ENABLE
  3. /* Light modes switcher */
  4. uint8_t light_mode = SMOOTHLED;
  5. void set_light_mode(light_mode_t value, uint32_t color) {
  6. light_mode = value;
  7. if (light_mode == SMOOTHLED) {
  8. smoothled_set(color);
  9. } else {
  10. dmc12_start(color, true);
  11. }
  12. }
  13. void process_light_mode(void) {
  14. if (light_mode == SMOOTHLED) {
  15. smoothled_process();
  16. } else {
  17. dmc12_process();
  18. }
  19. }
  20. void update_light_mode(uint32_t color) {
  21. if (light_mode == SMOOTHLED) {
  22. smoothled_set(color);
  23. } else {
  24. dmc12_start(color, false);
  25. }
  26. }
  27. void next_light_mode(uint32_t color) {
  28. light_mode = (light_mode + 1) % LIGHT_MODE_SIZE;
  29. set_light_mode(light_mode, color);
  30. }
  31. void matrix_scan_kb(void) {
  32. process_light_mode();
  33. matrix_scan_user();
  34. }
  35. #endif