-
-
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.
still not done refrash rate from flipper change and is slow so the rainbow mode doesnt look good
- Loading branch information
Showing
8 changed files
with
143 additions
and
25 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
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#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}}; | ||
|
||
switch(momentum_settings.vgm_color_mode) { | ||
case VgmColorModeCustom: | ||
color = momentum_settings.vgm_color_fg; | ||
break; | ||
case VgmColorModeRainbow: | ||
//color = rainbow_step(&state.fg); | ||
break; | ||
case VgmColorModeRgbBacklight: | ||
//rgb_backlight_get_color(0, &color); | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return color; | ||
} | ||
|
||
RgbColor get_screen_color_bg() { | ||
RgbColor color = {{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); | ||
break; | ||
case VgmColorModeRgbBacklight: | ||
rgb_backlight_get_color(0, &color); | ||
break; | ||
default: | ||
break; | ||
} | ||
|
||
return color; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#pragma once | ||
|
||
#include "colors.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
void rpc_rgb_init(); | ||
|
||
RgbColor get_screen_color_fg(); | ||
RgbColor get_screen_color_bg(); | ||
|
||
void rpc_rgb_deinit(); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
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
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