From a916f4e8b897b6b8925d7113d84f9eac7e7b67be Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 3 Jun 2017 14:34:50 +0300 Subject: Let BACKLIGHT_ENABLE control the Infinity LEDs --- keyboards/ergodox/infinity/animations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'keyboards/ergodox/infinity/animations.c') diff --git a/keyboards/ergodox/infinity/animations.c b/keyboards/ergodox/infinity/animations.c index 4c9f6d9c85..0e732b7411 100644 --- a/keyboards/ergodox/infinity/animations.c +++ b/keyboards/ergodox/infinity/animations.c @@ -25,7 +25,7 @@ #include "lcd_backlight_keyframes.h" #endif -#ifdef LED_ENABLE +#ifdef BACKLIGHT_ENABLE #include "led_keyframes.h" #endif @@ -61,7 +61,7 @@ keyframe_animation_t default_suspend_animation = { }; #endif -#if defined(LED_ENABLE) +#if defined(BACKLIGHT_ENABLE) #define CROSSFADE_TIME 1000 #define GRADIENT_TIME 3000 -- cgit v1.2.3 From b51a0db6ed03d939baad7cb9d87ed13c3653c7d2 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Sat, 3 Jun 2017 22:04:10 +0300 Subject: Add backlight support to the default Ergodox Infinity animations --- keyboards/ergodox/infinity/animations.c | 69 +++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 11 deletions(-) (limited to 'keyboards/ergodox/infinity/animations.c') diff --git a/keyboards/ergodox/infinity/animations.c b/keyboards/ergodox/infinity/animations.c index 0e732b7411..675519e309 100644 --- a/keyboards/ergodox/infinity/animations.c +++ b/keyboards/ergodox/infinity/animations.c @@ -32,31 +32,78 @@ #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 // during that time keyframe_animation_t default_startup_animation = { - .num_frames = 4, + .num_frames = 3, .loop = false, - .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(5000), 0}, + .frame_lengths = {0, 0, gfxMillisecondsToTicks(5000)}, .frame_functions = { - lcd_keyframe_enable, - backlight_keyframe_enable, + keyframe_enable, lcd_keyframe_draw_logo, - backlight_keyframe_animate_color, + keyframe_fade_in, }, }; keyframe_animation_t default_suspend_animation = { - .num_frames = 4, + .num_frames = 3, .loop = false, - .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0}, + .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, .frame_functions = { lcd_keyframe_display_layer_text, - backlight_keyframe_animate_color, - lcd_keyframe_disable, - backlight_keyframe_disable, + keyframe_fade_out, + keyframe_disable, }, }; #endif -- cgit v1.2.3 From 19f0285a766e412db14e6cbe24532fdbff610af0 Mon Sep 17 00:00:00 2001 From: Fred Sundvik Date: Thu, 15 Jun 2017 23:21:01 +0300 Subject: Fix typo in BACKLIGHT_ENABLE --- keyboards/ergodox/infinity/animations.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'keyboards/ergodox/infinity/animations.c') diff --git a/keyboards/ergodox/infinity/animations.c b/keyboards/ergodox/infinity/animations.c index 675519e309..ebc08fde36 100644 --- a/keyboards/ergodox/infinity/animations.c +++ b/keyboards/ergodox/infinity/animations.c @@ -65,7 +65,7 @@ static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t #ifdef LCD_BACKLIGHT_ENABLE ret |= backlight_keyframe_animate_color(animation, state); #endif -#ifdef BACLIGHT_ENABLE +#ifdef BACKLIGHT_ENABLE ret |= led_keyframe_fade_in_all(animation, state); #endif return ret; @@ -76,7 +76,7 @@ static bool keyframe_fade_out(keyframe_animation_t* animation, visualizer_state_ #ifdef LCD_BACKLIGHT_ENABLE ret |= backlight_keyframe_animate_color(animation, state); #endif -#ifdef BACLIGHT_ENABLE +#ifdef BACKLIGHT_ENABLE ret |= led_keyframe_fade_out_all(animation, state); #endif return ret; -- cgit v1.2.3