Skip to content

Commit

Permalink
Clarify naming between LCD_BACKLIGHT and LED_BACKLIGHT
Browse files Browse the repository at this point in the history
  • Loading branch information
fredizzimo authored and jackhumbert committed Jul 10, 2017
1 parent f3c113f commit 2251560
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 73 deletions.
44 changes: 22 additions & 22 deletions keyboards/ergodox/infinity/animations.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#endif

#ifdef BACKLIGHT_ENABLE
#include "led_keyframes.h"
#include "led_backlight_keyframes.h"
#endif

#include "visualizer_keyframes.h"
Expand All @@ -39,10 +39,10 @@ static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t*
lcd_keyframe_enable(animation, state);
#endif
#ifdef LCD_BACKLIGHT_ENABLE
backlight_keyframe_enable(animation, state);
lcd_backlight_keyframe_enable(animation, state);
#endif
#ifdef BACKLIGHT_ENABLE
led_keyframe_enable(animation, state);
led_backlight_keyframe_enable(animation, state);
#endif
return false;
}
Expand All @@ -52,32 +52,32 @@ static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t
lcd_keyframe_disable(animation, state);
#endif
#ifdef LCD_BACKLIGHT_ENABLE
backlight_keyframe_disable(animation, state);
lcd_backlight_keyframe_disable(animation, state);
#endif
#ifdef BACKLIGHT_ENABLE
led_keyframe_disable(animation, state);
led_backlight_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);
ret |= lcd_backlight_keyframe_animate_color(animation, state);
#endif
#ifdef BACKLIGHT_ENABLE
ret |= led_keyframe_fade_in_all(animation, state);
ret |= led_backlight_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);
ret |= lcd_backlight_keyframe_animate_color(animation, state);
#endif
#ifdef BACKLIGHT_ENABLE
ret |= led_keyframe_fade_out_all(animation, state);
ret |= led_backlight_keyframe_fade_out_all(animation, state);
#endif
return ret;
}
Expand Down Expand Up @@ -133,20 +133,20 @@ keyframe_animation_t led_test_animation = {

},
.frame_functions = {
led_keyframe_fade_in_all,
led_backlight_keyframe_fade_in_all,
keyframe_no_operation,
led_keyframe_fade_out_all,
led_keyframe_crossfade,
led_keyframe_left_to_right_gradient,
led_keyframe_crossfade,
led_keyframe_top_to_bottom_gradient,
led_keyframe_mirror_orientation,
led_keyframe_crossfade,
led_keyframe_left_to_right_gradient,
led_keyframe_crossfade,
led_keyframe_top_to_bottom_gradient,
led_keyframe_normal_orientation,
led_keyframe_crossfade,
led_backlight_keyframe_fade_out_all,
led_backlight_keyframe_crossfade,
led_backlight_keyframe_left_to_right_gradient,
led_backlight_keyframe_crossfade,
led_backlight_keyframe_top_to_bottom_gradient,
led_backlight_keyframe_mirror_orientation,
led_backlight_keyframe_crossfade,
led_backlight_keyframe_left_to_right_gradient,
led_backlight_keyframe_crossfade,
led_backlight_keyframe_top_to_bottom_gradient,
led_backlight_keyframe_normal_orientation,
led_backlight_keyframe_crossfade,
},
};
#endif
Expand Down
2 changes: 1 addition & 1 deletion keyboards/ergodox/infinity/simple_visualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static keyframe_animation_t color_animation = {
// this prevents the color from changing when activating the layer
// momentarily
.frame_lengths = {gfxMillisecondsToTicks(200), gfxMillisecondsToTicks(500)},
.frame_functions = {keyframe_no_operation, backlight_keyframe_animate_color},
.frame_functions = {keyframe_no_operation, lcd_backlight_keyframe_animate_color},
};

void initialize_user_visualizer(visualizer_state_t* state) {
Expand Down
4 changes: 2 additions & 2 deletions keyboards/ergodox/infinity/visualizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static keyframe_animation_t one_led_color = {
.num_frames = 1,
.loop = false,
.frame_lengths = {gfxMillisecondsToTicks(0)},
.frame_functions = {backlight_keyframe_set_color},
.frame_functions = {lcd_backlight_keyframe_set_color},
};

bool swap_led_target_color(keyframe_animation_t* animation, visualizer_state_t* state) {
Expand All @@ -94,7 +94,7 @@ static keyframe_animation_t two_led_colors = {
.num_frames = 2,
.loop = true,
.frame_lengths = {gfxMillisecondsToTicks(1000), gfxMillisecondsToTicks(0)},
.frame_functions = {backlight_keyframe_set_color, swap_led_target_color},
.frame_functions = {lcd_backlight_keyframe_set_color, swap_led_target_color},
};

// The LCD animation alternates between the layer name display and a
Expand Down
36 changes: 18 additions & 18 deletions keyboards/whitefox/animations.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#include "visualizer.h"

#ifdef BACKLIGHT_ENABLE
#include "led_keyframes.h"
#include "led_backlight_keyframes.h"
#endif

#include "visualizer_keyframes.h"
Expand All @@ -30,30 +30,30 @@

static bool keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
#ifdef BACKLIGHT_ENABLE
led_keyframe_enable(animation, state);
led_backlight_keyframe_enable(animation, state);
#endif
return false;
}

static bool keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
#ifdef BACKLIGHT_ENABLE
led_keyframe_disable(animation, state);
led_backlight_keyframe_disable(animation, state);
#endif
return false;
}

static bool keyframe_fade_in(keyframe_animation_t* animation, visualizer_state_t* state) {
bool ret = false;
#ifdef BACKLIGHT_ENABLE
ret |= led_keyframe_fade_in_all(animation, state);
ret |= led_backlight_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 BACKLIGHT_ENABLE
ret |= led_keyframe_fade_out_all(animation, state);
ret |= led_backlight_keyframe_fade_out_all(animation, state);
#endif
return ret;
}
Expand Down Expand Up @@ -107,20 +107,20 @@ keyframe_animation_t led_test_animation = {

},
.frame_functions = {
led_keyframe_fade_in_all,
led_backlight_keyframe_fade_in_all,
keyframe_no_operation,
led_keyframe_fade_out_all,
led_keyframe_crossfade,
led_keyframe_left_to_right_gradient,
led_keyframe_crossfade,
led_keyframe_top_to_bottom_gradient,
led_keyframe_mirror_orientation,
led_keyframe_crossfade,
led_keyframe_left_to_right_gradient,
led_keyframe_crossfade,
led_keyframe_top_to_bottom_gradient,
led_keyframe_normal_orientation,
led_keyframe_crossfade,
led_backlight_keyframe_fade_out_all,
led_backlight_keyframe_crossfade,
led_backlight_keyframe_left_to_right_gradient,
led_backlight_keyframe_crossfade,
led_backlight_keyframe_top_to_bottom_gradient,
led_backlight_keyframe_mirror_orientation,
led_backlight_keyframe_crossfade,
led_backlight_keyframe_left_to_right_gradient,
led_backlight_keyframe_crossfade,
led_backlight_keyframe_top_to_bottom_gradient,
led_backlight_keyframe_normal_orientation,
led_backlight_keyframe_crossfade,
},
};
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
#include "visualizer.h"

// Animates the LCD backlight color between the current color and the target color (of the state)
bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state);
bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state);
// Sets the backlight color to the target color
bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state);
bool lcd_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);
bool lcd_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);

#endif /* QUANTUM_VISUALIZER_LCD_BACKLIGHT_KEYFRAMES_H_ */
8 changes: 4 additions & 4 deletions quantum/visualizer/lcd_backlight_keyframes.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include "lcd_backlight_keyframes.h"

bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) {
bool lcd_backlight_keyframe_animate_color(keyframe_animation_t* animation, visualizer_state_t* state) {
int frame_length = animation->frame_lengths[animation->current_frame];
int current_pos = frame_length - animation->time_left_in_frame;
uint8_t t_h = LCD_HUE(state->target_lcd_color);
Expand Down Expand Up @@ -49,7 +49,7 @@ bool backlight_keyframe_animate_color(keyframe_animation_t* animation, visualize
return true;
}

bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) {
bool lcd_backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
state->prev_lcd_color = state->target_lcd_color;
state->current_lcd_color = state->target_lcd_color;
Expand All @@ -60,14 +60,14 @@ bool backlight_keyframe_set_color(keyframe_animation_t* animation, visualizer_st
return false;
}

bool backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
bool lcd_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) {
bool lcd_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
(void)state;
lcd_backlight_color(LCD_HUE(state->current_lcd_color),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ SOFTWARE.
*/
#include "gfx.h"
#include "math.h"
#include "led_keyframes.h"
#include "led_backlight_keyframes.h"

static uint8_t fade_led_color(keyframe_animation_t* animation, int from, int to) {
int frame_length = animation->frame_lengths[animation->current_frame];
Expand Down Expand Up @@ -55,19 +55,19 @@ static uint8_t compute_gradient_color(float t, float index, float num) {
return (uint8_t)(255.0f * v);
}

bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) {
bool led_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
keyframe_fade_all_leds_from_to(animation, 0, 255);
return true;
}

bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) {
bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
keyframe_fade_all_leds_from_to(animation, 255, 0);
return true;
}

bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame;
Expand All @@ -79,7 +79,7 @@ bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visual
return true;
}

bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
float frame_length = animation->frame_lengths[animation->current_frame];
float current_pos = frame_length - animation->time_left_in_frame;
Expand All @@ -98,7 +98,7 @@ static void copy_current_led_state(uint8_t* dest) {
}
}
}
bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) {
bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
if (animation->first_update_of_frame) {
copy_current_led_state(&crossfade_start_frame[0][0]);
Expand All @@ -114,28 +114,28 @@ bool led_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t*
return true;
}

bool led_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
(void)animation;
gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_180);
return false;
}

bool led_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
bool led_backlight_keyframe_normal_orientation(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
(void)animation;
gdispGSetOrientation(LED_DISPLAY, GDISP_ROTATE_0);
return false;
}

bool led_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state) {
bool led_backlight_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) {
bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)state;
(void)animation;
gdispGSetPowerMode(LED_DISPLAY, powerOn);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#ifndef LED_KEYFRAMES_H
#define LED_KEYFRAMES_H
#ifndef LED_BACKLIGHT_KEYFRAMES_H
#define LED_BACKLIGHT_KEYFRAMES_H

#include "visualizer.h"

bool led_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_keyframe_crossfade(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_backlight_keyframe_fade_in_all(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_backlight_keyframe_fade_out_all(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_backlight_keyframe_left_to_right_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_backlight_keyframe_top_to_bottom_gradient(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_backlight_keyframe_crossfade(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_backlight_keyframe_mirror_orientation(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_backlight_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);
bool led_backlight_keyframe_disable(keyframe_animation_t* animation, visualizer_state_t* state);
bool led_backlight_keyframe_enable(keyframe_animation_t* animation, visualizer_state_t* state);

extern keyframe_animation_t led_test_animation;

Expand Down
2 changes: 1 addition & 1 deletion quantum/visualizer/visualizer.mk
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ OPT_DEFS += -DLCD_BACKLIGHT_ENABLE
endif

ifeq ($(strip $(BACKLIGHT_ENABLE)), yes)
SRC += $(VISUALIZER_DIR)/led_keyframes.c
SRC += $(VISUALIZER_DIR)/led_backlight_keyframes.c
endif

include $(GFXLIB)/gfx.mk
Expand Down

0 comments on commit 2251560

Please sign in to comment.