forked from mfulz_github/qmk_firmware
		
	Add backlight support to the default Ergodox Infinity animations
This commit is contained in:
		
							parent
							
								
									2a7f9a7e46
								
							
						
					
					
						commit
						b51a0db6ed
					
				@ -32,31 +32,78 @@
 | 
				
			|||||||
#include "visualizer_keyframes.h"
 | 
					#include "visualizer_keyframes.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(LCD_ENABLE) && defined(LCD_BACKLIGHT_ENABLE)
 | 
					#if defined(LCD_ENABLE) || defined(LCD_BACKLIGHT_ENABLE) || defined(BACKLIGHT_ENABLE)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
 | 
				
			||||||
 | 
					#ifdef LCD_ENABLE
 | 
				
			||||||
 | 
					    lcd_keyframe_enable(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef LCD_BACKLIGHT_ENABLE
 | 
				
			||||||
 | 
					    backlight_keyframe_enable(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef BACKLIGHT_ENABLE
 | 
				
			||||||
 | 
					    led_keyframe_enable(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
 | 
				
			||||||
 | 
					#ifdef LCD_ENABLE
 | 
				
			||||||
 | 
					    lcd_keyframe_disable(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef LCD_BACKLIGHT_ENABLE
 | 
				
			||||||
 | 
					    backlight_keyframe_disable(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef BACKLIGHT_ENABLE
 | 
				
			||||||
 | 
					    led_keyframe_disable(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
 | 
				
			||||||
 | 
					    bool ret = false;
 | 
				
			||||||
 | 
					#ifdef LCD_BACKLIGHT_ENABLE
 | 
				
			||||||
 | 
					    ret |= backlight_keyframe_animate_color(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef BACLIGHT_ENABLE
 | 
				
			||||||
 | 
					    ret |= led_keyframe_fade_in_all(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    return ret;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_t* state) {
 | 
				
			||||||
 | 
					    bool ret = false;
 | 
				
			||||||
 | 
					#ifdef LCD_BACKLIGHT_ENABLE
 | 
				
			||||||
 | 
					    ret |= backlight_keyframe_animate_color(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					#ifdef BACLIGHT_ENABLE
 | 
				
			||||||
 | 
					    ret |= led_keyframe_fade_out_all(animation, state);
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					    return ret;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Don't worry, if the startup animation is long, you can use the keyboard like normal
 | 
					// Don't worry, if the startup animation is long, you can use the keyboard like normal
 | 
				
			||||||
// during that time
 | 
					// during that time
 | 
				
			||||||
keyframe_animation_t default_startup_animation = {
 | 
					keyframe_animation_t default_startup_animation = {
 | 
				
			||||||
    .num_frames = 4,
 | 
					    .num_frames = 3,
 | 
				
			||||||
    .loop = false,
 | 
					    .loop = false,
 | 
				
			||||||
    .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(5000), 0},
 | 
					    .frame_lengths = {0, 0, gfxMillisecondsToTicks(5000)},
 | 
				
			||||||
    .frame_functions = {
 | 
					    .frame_functions = {
 | 
				
			||||||
            lcd_keyframe_enable,
 | 
					            keyframe_enable,
 | 
				
			||||||
            backlight_keyframe_enable,
 | 
					 | 
				
			||||||
            lcd_keyframe_draw_logo,
 | 
					            lcd_keyframe_draw_logo,
 | 
				
			||||||
            backlight_keyframe_animate_color,
 | 
					            keyframe_fade_in,
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
keyframe_animation_t default_suspend_animation = {
 | 
					keyframe_animation_t default_suspend_animation = {
 | 
				
			||||||
    .num_frames = 4,
 | 
					    .num_frames = 3,
 | 
				
			||||||
    .loop = false,
 | 
					    .loop = false,
 | 
				
			||||||
    .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0},
 | 
					    .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0},
 | 
				
			||||||
    .frame_functions = {
 | 
					    .frame_functions = {
 | 
				
			||||||
            lcd_keyframe_display_layer_text,
 | 
					            lcd_keyframe_display_layer_text,
 | 
				
			||||||
            backlight_keyframe_animate_color,
 | 
					            keyframe_fade_out,
 | 
				
			||||||
            lcd_keyframe_disable,
 | 
					            keyframe_disable,
 | 
				
			||||||
            backlight_keyframe_disable,
 | 
					 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
				
			|||||||
@ -127,3 +127,17 @@ bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer
 | 
				
			|||||||
    gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0);
 | 
					    gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0);
 | 
				
			||||||
    return false;
 | 
					    return false;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
 | 
				
			||||||
 | 
					    (void)state;
 | 
				
			||||||
 | 
					    (void)animation;
 | 
				
			||||||
 | 
					    gdispGSetPowerMode(LED_DISPLAY, powerOff);
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
 | 
				
			||||||
 | 
					    (void)state;
 | 
				
			||||||
 | 
					    (void)animation;
 | 
				
			||||||
 | 
					    gdispGSetPowerMode(LED_DISPLAY, powerOn);
 | 
				
			||||||
 | 
					    return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -35,6 +35,9 @@ bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t*
 | 
				
			|||||||
bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
 | 
					bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
 | 
				
			||||||
bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
 | 
					bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
 | 
				
			||||||
 | 
					bool led_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
extern keyframe_animation_t led_test_animation;
 | 
					extern keyframe_animation_t led_test_animation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user