123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- #ifndef LCD_BACKLIGHT_ENABLE
- #error This visualizer needs that LCD backlight is enabled
- #endif
- #ifndef LCD_ENABLE
- #error This visualizer needs that LCD is enabled
- #endif
- #include "visualizer.h"
- static const char* welcome_text[] = {"TMK", "Infinity Ergodox"};
- bool display_welcome(keyframe_animation_t* animation, visualizer_state_t* state) {
- (void)animation;
-
-
- gdispClear(White);
-
-
- gdispDrawString(0, 3, welcome_text[0], state->font_dejavusansbold12, Black);
- gdispDrawString(0, 15, welcome_text[1], state->font_dejavusansbold12, Black);
-
- gdispFlush();
-
-
-
-
- return false;
- }
- static keyframe_animation_t startup_animation = {
- .num_frames = 4,
- .loop = false,
- .frame_lengths = {0, MS2ST(1000), MS2ST(5000), 0},
- .frame_functions = {display_welcome, keyframe_animate_backlight_color, keyframe_no_operation, enable_visualization},
- };
- static keyframe_animation_t color_animation = {
- .num_frames = 2,
- .loop = false,
-
-
-
- .frame_lengths = {MS2ST(200), MS2ST(500)},
- .frame_functions = {keyframe_no_operation, keyframe_animate_backlight_color},
- };
- static keyframe_animation_t lcd_animation = {
- .num_frames = 2,
- .loop = true,
- .frame_lengths = {MS2ST(2000), MS2ST(2000)},
- .frame_functions = {keyframe_display_layer_text, keyframe_display_layer_bitmap},
- };
- void initialize_user_visualizer(visualizer_state_t* state) {
-
-
- lcd_backlight_brightness(0x50);
- state->current_lcd_color = LCD_COLOR(0x00, 0x00, 0xFF);
- state->target_lcd_color = LCD_COLOR(0x10, 0xFF, 0xFF);
- start_keyframe_animation(&startup_animation);
- }
- void update_user_visualizer_state(visualizer_state_t* state) {
-
-
-
-
-
-
-
- if (state->status.layer & 0x2) {
- state->target_lcd_color = LCD_COLOR(0xA0, 0xB0, 0xFF);
- state->layer_text = "Layer 2";
- }
- else {
- state->target_lcd_color = LCD_COLOR(0x50, 0xB0, 0xFF);
- state->layer_text = "Layer 1";
- }
-
-
-
- start_keyframe_animation(&lcd_animation);
- start_keyframe_animation(&color_animation);
- }
|