visualizer.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. Note: this is a modified copy of ../default/visualizer.c, originally licensed GPL.
  3. */
  4. #include "simple_visualizer.h"
  5. // This function should be implemented by the keymap visualizer
  6. // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
  7. // that the simple_visualizer assumes that you are updating
  8. // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
  9. // stopped. This can be done by either double buffering it or by using constant strings
  10. static void get_visualizer_layer_and_color(visualizer_state_t* state) {
  11. uint8_t saturation = 60;
  12. if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
  13. saturation = 255;
  14. }
  15. if (state->status.layer & 0x80) {
  16. state->target_lcd_color = LCD_COLOR(0, 255, 60);
  17. state->layer_text = "Game Arrow";
  18. } else if (state->status.layer & 0x40) {
  19. state->target_lcd_color = LCD_COLOR(0, 255, 60);
  20. state->layer_text = "Game";
  21. } else if (state->status.layer & 0x20) {
  22. state->target_lcd_color = LCD_COLOR(140, 100, 60);
  23. state->layer_text = "Movement";
  24. } else if (state->status.layer & 0x10) {
  25. state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF);
  26. state->layer_text = "Media";
  27. } else if (state->status.layer & 0x8) {
  28. state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF);
  29. state->layer_text = "Symbol";
  30. } else if (state->status.layer & 0x2 || state->status.layer & 0x4) {
  31. state->target_lcd_color = LCD_COLOR(216, 90, 0xFF);
  32. state->layer_text = "Code";
  33. } else {
  34. state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF);
  35. state->layer_text = "Default";
  36. }
  37. }