visualizer.c 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #include "util.h"
  16. #include "layers.h"
  17. // This function should be implemented by the keymap visualizer
  18. // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
  19. // that the simple_visualizer assumes that you are updating
  20. // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
  21. // stopped. This can be done by either double buffering it or by using constant strings
  22. static void get_visualizer_layer_and_color(visualizer_state_t* state) {
  23. switch(biton32(default_layer_state)) {
  24. case _QWERTY:
  25. state->layer_text = "QWERTY";
  26. state->target_lcd_color = LCD_COLOR(0, 255, 128);
  27. break;
  28. case _WORKMAN:
  29. state->layer_text = "Workman";
  30. state->target_lcd_color = LCD_COLOR(80, 255, 128);
  31. break;
  32. case _DVORAK:
  33. state->layer_text = "Dvorak";
  34. state->target_lcd_color = LCD_COLOR(194, 255, 128);
  35. break;
  36. case _COLEMAK:
  37. state->layer_text = "Colemak";
  38. state->target_lcd_color = LCD_COLOR(18, 255, 128);
  39. break;
  40. }
  41. switch(biton32(state->status.layer)) {
  42. case _LOWER:
  43. state->layer_text = "Lower";
  44. state->target_lcd_color = LCD_COLOR(141, 255, 255);
  45. break;
  46. case _RAISE:
  47. state->layer_text = "Raise";
  48. state->target_lcd_color = LCD_COLOR(18, 255, 255);
  49. break;
  50. case _ADJUST:
  51. state->layer_text = "Adjust";
  52. state->target_lcd_color = LCD_COLOR(194, 255, 255);
  53. break;
  54. case _NUM:
  55. state->layer_text = "Numpad";
  56. state->target_lcd_color = LCD_COLOR(80, 255, 255);
  57. break;
  58. case _MOUSE:
  59. state->layer_text = "Mouse";
  60. state->target_lcd_color = LCD_COLOR(300, 255, 255);
  61. break;
  62. case _GAME:
  63. state->layer_text = "Game";
  64. state->target_lcd_color = LCD_COLOR(300, 255, 255);
  65. break;
  66. case _QWERTY: case _WORKMAN: case _DVORAK: case _COLEMAK:
  67. break;
  68. default:
  69. state->layer_text = "NONE";
  70. state->target_lcd_color = LCD_COLOR(0, 255, 255);
  71. break;
  72. }
  73. }