You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.1 KiB
C

#include "keymap.h"
#include "lighting.h"
#include "lighting_layers.h"
void hsv_matrix_set_color(int index, const uint8_t hsv_color[3]) {
if (index >= DRIVER_LED_TOTAL)
return;
HSV hsv = {
.h = hsv_color[0],
.s = hsv_color[1],
.v = hsv_color[2],
};
RGB rgb = hsv_to_rgb(hsv);
float f = (float)rgb_matrix_config.hsv.v / UINT8_MAX;
rgb_matrix_set_color(index, f * rgb.r, f * rgb.g, f * rgb.b);
}
void set_layer_color(int layer) {
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
HSV hsv = {
.h = pgm_read_byte(&ledmap[layer][i][0]),
.s = pgm_read_byte(&ledmap[layer][i][1]),
.v = pgm_read_byte(&ledmap[layer][i][2]),
};
if(hsv.h || hsv.s || hsv.v) {
hsv_matrix_set_color(i, ledmap[layer][i]);
} else if (
layer == _GAME_LAYER ||
layer == _POM_LAYER ||
layer == _POM_LAYER2
) {
// Allow lights to be blanked
hsv_matrix_set_color(i, (uint8_t[3]) {0, 0, 0});
}
}
}