mirror of
https://github.com/whowechina/aic_pico.git
synced 2025-02-22 05:09:38 +01:00
Clean up light_set_color methods
This commit is contained in:
parent
84310663cb
commit
53a23921ce
@ -190,15 +190,7 @@ static void drive_led()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void light_set_color(unsigned index, uint32_t color)
|
void light_set_color(uint32_t color)
|
||||||
{
|
|
||||||
if (index >= RGB_NUM) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
rgb_buf[index] = apply_level(color);
|
|
||||||
}
|
|
||||||
|
|
||||||
void light_set_color_all(uint32_t color)
|
|
||||||
{
|
{
|
||||||
for (int i = 0; i < RGB_NUM; i++) {
|
for (int i = 0; i < RGB_NUM; i++) {
|
||||||
rgb_buf[i] = apply_level_by(color, aic_cfg->light.max);
|
rgb_buf[i] = apply_level_by(color, aic_cfg->light.max);
|
||||||
@ -208,7 +200,7 @@ void light_set_color_all(uint32_t color)
|
|||||||
static uint64_t last_hid = 0;
|
static uint64_t last_hid = 0;
|
||||||
void light_hid_light(uint8_t r, uint8_t g, uint8_t b)
|
void light_hid_light(uint8_t r, uint8_t g, uint8_t b)
|
||||||
{
|
{
|
||||||
light_set_color_all(rgb32(r, g, b, false));
|
light_set_color(rgb32(r, g, b, false));
|
||||||
last_hid = time_us_64();
|
last_hid = time_us_64();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,8 +18,7 @@ void light_update();
|
|||||||
uint32_t rgb32(uint32_t r, uint32_t g, uint32_t b, bool gamma_fix);
|
uint32_t rgb32(uint32_t r, uint32_t g, uint32_t b, bool gamma_fix);
|
||||||
uint32_t rgb32_from_hsv(uint8_t h, uint8_t s, uint8_t v);
|
uint32_t rgb32_from_hsv(uint8_t h, uint8_t s, uint8_t v);
|
||||||
|
|
||||||
void light_set_color(unsigned index, uint32_t color);
|
void light_set_color(uint32_t color);
|
||||||
void light_set_color_all(uint32_t color);
|
|
||||||
void light_hid_light(uint8_t r, uint8_t g, uint8_t b);
|
void light_hid_light(uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
|
||||||
void light_set_rainbow(bool enable);
|
void light_set_rainbow(bool enable);
|
||||||
|
@ -97,10 +97,10 @@ static void light_effect()
|
|||||||
{
|
{
|
||||||
if (aime_is_active()) {
|
if (aime_is_active()) {
|
||||||
light_set_rainbow(false);
|
light_set_rainbow(false);
|
||||||
light_set_color_all(aime_led_color());
|
light_set_color(aime_led_color());
|
||||||
} else if (bana_is_active()) {
|
} else if (bana_is_active()) {
|
||||||
light_set_rainbow(false);
|
light_set_rainbow(false);
|
||||||
light_set_color_all(bana_led_color());
|
light_set_color(bana_led_color());
|
||||||
} else {
|
} else {
|
||||||
if (memcmp(hid_cardio.current, "\0\0\0\0\0\0\0\0\0", 9) != 0) {
|
if (memcmp(hid_cardio.current, "\0\0\0\0\0\0\0\0\0", 9) != 0) {
|
||||||
light_stimulate();
|
light_stimulate();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user