-
-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,42 @@ | ||
#include "rpc_rgb.h" | ||
|
||
#include "colors.h" | ||
#include "momentum.h" | ||
#include "drivers/rgb_backlight.h" | ||
|
||
static const RgbColor rainbow_colors[] = { | ||
{{255, 0, 0}}, // Red | ||
{{255, 130, 0}}, // Orange | ||
{{255, 255, 0}}, // Yellow | ||
{{0, 255, 0}}, // Green | ||
{{0, 0, 255}}, // Blue | ||
{{123, 0, 255}}, // Indigo | ||
{{255, 0, 255}} // Violet | ||
}; | ||
|
||
typedef struct { | ||
uint8_t color; | ||
uint8_t step; | ||
} rgb_trans; | ||
|
||
static struct { | ||
rgb_trans fg; | ||
rgb_trans bg; | ||
} state = { | ||
.fg = {0, 0}, | ||
.bg = {0, 0}, | ||
}; | ||
|
||
RgbColor rainbow_step(rgb_trans* rgb) { | ||
if(rgb->step >= 20) { | ||
rgb->color = (rgb->color + 1) % 7; | ||
rgb->step = 0; | ||
} | ||
|
||
RgbColor color = interpolate_color( | ||
&rainbow_colors[rgb->color], &rainbow_colors[(rgb->color + 1) % 7], rgb->step, 20); | ||
rgb->step++; | ||
|
||
return color; | ||
} | ||
|
||
RgbColor get_screen_color_fg() { | ||
RgbColor color = {{0, 0, 0}}; | ||
uint32_t get_screen_color_fg() { | ||
RgbColorTransmit color = { | ||
.mode = momentum_settings.vgm_color_mode, | ||
.rgb = {{0, 0, 0}}, | ||
}; | ||
|
||
switch(momentum_settings.vgm_color_mode) { | ||
case VgmColorModeCustom: | ||
color = momentum_settings.vgm_color_fg; | ||
break; | ||
case VgmColorModeRainbow: | ||
//color = rainbow_step(&state.fg); | ||
color.rgb = momentum_settings.vgm_color_fg; | ||
break; | ||
case VgmColorModeRgbBacklight: | ||
//rgb_backlight_get_color(0, &color); | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return color; | ||
return color.value; | ||
} | ||
|
||
RgbColor get_screen_color_bg() { | ||
RgbColor color = {{255, 130, 0}}; | ||
uint32_t get_screen_color_bg() { | ||
RgbColorTransmit color = { | ||
.mode = momentum_settings.vgm_color_mode, | ||
.rgb = {{255, 130, 0}}, | ||
}; | ||
|
||
switch(momentum_settings.vgm_color_mode) { | ||
case VgmColorModeCustom: | ||
color = momentum_settings.vgm_color_bg; | ||
break; | ||
case VgmColorModeRainbow: | ||
color = rainbow_step(&state.bg); | ||
color.rgb = momentum_settings.vgm_color_bg; | ||
break; | ||
case VgmColorModeRgbBacklight: | ||
rgb_backlight_get_color(0, &color); | ||
rgb_backlight_get_color(0, &color.rgb); | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return color; | ||
return color.value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters