]> git.donarmstrong.com Git - qmk_firmware.git/blob - keyboards/ergodox_infinity/keymaps/halfkeyboard/visualizer.c
6842635d19b8973f6e4ed17d2c77d2f367cccc14
[qmk_firmware.git] / keyboards / ergodox_infinity / keymaps / halfkeyboard / visualizer.c
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
15 #include "simple_visualizer.h"
16
17 #define RED 0
18 #define ORANGE 21
19 #define YELLOW 42
20 #define SPRING_GREEN 64
21 #define GREEN 85
22 #define TURQUOISE 107
23 #define CYAN 127
24 #define OCEAN 149
25 #define BLUE 170
26 #define VIOLET 192
27 #define MAGENTA 212
28 #define RASPBERRY 234
29
30 // This function should be implemented by the keymap visualizer
31 // Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
32 // that the simple_visualizer assumes that you are updating
33 // Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
34 // stopped. This can be done by either double buffering it or by using constant strings
35 static void get_visualizer_layer_and_color(visualizer_state_t* state) {
36     uint8_t saturation = 255;
37     /* if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
38         saturation = 255;
39     } */
40     if (state->status.layer & 0x100) {
41         state->target_lcd_color = LCD_COLOR(MAGENTA, saturation, 0xFF);
42         state->layer_text = "Shortcuts Layer";
43     }
44     else    if (state->status.layer & 0x80) {
45         state->target_lcd_color = LCD_COLOR(VIOLET, saturation, 0xFF);
46         state->layer_text = "Plover";
47     }
48     else if (state->status.layer & 0x40) {
49         state->target_lcd_color = LCD_COLOR(RASPBERRY, saturation, 0xFF);
50         state->layer_text = "Mirrored Symbols";
51     }
52     else if (state->status.layer & 0x20) {
53         state->target_lcd_color = LCD_COLOR(RED, saturation, 0xFF);
54         state->layer_text = "Symbols";
55     }
56     else if (state->status.layer & 0x8) {
57         state->target_lcd_color = LCD_COLOR(OCEAN, saturation, 0xFF);
58         state->layer_text = "Mirrored Dvorak";
59     }
60     else if (state->status.layer & 0x4) {
61         state->target_lcd_color = LCD_COLOR(BLUE, saturation, 0xFF);
62         state->layer_text = "Dvorak";
63     }
64     else if (state->status.layer & 0x2) {
65         state->target_lcd_color = LCD_COLOR(ORANGE, saturation, 0xFF);
66         state->layer_text = "Mirrored Qwerty";
67     }
68     else {
69         state->target_lcd_color = LCD_COLOR(YELLOW, saturation, 0xFF);
70         state->layer_text = "Qwerty";
71     }
72 }