Separated backlight and LCD disable/enable

Also moved them to correct places
This commit is contained in:
Fred Sundvik 2017-04-05 09:21:18 +03:00
parent 5ba228b684
commit 1e7585e767
8 changed files with 53 additions and 36 deletions

View file

@ -186,22 +186,24 @@ static keyframe_animation_t lcd_bitmap_leds_animation = {
}; };
static keyframe_animation_t suspend_animation = { static keyframe_animation_t suspend_animation = {
.num_frames = 3, .num_frames = 4,
.loop = false, .loop = false,
.frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0},
.frame_functions = { .frame_functions = {
lcd_keyframe_display_layer_text, lcd_keyframe_display_layer_text,
backlight_keyframe_animate_color, backlight_keyframe_animate_color,
keyframe_disable_lcd_and_backlight, lcd_keyframe_disable,
lcd_keyframe_disable,
}, },
}; };
static keyframe_animation_t resume_animation = { static keyframe_animation_t resume_animation = {
.num_frames = 4, .num_frames = 5,
.loop = false, .loop = false,
.frame_lengths = {0, 0, gfxMillisecondsToTicks(10000), 0}, .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(10000), 0},
.frame_functions = { .frame_functions = {
keyframe_enable_lcd_and_backlight, lcd_keyframe_enable,
backlight_keyframe_enable,
display_logo, display_logo,
backlight_keyframe_animate_color, backlight_keyframe_animate_color,
enable_visualization, enable_visualization,

View file

@ -128,22 +128,24 @@ static keyframe_animation_t lcd_layer_display = {
}; };
static keyframe_animation_t suspend_animation = { static keyframe_animation_t suspend_animation = {
.num_frames = 3, .num_frames = 4,
.loop = false, .loop = false,
.frame_lengths = {0, gfxMillisecondsToTicks(1000), 0}, .frame_lengths = {0, gfxMillisecondsToTicks(1000), 0, 0},
.frame_functions = { .frame_functions = {
lcd_keyframe_display_layer_text, lcd_keyframe_display_layer_text,
backlight_keyframe_animate_color, backlight_keyframe_animate_color,
keyframe_disable_lcd_and_backlight, lcd_keyframe_disable,
lcd_keyframe_disable,
}, },
}; };
static keyframe_animation_t resume_animation = { static keyframe_animation_t resume_animation = {
.num_frames = 4, .num_frames = 5,
.loop = false, .loop = false,
.frame_lengths = {0, 0, gfxMillisecondsToTicks(10000), 0}, .frame_lengths = {0, 0, 0, gfxMillisecondsToTicks(10000), 0},
.frame_functions = { .frame_functions = {
keyframe_enable_lcd_and_backlight, lcd_keyframe_enable,
backlight_keyframe_enable,
display_logo, display_logo,
backlight_keyframe_animate_color, backlight_keyframe_animate_color,
enable_visualization, enable_visualization,

View file

@ -59,3 +59,19 @@ bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_st
LCD_INT(state->current_lcd_color)); LCD_INT(state->current_lcd_color));
return false; return false;
} }
bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
lcd_backlight_hal_color(0, 0, 0);
return false;
}
bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
lcd_backlight_color(LCD_HUE(state->current_lcd_color),
LCD_SAT(state->current_lcd_color),
LCD_INT(state->current_lcd_color));
return false;
}

View file

@ -24,4 +24,7 @@ bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualize
// Sets the backlight color to the target color // Sets the backlight color to the target color
bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state); bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state);
bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
bool backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
#endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */ #endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */

View file

@ -158,3 +158,17 @@ bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation,
gdispFlush(); gdispFlush();
return false; return false;
} }
bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
gdispSetPowerMode(powerOff);
return false;
}
bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
gdispSetPowerMode(powerOn);
return false;
}

View file

@ -30,4 +30,8 @@ bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer
// Displays both the layer text and the led states // Displays both the layer text and the led states
bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state); bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state);
bool lcd_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
bool lcd_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);
#endif /* QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_ */ #endif /* QUANTUM_VISUALIZER_LCD_KEYFRAMES_H_ */

View file

@ -228,27 +228,6 @@ bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t*
return false; return false;
} }
bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
#ifdef LCD_ENABLE
gdispSetPowerMode(powerOff);
#endif
#ifdef LCD_BACKLIGHT_ENABLE
lcd_backlight_hal_color(0, 0, 0);
#endif
return false;
}
bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
#ifdef LCD_ENABLE
gdispSetPowerMode(powerOn);
#endif
return false;
}
bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state) { bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation; (void)animation;
(void)state; (void)state;

View file

@ -130,9 +130,6 @@ void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* stat
// Does nothing, useful for adding delays // Does nothing, useful for adding delays
bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state); bool keyframe_no_operation(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_disable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
bool keyframe_enable_lcd_and_backlight(keyframe_animation_t* animation, visualizer_state_t* state);
// Call this once, when the initial animation has finished, alternatively you can call it // Call this once, when the initial animation has finished, alternatively you can call it
// directly from the initalize_user_visualizer function (the animation can be null) // directly from the initalize_user_visualizer function (the animation can be null)
bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state); bool enable_visualization(keyframe_animation_t* animation, visualizer_state_t* state);