diff options
Diffstat (limited to 'quantum/visualizer/lcd_keyframes.c')
| -rw-r--r-- | quantum/visualizer/lcd_keyframes.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/quantum/visualizer/lcd_keyframes.c b/quantum/visualizer/lcd_keyframes.c index 75eb45700..c7d9841df 100644 --- a/quantum/visualizer/lcd_keyframes.c +++ b/quantum/visualizer/lcd_keyframes.c | |||
| @@ -28,8 +28,7 @@ bool lcd_keyframe_display_layer_text(keyframe_animation_t* animation, visualizer | |||
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | static void format_layer_bitmap_string(uint16_t default_layer, uint16_t layer, char* buffer) { | 30 | static void format_layer_bitmap_string(uint16_t default_layer, uint16_t layer, char* buffer) { |
| 31 | for (int i=0; i<16;i++) | 31 | for (int i = 0; i < 16; i++) { |
| 32 | { | ||
| 33 | uint32_t mask = (1u << i); | 32 | uint32_t mask = (1u << i); |
| 34 | if (default_layer & mask) { | 33 | if (default_layer & mask) { |
| 35 | if (layer & mask) { | 34 | if (layer & mask) { |
| @@ -44,7 +43,7 @@ static void format_layer_bitmap_string(uint16_t default_layer, uint16_t layer, c | |||
| 44 | } | 43 | } |
| 45 | ++buffer; | 44 | ++buffer; |
| 46 | 45 | ||
| 47 | if (i==3 || i==7 || i==11) { | 46 | if (i == 3 || i == 7 || i == 11) { |
| 48 | *buffer = ' '; | 47 | *buffer = ' '; |
| 49 | ++buffer; | 48 | ++buffer; |
| 50 | } | 49 | } |
| @@ -55,7 +54,7 @@ static void format_layer_bitmap_string(uint16_t default_layer, uint16_t layer, c | |||
| 55 | bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) { | 54 | bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 56 | (void)animation; | 55 | (void)animation; |
| 57 | const char* layer_help = "1=On D=Default B=Both"; | 56 | const char* layer_help = "1=On D=Default B=Both"; |
| 58 | char layer_buffer[16 + 4]; // 3 spaces and one null terminator | 57 | char layer_buffer[16 + 4]; // 3 spaces and one null terminator |
| 59 | gdispClear(White); | 58 | gdispClear(White); |
| 60 | gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black); | 59 | gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black); |
| 61 | format_layer_bitmap_string(state->status.default_layer, state->status.layer, layer_buffer); | 60 | format_layer_bitmap_string(state->status.default_layer, state->status.layer, layer_buffer); |
| @@ -69,8 +68,7 @@ static void format_mods_bitmap_string(uint8_t mods, char* buffer) { | |||
| 69 | *buffer = ' '; | 68 | *buffer = ' '; |
| 70 | ++buffer; | 69 | ++buffer; |
| 71 | 70 | ||
| 72 | for (int i = 0; i<8; i++) | 71 | for (int i = 0; i < 8; i++) { |
| 73 | { | ||
| 74 | uint32_t mask = (1u << i); | 72 | uint32_t mask = (1u << i); |
| 75 | if (mods & mask) { | 73 | if (mods & mask) { |
| 76 | *buffer = '1'; | 74 | *buffer = '1'; |
| @@ -79,7 +77,7 @@ static void format_mods_bitmap_string(uint8_t mods, char* buffer) { | |||
| 79 | } | 77 | } |
| 80 | ++buffer; | 78 | ++buffer; |
| 81 | 79 | ||
| 82 | if (i==3) { | 80 | if (i == 3) { |
| 83 | *buffer = ' '; | 81 | *buffer = ' '; |
| 84 | ++buffer; | 82 | ++buffer; |
| 85 | } | 83 | } |
| @@ -90,9 +88,9 @@ static void format_mods_bitmap_string(uint8_t mods, char* buffer) { | |||
| 90 | bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) { | 88 | bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 91 | (void)animation; | 89 | (void)animation; |
| 92 | 90 | ||
| 93 | const char* title = "Modifier states"; | 91 | const char* title = "Modifier states"; |
| 94 | const char* mods_header = " CSAG CSAG "; | 92 | const char* mods_header = " CSAG CSAG "; |
| 95 | char status_buffer[12]; | 93 | char status_buffer[12]; |
| 96 | 94 | ||
| 97 | gdispClear(White); | 95 | gdispClear(White); |
| 98 | gdispDrawString(0, 0, title, state->font_fixed5x8, Black); | 96 | gdispDrawString(0, 0, title, state->font_fixed5x8, Black); |
| @@ -109,30 +107,29 @@ static void get_led_state_string(char* output, visualizer_state_t* state) { | |||
| 109 | uint8_t pos = 0; | 107 | uint8_t pos = 0; |
| 110 | 108 | ||
| 111 | if (state->status.leds & (1u << USB_LED_NUM_LOCK)) { | 109 | if (state->status.leds & (1u << USB_LED_NUM_LOCK)) { |
| 112 | memcpy(output + pos, "NUM ", 4); | 110 | memcpy(output + pos, "NUM ", 4); |
| 113 | pos += 4; | 111 | pos += 4; |
| 114 | } | 112 | } |
| 115 | if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { | 113 | if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) { |
| 116 | memcpy(output + pos, "CAPS ", 5); | 114 | memcpy(output + pos, "CAPS ", 5); |
| 117 | pos += 5; | 115 | pos += 5; |
| 118 | } | 116 | } |
| 119 | if (state->status.leds & (1u << USB_LED_SCROLL_LOCK)) { | 117 | if (state->status.leds & (1u << USB_LED_SCROLL_LOCK)) { |
| 120 | memcpy(output + pos, "SCRL ", 5); | 118 | memcpy(output + pos, "SCRL ", 5); |
| 121 | pos += 5; | 119 | pos += 5; |
| 122 | } | 120 | } |
| 123 | if (state->status.leds & (1u << USB_LED_COMPOSE)) { | 121 | if (state->status.leds & (1u << USB_LED_COMPOSE)) { |
| 124 | memcpy(output + pos, "COMP ", 5); | 122 | memcpy(output + pos, "COMP ", 5); |
| 125 | pos += 5; | 123 | pos += 5; |
| 126 | } | 124 | } |
| 127 | if (state->status.leds & (1u << USB_LED_KANA)) { | 125 | if (state->status.leds & (1u << USB_LED_KANA)) { |
| 128 | memcpy(output + pos, "KANA", 4); | 126 | memcpy(output + pos, "KANA", 4); |
| 129 | pos += 4; | 127 | pos += 4; |
| 130 | } | 128 | } |
| 131 | output[pos] = 0; | 129 | output[pos] = 0; |
| 132 | } | 130 | } |
| 133 | 131 | ||
| 134 | bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state) | 132 | bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 135 | { | ||
| 136 | (void)animation; | 133 | (void)animation; |
| 137 | char output[LED_STATE_STRING_SIZE]; | 134 | char output[LED_STATE_STRING_SIZE]; |
| 138 | get_led_state_string(output, state); | 135 | get_led_state_string(output, state); |
| @@ -165,14 +162,13 @@ bool lcd_keyframe_draw_logo(keyframe_animation_t* animation, visualizer_state_t* | |||
| 165 | // You can use static variables for things that can't be found in the animation | 162 | // You can use static variables for things that can't be found in the animation |
| 166 | // or state structs, here we use the image | 163 | // or state structs, here we use the image |
| 167 | 164 | ||
| 168 | //gdispGBlitArea is a tricky function to use since it supports blitting part of the image | 165 | // gdispGBlitArea is a tricky function to use since it supports blitting part of the image |
| 169 | // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions | 166 | // if you have full screen image, then just use LCD_WIDTH and LCD_HEIGHT for both source and target dimensions |
| 170 | gdispGBlitArea(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo); | 167 | gdispGBlitArea(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, 0, 0, LCD_WIDTH, (pixel_t*)resource_lcd_logo); |
| 171 | 168 | ||
| 172 | return false; | 169 | return false; |
| 173 | } | 170 | } |
| 174 | 171 | ||
| 175 | |||
| 176 | bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { | 172 | bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) { |
| 177 | (void)animation; | 173 | (void)animation; |
| 178 | (void)state; | 174 | (void)state; |
