visualizer.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include "simple_visualizer.h"
  15. // This function should be implemented by the keymap visualizer
  16. // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
  17. // that the simple_visualizer assumes that you are updating
  18. // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
  19. // stopped. This can be done by either double buffering it or by using constant strings
  20. static void get_visualizer_layer_and_color(visualizer_state_t* state) {
  21. if (state->status.layer & 0x20) {
  22. //GREEN
  23. state->target_lcd_color = LCD_COLOR(85, 255, 128);
  24. state->layer_text = "Gaming";
  25. }
  26. else if (state->status.layer & 0x10) {
  27. //ORANGE
  28. state->target_lcd_color = LCD_COLOR(28, 255, 230);
  29. state->layer_text = "Numpad & Mouse";
  30. }
  31. else if (state->status.layer & 0x8) {
  32. //YELLOW
  33. state->target_lcd_color = LCD_COLOR(38, 255, 230);
  34. state->layer_text = "Symbols";
  35. }
  36. else if (state->status.layer & 0x4) {
  37. //RED
  38. state->target_lcd_color = LCD_COLOR(0, 255, 95);
  39. if (state->status.layer & 0x2){
  40. state->layer_text = "Qwerty - Fn";
  41. }else{
  42. state->layer_text = "Colemak - Fn";
  43. }
  44. }
  45. else if (state->status.layer & 0x2) {
  46. //BLUE
  47. state->target_lcd_color = LCD_COLOR(149, 255, 192);
  48. state->layer_text = "Qwerty";
  49. }
  50. else {
  51. //PURPLE
  52. state->target_lcd_color = LCD_COLOR(200, 255, 192);
  53. state->layer_text = "Colemak";
  54. }
  55. }