visualizer.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. Copyright 2017 Fred Sundvik
  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. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. */
  14. // Currently we are assuming that both the backlight and LCD are enabled
  15. // But it's entirely possible to write a custom visualizer that use only
  16. // one of them
  17. #ifndef LCD_BACKLIGHT_ENABLE
  18. #error This visualizer needs that LCD backlight is enabled
  19. #endif
  20. #ifndef LCD_ENABLE
  21. #error This visualizer needs that LCD is enabled
  22. #endif
  23. #include "simple_visualizer.h"
  24. static void get_visualizer_layer_and_color(visualizer_state_t* state) {
  25. uint8_t saturation = 60;
  26. if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
  27. saturation = 255;
  28. }
  29. if (state->status.layer & 0x4) {
  30. state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF);
  31. state->layer_text = "Media";
  32. }
  33. else if (state->status.layer & 0x2) {
  34. state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF);
  35. state->layer_text = "Symbols";
  36. }
  37. else {
  38. state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF);
  39. state->layer_text = "Base";
  40. }
  41. }