diff options
| author | Nick Brassel <nick@tzarc.org> | 2021-10-07 10:57:48 +1100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-07 10:57:48 +1100 |
| commit | b2a186cf92d91bbb7f98fff68c4edf571909bf89 (patch) | |
| tree | c58eca68f1ca0797b8080c32be3d14b10abd286a /quantum/visualizer/lcd_keyframes.c | |
| parent | bc1f5ef38172bc77a802fb779e5da60f800c231b (diff) | |
| download | qmk_firmware-b2a186cf92d91bbb7f98fff68c4edf571909bf89.tar.gz qmk_firmware-b2a186cf92d91bbb7f98fff68c4edf571909bf89.zip | |
Purge uGFX. (#14720)
* Purge uGFX.
* Remove remnants of visualizer.
* Remove remnants of uGFX.
Diffstat (limited to 'quantum/visualizer/lcd_keyframes.c')
| -rw-r--r-- | quantum/visualizer/lcd_keyframes.c | 184 |
1 files changed, 0 insertions, 184 deletions
diff --git a/quantum/visualizer/lcd_keyframes.c b/quantum/visualizer/lcd_keyframes.c deleted file mode 100644 index 1d6f3dca1..000000000 --- a/quantum/visualizer/lcd_keyframes.c +++ /dev/null | |||
| @@ -1,184 +0,0 @@ | |||
| 1 | /* Copyright 2017 Fred Sundvik | ||
| 2 | * | ||
| 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 | * | ||
| 8 | * This program is distributed in the hope that it will be useful, | ||
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 11 | * GNU General Public License for more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include "lcd_keyframes.h" | ||
| 18 | #include <string.h> | ||
| 19 | #include "action_util.h" | ||
| 20 | #include "led.h" | ||
| 21 | #include "resources/resources.h" | ||
| 22 | |||
| 23 | bool lcd_keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 24 | (void)animation; | ||
| 25 | gdispClear(White); | ||
| 26 | gdispDrawString(0, 10, state->layer_text, state->font_dejavusansbold12, Black); | ||
| 27 | return false; | ||
| 28 | } | ||
| 29 | |||
| 30 | static void format_layer_bitmap_string(uint16_t default_layer, uint16_t layer, char* buffer) { | ||
| 31 | for (int i = 0; i < 16; i++) { | ||
| 32 | uint32_t mask = (1u << i); | ||
| 33 | if (default_layer & mask) { | ||
| 34 | if (layer & mask) { | ||
| 35 | *buffer = 'B'; | ||
| 36 | } else { | ||
| 37 | *buffer = 'D'; | ||
| 38 | } | ||
| 39 | } else if (layer & mask) { | ||
| 40 | *buffer = '1'; | ||
| 41 | } else { | ||
| 42 | *buffer = '0'; | ||
| 43 | } | ||
| 44 | ++buffer; | ||
| 45 | |||
| 46 | if (i == 3 || i == 7 || i == 11) { | ||
| 47 | *buffer = ' '; | ||
| 48 | ++buffer; | ||
| 49 | } | ||
| 50 | } | ||
| 51 | *buffer = 0; | ||
| 52 | } | ||
| 53 | |||
| 54 | bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 55 | (void)animation; | ||
| 56 | const char* layer_help = "1=On D=Default B=Both"; | ||
| 57 | char layer_buffer[16 + 4]; // 3 spaces and one null terminator | ||
| 58 | gdispClear(White); | ||
| 59 | gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black); | ||
| 60 | format_layer_bitmap_string(state->status.default_layer, state->status.layer, layer_buffer); | ||
| 61 | gdispDrawString(0, 10, layer_buffer, state->font_fixed5x8, Black); | ||
| 62 | format_layer_bitmap_string(state->status.default_layer >> 16, state->status.layer >> 16, layer_buffer); | ||
| 63 | gdispDrawString(0, 20, layer_buffer, state->font_fixed5x8, Black); | ||
| 64 | return false; | ||
| 65 | } | ||
| 66 | |||
| 67 | static void format_mods_bitmap_string(uint8_t mods, char* buffer) { | ||
| 68 | *buffer = ' '; | ||
| 69 | ++buffer; | ||
| 70 | |||
| 71 | for (int i = 0; i < 8; i++) { | ||
| 72 | uint32_t mask = (1u << i); | ||
| 73 | if (mods & mask) { | ||
| 74 | *buffer = '1'; | ||
| 75 | } else { | ||
| 76 | *buffer = '0'; | ||
| 77 | } | ||
| 78 | ++buffer; | ||
| 79 | |||
| 80 | if (i == 3) { | ||
| 81 | *buffer = ' '; | ||
| 82 | ++buffer; | ||
| 83 | } | ||
| 84 | } | ||
| 85 | *buffer = 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 89 | (void)animation; | ||
| 90 | |||
| 91 | const char* title = "Modifier states"; | ||
| 92 | const char* mods_header = " CSAG CSAG "; | ||
| 93 | char status_buffer[12]; | ||
| 94 | |||
| 95 | gdispClear(White); | ||
| 96 | gdispDrawString(0, 0, title, state->font_fixed5x8, Black); | ||
| 97 | gdispDrawString(0, 10, mods_header, state->font_fixed5x8, Black); | ||
| 98 | format_mods_bitmap_string(state->status.mods, status_buffer); | ||
| 99 | gdispDrawString(0, 20, status_buffer, state->font_fixed5x8, Black); | ||
| 100 | |||
| 101 | return false; | ||
| 102 | } | ||
| 103 | |||
| 104 | #define LED_STATE_STRING_SIZE sizeof("NUM CAPS SCRL COMP KANA") | ||
| 105 | |||
| 106 | static void get_led_state_string(char* output, visualizer_state_t* state) { | ||
| 107 | uint8_t pos = 0; | ||
| 108 | |||
| 109 | if (state->status.leds & (1u << USB_LED_NUM_LOCK)) { | ||
| 110 | memcpy(output + pos, "NUM ", 4); | ||
| 111 | pos += 4; | ||
| 112 | } | ||
| 113 | if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { | ||
| 114 | memcpy(output + pos, "CAPS ", 5); | ||
| 115 | pos += 5; | ||
| 116 | } | ||
| 117 | if (state->status.leds & (1u << USB_LED_SCROLL_LOCK)) { | ||
| 118 | memcpy(output + pos, "SCRL ", 5); | ||
| 119 | pos += 5; | ||
| 120 | } | ||
| 121 | if (state->status.leds & (1u << USB_LED_COMPOSE)) { | ||
| 122 | memcpy(output + pos, "COMP ", 5); | ||
| 123 | pos += 5; | ||
| 124 | } | ||
| 125 | if (state->status.leds & (1u << USB_LED_KANA)) { | ||
| 126 | memcpy(output + pos, "KANA", 4); | ||
| 127 | pos += 4; | ||
| 128 | } | ||
| 129 | output[pos] = 0; | ||
| 130 | } | ||
| 131 | |||
| 132 | bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 133 | (void)animation; | ||
| 134 | char output[LED_STATE_STRING_SIZE]; | ||
| 135 | get_led_state_string(output, state); | ||
| 136 | gdispClear(White); | ||
| 137 | gdispDrawString(0, 10, output, state->font_dejavusansbold12, Black); | ||
| 138 | return false; | ||
| 139 | } | ||
| 140 | |||
| 141 | bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 142 | (void)animation; | ||
| 143 | gdispClear(White); | ||
| 144 | uint8_t y = 10; | ||
| 145 | if (state->status.leds) { | ||
| 146 | char output[LED_STATE_STRING_SIZE]; | ||
| 147 | get_led_state_string(output, state); | ||
| 148 | gdispDrawString(0, 1, output, state->font_dejavusansbold12, Black); | ||
| 149 | y = 17; | ||
| 150 | } | ||
| 151 | gdispDrawString(0, y, state->layer_text, state->font_dejavusansbold12, Black); | ||
| 152 | return false; | ||
| 153 | } | ||
| 154 | |||
| 155 | bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 156 | (void)state; | ||
| 157 | (void)animation; | ||
| 158 | // Read the uGFX documentation for information how to use the displays | ||
| 159 | // http://wiki.ugfx.org/index.php/Main_Page | ||
| 160 | gdispClear(Black); | ||
| 161 | |||
| 162 | // You can use static variables for things that can't be found in the animation | ||
| 163 | // or state structs, here we use the image | ||
| 164 | |||
| 165 | // gdispGBlitArea is a tricky function to use since it supports blitting part of the image | ||
| 166 | // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions | ||
| 167 | gdispGBlitArea(GDISP, 0, 0, 128, 32, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo); | ||
| 168 | |||
| 169 | return false; | ||
| 170 | } | ||
| 171 | |||
| 172 | bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 173 | (void)animation; | ||
| 174 | (void)state; | ||
| 175 | gdispSetPowerMode(powerOff); | ||
| 176 | return false; | ||
| 177 | } | ||
| 178 | |||
| 179 | bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) { | ||
| 180 | (void)animation; | ||
| 181 | (void)state; | ||
| 182 | gdispSetPowerMode(powerOn); | ||
| 183 | return false; | ||
| 184 | } | ||
