Updated rgb_led struct field modifier to flags (#5619)
Updated effects to test led flags Updated massdrop to use new flags field for led toggle
This commit is contained in:
committed by
Drashna Jaelre
parent
ff3e430970
commit
6364fe4efb
@@ -269,64 +269,64 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
|
rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
|
||||||
|
|
||||||
/*{row | col << 4}
|
/*{row | col << 4}
|
||||||
| {x=0..224, y=0..64}
|
| {x=0..224, y=0..64}
|
||||||
| | modifier
|
| | flags
|
||||||
| | | */
|
| | | */
|
||||||
{{ 8|(0<<4)}, {17.2* 8, 12.8*0}, 0}, // LED 1 on right > Key 6
|
{{ 8|(0<<4)}, {17.2* 8, 12.8*0}, 4}, // LED 1 on right > Key 6
|
||||||
{{ 9|(0<<4)}, {17.2* 9, 12.8*0}, 0}, // LED 2 > Key 7
|
{{ 9|(0<<4)}, {17.2* 9, 12.8*0}, 4}, // LED 2 > Key 7
|
||||||
{{10|(0<<4)}, {17.2*10, 12.8*0}, 0}, // LED 3 > Key 8
|
{{10|(0<<4)}, {17.2*10, 12.8*0}, 4}, // LED 3 > Key 8
|
||||||
{{11|(0<<4)}, {17.2*11, 12.8*0}, 0}, // LED 4 > Key 9
|
{{11|(0<<4)}, {17.2*11, 12.8*0}, 4}, // LED 4 > Key 9
|
||||||
{{12|(0<<4)}, {17.2*12, 12.8*0}, 0}, // LED 5 > Key 0
|
{{12|(0<<4)}, {17.2*12, 12.8*0}, 4}, // LED 5 > Key 0
|
||||||
|
|
||||||
{{ 8|(1<<4)}, {17.2* 8, 12.8*1}, 0}, // LED 6
|
{{ 8|(1<<4)}, {17.2* 8, 12.8*1}, 4}, // LED 6
|
||||||
{{ 9|(1<<4)}, {17.2* 9, 12.8*1}, 0}, // LED 7
|
{{ 9|(1<<4)}, {17.2* 9, 12.8*1}, 4}, // LED 7
|
||||||
{{10|(1<<4)}, {17.2*10, 12.8*1}, 0}, // LED 8
|
{{10|(1<<4)}, {17.2*10, 12.8*1}, 4}, // LED 8
|
||||||
{{11|(1<<4)}, {17.2*11, 12.8*1}, 0}, // LED 9
|
{{11|(1<<4)}, {17.2*11, 12.8*1}, 4}, // LED 9
|
||||||
{{12|(1<<4)}, {17.2*12, 12.8*1}, 0}, // LED 10
|
{{12|(1<<4)}, {17.2*12, 12.8*1}, 4}, // LED 10
|
||||||
|
|
||||||
{{ 8|(2<<4)}, {17.2* 8, 12.8*2}, 0}, // LED 11
|
{{ 8|(2<<4)}, {17.2* 8, 12.8*2}, 4}, // LED 11
|
||||||
{{ 9|(2<<4)}, {17.2* 9, 12.8*2}, 0}, // LED 12
|
{{ 9|(2<<4)}, {17.2* 9, 12.8*2}, 4}, // LED 12
|
||||||
{{10|(2<<4)}, {17.2*10, 12.8*2}, 0}, // LED 13
|
{{10|(2<<4)}, {17.2*10, 12.8*2}, 4}, // LED 13
|
||||||
{{11|(2<<4)}, {17.2*11, 12.8*2}, 0}, // LED 14
|
{{11|(2<<4)}, {17.2*11, 12.8*2}, 4}, // LED 14
|
||||||
{{12|(2<<4)}, {17.2*12, 12.8*2}, 0}, // LED 15
|
{{12|(2<<4)}, {17.2*12, 12.8*2}, 4}, // LED 15
|
||||||
|
|
||||||
{{ 8|(3<<4)}, {17.2* 8, 12.8*3}, 0}, // LED 16
|
{{ 8|(3<<4)}, {17.2* 8, 12.8*3}, 4}, // LED 16
|
||||||
{{ 9|(3<<4)}, {17.2* 9, 12.8*3}, 0}, // LED 17
|
{{ 9|(3<<4)}, {17.2* 9, 12.8*3}, 4}, // LED 17
|
||||||
{{10|(3<<4)}, {17.2*10, 12.8*3}, 0}, // LED 18
|
{{10|(3<<4)}, {17.2*10, 12.8*3}, 4}, // LED 18
|
||||||
{{11|(3<<4)}, {17.2*11, 12.8*3}, 0}, // LED 19
|
{{11|(3<<4)}, {17.2*11, 12.8*3}, 4}, // LED 19
|
||||||
{{12|(3<<4)}, {17.2*12, 12.8*3}, 0}, // LED 20
|
{{12|(3<<4)}, {17.2*12, 12.8*3}, 4}, // LED 20
|
||||||
|
|
||||||
{{ 9|(4<<4)}, {17.2* 9, 12.8*4}, 1}, // LED 21
|
{{ 9|(4<<4)}, {17.2* 9, 12.8*4}, 1}, // LED 21
|
||||||
{{10|(4<<4)}, {17.2*10, 12.8*4}, 1}, // LED 22
|
{{10|(4<<4)}, {17.2*10, 12.8*4}, 1}, // LED 22
|
||||||
{{11|(4<<4)}, {17.2*11, 12.8*4}, 1}, // LED 23
|
{{11|(4<<4)}, {17.2*11, 12.8*4}, 1}, // LED 23
|
||||||
{{12|(4<<4)}, {17.2*12, 12.8*4}, 1}, // LED 24
|
{{12|(4<<4)}, {17.2*12, 12.8*4}, 1}, // LED 24
|
||||||
|
|
||||||
{{ 5|(0<<4)}, {17.2* 5, 12.8*0}, 0}, // LED 1 on left > Key 5
|
{{ 5|(0<<4)}, {17.2* 5, 12.8*0}, 4}, // LED 1 on left > Key 5
|
||||||
{{ 4|(0<<4)}, {17.2* 4, 12.8*0}, 0}, // LED 2 > Key 4
|
{{ 4|(0<<4)}, {17.2* 4, 12.8*0}, 4}, // LED 2 > Key 4
|
||||||
{{ 3|(0<<4)}, {17.2* 3, 12.8*0}, 0}, // LED 3 > Key 3
|
{{ 3|(0<<4)}, {17.2* 3, 12.8*0}, 4}, // LED 3 > Key 3
|
||||||
{{ 2|(0<<4)}, {17.2* 2, 12.8*0}, 0}, // LED 4 > Key 2
|
{{ 2|(0<<4)}, {17.2* 2, 12.8*0}, 4}, // LED 4 > Key 2
|
||||||
{{ 1|(0<<4)}, {17.2* 1, 12.8*0}, 0}, // LED 5 > Key 1
|
{{ 1|(0<<4)}, {17.2* 1, 12.8*0}, 4}, // LED 5 > Key 1
|
||||||
|
|
||||||
{{ 5|(1<<4)}, {17.2* 5, 12.8*1}, 0}, // LED 6
|
{{ 5|(1<<4)}, {17.2* 5, 12.8*1}, 4}, // LED 6
|
||||||
{{ 4|(1<<4)}, {17.2* 4, 12.8*1}, 0}, // LED 7
|
{{ 4|(1<<4)}, {17.2* 4, 12.8*1}, 4}, // LED 7
|
||||||
{{ 3|(1<<4)}, {17.2* 3, 12.8*1}, 0}, // LED 8
|
{{ 3|(1<<4)}, {17.2* 3, 12.8*1}, 4}, // LED 8
|
||||||
{{ 2|(1<<4)}, {17.2* 2, 12.8*1}, 0}, // LED 9
|
{{ 2|(1<<4)}, {17.2* 2, 12.8*1}, 4}, // LED 9
|
||||||
{{ 1|(1<<4)}, {17.2* 1, 12.8*1}, 0}, // LED 10
|
{{ 1|(1<<4)}, {17.2* 1, 12.8*1}, 4}, // LED 10
|
||||||
|
|
||||||
{{ 5|(2<<4)}, {17.2* 5, 12.8*2}, 0}, // LED 11
|
{{ 5|(2<<4)}, {17.2* 5, 12.8*2}, 4}, // LED 11
|
||||||
{{ 4|(2<<4)}, {17.2* 4, 12.8*2}, 0}, // LED 12
|
{{ 4|(2<<4)}, {17.2* 4, 12.8*2}, 4}, // LED 12
|
||||||
{{ 3|(2<<4)}, {17.2* 3, 12.8*2}, 0}, // LED 13
|
{{ 3|(2<<4)}, {17.2* 3, 12.8*2}, 4}, // LED 13
|
||||||
{{ 2|(2<<4)}, {17.2* 2, 12.8*2}, 0}, // LED 14
|
{{ 2|(2<<4)}, {17.2* 2, 12.8*2}, 4}, // LED 14
|
||||||
{{ 1|(2<<4)}, {17.2* 1, 12.8*2}, 0}, // LED 15
|
{{ 1|(2<<4)}, {17.2* 1, 12.8*2}, 4}, // LED 15
|
||||||
|
|
||||||
{{ 5|(3<<4)}, {17.2* 5, 12.8*3}, 0}, // LED 16
|
{{ 5|(3<<4)}, {17.2* 5, 12.8*3}, 4}, // LED 16
|
||||||
{{ 4|(3<<4)}, {17.2* 4, 12.8*3}, 0}, // LED 17
|
{{ 4|(3<<4)}, {17.2* 4, 12.8*3}, 4}, // LED 17
|
||||||
{{ 3|(3<<4)}, {17.2* 3, 12.8*3}, 0}, // LED 18
|
{{ 3|(3<<4)}, {17.2* 3, 12.8*3}, 4}, // LED 18
|
||||||
{{ 2|(3<<4)}, {17.2* 2, 12.8*3}, 0}, // LED 19
|
{{ 2|(3<<4)}, {17.2* 2, 12.8*3}, 4}, // LED 19
|
||||||
{{ 1|(3<<4)}, {17.2* 1, 12.8*3}, 0}, // LED 20
|
{{ 1|(3<<4)}, {17.2* 1, 12.8*3}, 4}, // LED 20
|
||||||
|
|
||||||
{{ 4|(4<<4)}, {17.2* 4, 12.8*4}, 1}, // LED 21
|
{{ 4|(4<<4)}, {17.2* 4, 12.8*4}, 1}, // LED 21
|
||||||
{{ 3|(4<<4)}, {17.2* 3, 12.8*4}, 1}, // LED 22
|
{{ 3|(4<<4)}, {17.2* 3, 12.8*4}, 1}, // LED 22
|
||||||
|
|||||||
@@ -79,49 +79,49 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
|
rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
|
||||||
|
|
||||||
/*{row | col << 4}
|
/*{row | col << 4}
|
||||||
| {x=0..224, y=0..64}
|
| {x=0..224, y=0..64}
|
||||||
| | modifier
|
| | flags
|
||||||
| | | */
|
| | | */
|
||||||
{{0|(0<<4)}, {20.36*0, 21.33*0}, 1},
|
{{0|(0<<4)}, {20.36*0, 21.33*0}, 1},
|
||||||
{{0|(1<<4)}, {20.36*1, 21.33*0}, 0},
|
{{0|(1<<4)}, {20.36*1, 21.33*0}, 4},
|
||||||
{{0|(2<<4)}, {20.36*2, 21.33*0}, 0},
|
{{0|(2<<4)}, {20.36*2, 21.33*0}, 4},
|
||||||
{{0|(3<<4)}, {20.36*3, 21.33*0}, 0},
|
{{0|(3<<4)}, {20.36*3, 21.33*0}, 4},
|
||||||
{{0|(4<<4)}, {20.36*4, 21.33*0}, 0},
|
{{0|(4<<4)}, {20.36*4, 21.33*0}, 4},
|
||||||
{{0|(5<<4)}, {20.36*5, 21.33*0}, 0},
|
{{0|(5<<4)}, {20.36*5, 21.33*0}, 4},
|
||||||
{{4|(0<<4)}, {20.36*6, 21.33*0}, 0},
|
{{4|(0<<4)}, {20.36*6, 21.33*0}, 4},
|
||||||
{{4|(1<<4)}, {20.36*7, 21.33*0}, 0},
|
{{4|(1<<4)}, {20.36*7, 21.33*0}, 4},
|
||||||
{{4|(2<<4)}, {20.36*8, 21.33*0}, 0},
|
{{4|(2<<4)}, {20.36*8, 21.33*0}, 4},
|
||||||
{{4|(3<<4)}, {20.36*9, 21.33*0}, 0},
|
{{4|(3<<4)}, {20.36*9, 21.33*0}, 4},
|
||||||
{{4|(4<<4)}, {20.36*10,21.33*0}, 0},
|
{{4|(4<<4)}, {20.36*10,21.33*0}, 4},
|
||||||
{{4|(5<<4)}, {20.36*11,21.33*0}, 1},
|
{{4|(5<<4)}, {20.36*11,21.33*0}, 1},
|
||||||
|
|
||||||
{{1|(0<<4)}, {20.36*0, 21.33*1}, 1},
|
{{1|(0<<4)}, {20.36*0, 21.33*1}, 1},
|
||||||
{{1|(1<<4)}, {20.36*1, 21.33*1}, 0},
|
{{1|(1<<4)}, {20.36*1, 21.33*1}, 4},
|
||||||
{{1|(2<<4)}, {20.36*2, 21.33*1}, 0},
|
{{1|(2<<4)}, {20.36*2, 21.33*1}, 4},
|
||||||
{{1|(3<<4)}, {20.36*3, 21.33*1}, 0},
|
{{1|(3<<4)}, {20.36*3, 21.33*1}, 4},
|
||||||
{{1|(4<<4)}, {20.36*4, 21.33*1}, 0},
|
{{1|(4<<4)}, {20.36*4, 21.33*1}, 4},
|
||||||
{{1|(5<<4)}, {20.36*5, 21.33*1}, 0},
|
{{1|(5<<4)}, {20.36*5, 21.33*1}, 4},
|
||||||
{{5|(0<<4)}, {20.36*6, 21.33*1}, 0},
|
{{5|(0<<4)}, {20.36*6, 21.33*1}, 4},
|
||||||
{{5|(1<<4)}, {20.36*7, 21.33*1}, 0},
|
{{5|(1<<4)}, {20.36*7, 21.33*1}, 4},
|
||||||
{{5|(2<<4)}, {20.36*8, 21.33*1}, 0},
|
{{5|(2<<4)}, {20.36*8, 21.33*1}, 4},
|
||||||
{{5|(3<<4)}, {20.36*9, 21.33*1}, 0},
|
{{5|(3<<4)}, {20.36*9, 21.33*1}, 4},
|
||||||
{{5|(4<<4)}, {20.36*10,21.33*1}, 0},
|
{{5|(4<<4)}, {20.36*10,21.33*1}, 4},
|
||||||
{{5|(5<<4)}, {20.36*11,21.33*1}, 1},
|
{{5|(5<<4)}, {20.36*11,21.33*1}, 1},
|
||||||
|
|
||||||
{{2|(0<<4)}, {20.36*0, 21.33*2}, 1},
|
{{2|(0<<4)}, {20.36*0, 21.33*2}, 1},
|
||||||
{{2|(1<<4)}, {20.36*1, 21.33*2}, 0},
|
{{2|(1<<4)}, {20.36*1, 21.33*2}, 4},
|
||||||
{{2|(2<<4)}, {20.36*2, 21.33*2}, 0},
|
{{2|(2<<4)}, {20.36*2, 21.33*2}, 4},
|
||||||
{{2|(3<<4)}, {20.36*3, 21.33*2}, 0},
|
{{2|(3<<4)}, {20.36*3, 21.33*2}, 4},
|
||||||
{{2|(4<<4)}, {20.36*4, 21.33*2}, 0},
|
{{2|(4<<4)}, {20.36*4, 21.33*2}, 4},
|
||||||
{{2|(5<<4)}, {20.36*5, 21.33*2}, 0},
|
{{2|(5<<4)}, {20.36*5, 21.33*2}, 4},
|
||||||
{{6|(0<<4)}, {20.36*6, 21.33*2}, 0},
|
{{6|(0<<4)}, {20.36*6, 21.33*2}, 4},
|
||||||
{{6|(1<<4)}, {20.36*7, 21.33*2}, 0},
|
{{6|(1<<4)}, {20.36*7, 21.33*2}, 4},
|
||||||
{{6|(2<<4)}, {20.36*8, 21.33*2}, 0},
|
{{6|(2<<4)}, {20.36*8, 21.33*2}, 4},
|
||||||
{{6|(3<<4)}, {20.36*9, 21.33*2}, 0},
|
{{6|(3<<4)}, {20.36*9, 21.33*2}, 4},
|
||||||
{{6|(4<<4)}, {20.36*10,21.33*2}, 0},
|
{{6|(4<<4)}, {20.36*10,21.33*2}, 4},
|
||||||
{{6|(5<<4)}, {20.36*11,21.33*2}, 1},
|
{{6|(5<<4)}, {20.36*11,21.33*2}, 1},
|
||||||
|
|
||||||
{{3|(0<<4)}, {20.36*0, 21.33*3}, 1},
|
{{3|(0<<4)}, {20.36*0, 21.33*3}, 1},
|
||||||
@@ -129,7 +129,7 @@ const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
|
|||||||
{{3|(2<<4)}, {20.36*2, 21.33*3}, 1},
|
{{3|(2<<4)}, {20.36*2, 21.33*3}, 1},
|
||||||
{{7|(3<<4)}, {20.36*3, 21.33*3}, 1},
|
{{7|(3<<4)}, {20.36*3, 21.33*3}, 1},
|
||||||
{{7|(4<<4)}, {20.36*4, 21.33*3}, 1},
|
{{7|(4<<4)}, {20.36*4, 21.33*3}, 1},
|
||||||
{{7|(5<<4)}, {20.36*5.5,21.33*3}, 0},
|
{{7|(5<<4)}, {20.36*5.5,21.33*3}, 4},
|
||||||
{{7|(0<<4)}, {20.36*7, 21.33*3}, 1},
|
{{7|(0<<4)}, {20.36*7, 21.33*3}, 1},
|
||||||
{{7|(1<<4)}, {20.36*8, 21.33*3}, 1},
|
{{7|(1<<4)}, {20.36*8, 21.33*3}, 1},
|
||||||
{{7|(2<<4)}, {20.36*9, 21.33*3}, 1},
|
{{7|(2<<4)}, {20.36*9, 21.33*3}, 1},
|
||||||
|
|||||||
@@ -167,28 +167,11 @@ void rgb_matrix_update_pwm_buffers(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) {
|
void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) {
|
||||||
#ifdef RGB_MATRIX_EXTRA_TOG
|
|
||||||
const bool is_key = g_rgb_leds[index].matrix_co.raw != 0xff;
|
|
||||||
if (
|
|
||||||
(rgb_matrix_config.enable == RGB_ZONE_KEYS && !is_key) ||
|
|
||||||
(rgb_matrix_config.enable == RGB_ZONE_UNDER && is_key)
|
|
||||||
) {
|
|
||||||
rgb_matrix_driver.set_color(index, 0, 0, 0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
rgb_matrix_driver.set_color(index, red, green, blue);
|
rgb_matrix_driver.set_color(index, red, green, blue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
|
void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
|
||||||
#ifdef RGB_MATRIX_EXTRA_TOG
|
|
||||||
for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
|
|
||||||
rgb_matrix_set_color(i, red, green, blue);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
rgb_matrix_driver.set_color_all(red, green, blue);
|
rgb_matrix_driver.set_color_all(red, green, blue);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
|
||||||
@@ -267,7 +250,7 @@ static bool rgb_matrix_none(effect_params_t* params) {
|
|||||||
|
|
||||||
static uint8_t rgb_last_enable = UINT8_MAX;
|
static uint8_t rgb_last_enable = UINT8_MAX;
|
||||||
static uint8_t rgb_last_effect = UINT8_MAX;
|
static uint8_t rgb_last_effect = UINT8_MAX;
|
||||||
static effect_params_t rgb_effect_params = { 0, 0 };
|
static effect_params_t rgb_effect_params = { 0, 0xFF };
|
||||||
static rgb_task_states rgb_task_state = SYNCING;
|
static rgb_task_states rgb_task_state = SYNCING;
|
||||||
|
|
||||||
static void rgb_task_timers(void) {
|
static void rgb_task_timers(void) {
|
||||||
@@ -580,33 +563,30 @@ void rgb_matrix_set_suspend_state(bool state) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void rgb_matrix_toggle(void) {
|
void rgb_matrix_toggle(void) {
|
||||||
#ifdef RGB_MATRIX_EXTRA_TOG
|
|
||||||
rgb_matrix_config.enable++;
|
|
||||||
#else
|
|
||||||
rgb_matrix_config.enable ^= 1;
|
rgb_matrix_config.enable ^= 1;
|
||||||
if (rgb_matrix_config.enable > 1) { rgb_matrix_config.enable = 0; } // make sure that if we are treating this as a bool, that it is only 1 or 0.
|
|
||||||
#endif
|
|
||||||
if (!rgb_matrix_config.enable) {
|
|
||||||
rgb_task_state = STARTING;
|
rgb_task_state = STARTING;
|
||||||
}
|
|
||||||
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_matrix_enable(void) {
|
void rgb_matrix_enable(void) {
|
||||||
rgb_matrix_config.enable = 1;
|
rgb_matrix_enable_noeeprom();
|
||||||
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_matrix_enable_noeeprom(void) {
|
void rgb_matrix_enable_noeeprom(void) {
|
||||||
|
if (!rgb_matrix_config.enable)
|
||||||
|
rgb_task_state = STARTING;
|
||||||
rgb_matrix_config.enable = 1;
|
rgb_matrix_config.enable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_matrix_disable(void) {
|
void rgb_matrix_disable(void) {
|
||||||
rgb_matrix_config.enable = 0;
|
rgb_matrix_disable_noeeprom();
|
||||||
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rgb_matrix_disable_noeeprom(void) {
|
void rgb_matrix_disable_noeeprom(void) {
|
||||||
|
if (rgb_matrix_config.enable)
|
||||||
|
rgb_task_state = STARTING;
|
||||||
rgb_matrix_config.enable = 0;
|
rgb_matrix_config.enable = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -668,6 +648,14 @@ void rgb_matrix_decrease_speed(void) {
|
|||||||
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this
|
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
led_flags_t rgb_matrix_get_flags(void) {
|
||||||
|
return rgb_effect_params.flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rgb_matrix_set_flags(led_flags_t flags) {
|
||||||
|
rgb_effect_params.flags = flags;
|
||||||
|
}
|
||||||
|
|
||||||
void rgb_matrix_mode(uint8_t mode) {
|
void rgb_matrix_mode(uint8_t mode) {
|
||||||
rgb_matrix_config.mode = mode;
|
rgb_matrix_config.mode = mode;
|
||||||
rgb_task_state = STARTING;
|
rgb_task_state = STARTING;
|
||||||
|
|||||||
@@ -54,7 +54,9 @@
|
|||||||
uint8_t max = DRIVER_LED_TOTAL;
|
uint8_t max = DRIVER_LED_TOTAL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
#define RGB_MATRIX_TEST_LED_FLAGS() if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) continue
|
||||||
|
|
||||||
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@@ -209,6 +211,8 @@ void rgb_matrix_increase_val(void);
|
|||||||
void rgb_matrix_decrease_val(void);
|
void rgb_matrix_decrease_val(void);
|
||||||
void rgb_matrix_increase_speed(void);
|
void rgb_matrix_increase_speed(void);
|
||||||
void rgb_matrix_decrease_speed(void);
|
void rgb_matrix_decrease_speed(void);
|
||||||
|
led_flags_t rgb_matrix_get_flags(void);
|
||||||
|
void rgb_matrix_set_flags(led_flags_t flags);
|
||||||
void rgb_matrix_mode(uint8_t mode);
|
void rgb_matrix_mode(uint8_t mode);
|
||||||
void rgb_matrix_mode_noeeprom(uint8_t mode);
|
void rgb_matrix_mode_noeeprom(uint8_t mode);
|
||||||
uint8_t rgb_matrix_get_mode(void);
|
uint8_t rgb_matrix_get_mode(void);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
|
#ifndef DISABLE_RGB_MATRIX_ALPHAS_MODS
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
// alphas = color1, mods = color2
|
// alphas = color1, mods = color2
|
||||||
@@ -14,7 +14,8 @@ bool rgb_matrix_alphas_mods(effect_params_t* params) {
|
|||||||
RGB rgb2 = hsv_to_rgb(hsv);
|
RGB rgb2 = hsv_to_rgb(hsv);
|
||||||
|
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
if (g_rgb_leds[i].modifier) {
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
|
if (HAS_FLAGS(g_rgb_leds[i].flags, LED_FLAG_MODIFIER)) {
|
||||||
rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b);
|
rgb_matrix_set_color(i, rgb2.r, rgb2.g, rgb2.b);
|
||||||
} else {
|
} else {
|
||||||
rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b);
|
rgb_matrix_set_color(i, rgb1.r, rgb1.g, rgb1.b);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ bool rgb_matrix_breathing(effect_params_t* params) {
|
|||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, val };
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, val };
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
|
|||||||
@@ -2,16 +2,16 @@
|
|||||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_ALL
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
bool rgb_matrix_cycle_all(effect_params_t* params) {
|
bool rgb_matrix_cycle_all(effect_params_t* params) {
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||||
|
|
||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
hsv.h = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
hsv.h = time;
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
bool rgb_matrix_cycle_left_right(effect_params_t* params) {
|
bool rgb_matrix_cycle_left_right(effect_params_t* params) {
|
||||||
@@ -11,6 +11,7 @@ bool rgb_matrix_cycle_left_right(effect_params_t* params) {
|
|||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
hsv.h = point.x - time;
|
hsv.h = point.x - time;
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
#ifndef DISABLE_RGB_MATRIX_CYCLE_UP_DOWN
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
bool rgb_matrix_cycle_up_down(effect_params_t* params) {
|
bool rgb_matrix_cycle_up_down(effect_params_t* params) {
|
||||||
@@ -11,6 +11,7 @@ bool rgb_matrix_cycle_up_down(effect_params_t* params) {
|
|||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
hsv.h = point.y - time;
|
hsv.h = point.y - time;
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
|
#ifndef DISABLE_RGB_MATRIX_DUAL_BEACON
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
bool rgb_matrix_dual_beacon(effect_params_t* params) {
|
bool rgb_matrix_dual_beacon(effect_params_t* params) {
|
||||||
@@ -13,6 +13,7 @@ bool rgb_matrix_dual_beacon(effect_params_t* params) {
|
|||||||
int8_t cos_value = cos8(time) - 128;
|
int8_t cos_value = cos8(time) - 128;
|
||||||
int8_t sin_value = sin8(time) - 128;
|
int8_t sin_value = sin8(time) - 128;
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
|
hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
#ifndef DISABLE_RGB_MATRIX_GRADIENT_UP_DOWN
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
bool rgb_matrix_gradient_up_down(effect_params_t* params) {
|
bool rgb_matrix_gradient_up_down(effect_params_t* params) {
|
||||||
@@ -10,6 +10,7 @@ bool rgb_matrix_gradient_up_down(effect_params_t* params) {
|
|||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
uint8_t scale = scale8(64, rgb_matrix_config.speed);
|
uint8_t scale = scale8(64, rgb_matrix_config.speed);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
// The y range will be 0..64, map this to 0..4
|
// The y range will be 0..64, map this to 0..4
|
||||||
// Relies on hue being 8-bit and wrapping
|
// Relies on hue being 8-bit and wrapping
|
||||||
|
|||||||
@@ -2,10 +2,11 @@
|
|||||||
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
#ifndef DISABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
static void jellybean_raindrops_set_color(int i) {
|
static void jellybean_raindrops_set_color(int i, effect_params_t* params) {
|
||||||
|
if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) return;
|
||||||
HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val };
|
HSV hsv = { rand() & 0xFF , rand() & 0xFF, rgb_matrix_config.val };
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
@@ -15,14 +16,14 @@ bool rgb_matrix_jellybean_raindrops(effect_params_t* params) {
|
|||||||
if (!params->init) {
|
if (!params->init) {
|
||||||
// Change one LED every tick, make sure speed is not 0
|
// Change one LED every tick, make sure speed is not 0
|
||||||
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
|
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
|
||||||
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL);
|
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||||
for (int i = led_min; i < led_max; i++) {
|
for (int i = led_min; i < led_max; i++) {
|
||||||
jellybean_raindrops_set_color(i);
|
jellybean_raindrops_set_color(i, params);
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
#ifndef DISABLE_RGB_MATRIX_RAINBOW_BEACON
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
|
bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
|
||||||
@@ -13,6 +13,7 @@ bool rgb_matrix_rainbow_beacon(effect_params_t* params) {
|
|||||||
int16_t cos_value = 2 * (cos8(time) - 128);
|
int16_t cos_value = 2 * (cos8(time) - 128);
|
||||||
int16_t sin_value = 2 * (sin8(time) - 128);
|
int16_t sin_value = 2 * (sin8(time) - 128);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
|
hsv.h = ((point.y - 32) * cos_value + (point.x - 112) * sin_value) / 128 + rgb_matrix_config.hue;
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
#ifndef DISABLE_RGB_MATRIX_RAINBOW_MOVING_CHEVRON
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
|
bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
|
||||||
@@ -11,6 +11,7 @@ bool rgb_matrix_rainbow_moving_chevron(effect_params_t* params) {
|
|||||||
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { 0, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
uint8_t time = scale16by8(g_rgb_counters.tick, rgb_matrix_config.speed / 4);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
hsv.h = abs8(point.y - 32) + (point.x - time) + rgb_matrix_config.hue;
|
hsv.h = abs8(point.y - 32) + (point.x - time) + rgb_matrix_config.hue;
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
#ifndef DISABLE_RGB_MATRIX_RAINBOW_PINWHEELS
|
||||||
|
|
||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
|
bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
|
||||||
@@ -13,6 +13,7 @@ bool rgb_matrix_rainbow_pinwheels(effect_params_t* params) {
|
|||||||
int16_t cos_value = 3 * (cos8(time) - 128);
|
int16_t cos_value = 3 * (cos8(time) - 128);
|
||||||
int16_t sin_value = 3 * (sin8(time) - 128);
|
int16_t sin_value = 3 * (sin8(time) - 128);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
hsv.h = ((point.y - 32) * cos_value + (56 - abs8(point.x - 112)) * sin_value) / 128 + rgb_matrix_config.hue;
|
hsv.h = ((point.y - 32) * cos_value + (56 - abs8(point.x - 112)) * sin_value) / 128 + rgb_matrix_config.hue;
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
|
|||||||
@@ -5,7 +5,8 @@
|
|||||||
extern rgb_counters_t g_rgb_counters;
|
extern rgb_counters_t g_rgb_counters;
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
|
|
||||||
static void raindrops_set_color(int i) {
|
static void raindrops_set_color(int i, effect_params_t* params) {
|
||||||
|
if (!HAS_ANY_FLAGS(g_rgb_leds[i].flags, params->flags)) return;
|
||||||
HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { 0 , rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
|
|
||||||
// Take the shortest path between hues
|
// Take the shortest path between hues
|
||||||
@@ -25,14 +26,14 @@ bool rgb_matrix_raindrops(effect_params_t* params) {
|
|||||||
if (!params->init) {
|
if (!params->init) {
|
||||||
// Change one LED every tick, make sure speed is not 0
|
// Change one LED every tick, make sure speed is not 0
|
||||||
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
|
if (scale16by8(g_rgb_counters.tick, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
|
||||||
raindrops_set_color(rand() % DRIVER_LED_TOTAL);
|
raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
RGB_MATRIX_USE_LIMITS(led_min, led_max);
|
||||||
for (int i = led_min; i < led_max; i++) {
|
for (int i = led_min; i < led_max; i++) {
|
||||||
raindrops_set_color(i);
|
raindrops_set_color(i, params);
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ bool rgb_matrix_solid_color(effect_params_t* params) {
|
|||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, rgb_matrix_config.val };
|
||||||
RGB rgb = hsv_to_rgb(hsv);
|
RGB rgb = hsv_to_rgb(hsv);
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
rgb_matrix_set_color(i, rgb.r, rgb.g, rgb.b);
|
||||||
}
|
}
|
||||||
return led_max < DRIVER_LED_TOTAL;
|
return led_max < DRIVER_LED_TOTAL;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ bool rgb_matrix_solid_reactive(effect_params_t* params) {
|
|||||||
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
||||||
// Relies on hue being 8-bit and wrapping
|
// Relies on hue being 8-bit and wrapping
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
uint16_t tick = max_tick;
|
uint16_t tick = max_tick;
|
||||||
// Reverse search to find most recent key hit
|
// Reverse search to find most recent key hit
|
||||||
for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
|
for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_CROSS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTICROSS)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
extern last_hit_t g_last_hit_tracker;
|
extern last_hit_t g_last_hit_tracker;
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ static bool rgb_matrix_solid_reactive_multicross_range(uint8_t start, effect_par
|
|||||||
hsv.v = 0;
|
hsv.v = 0;
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
for (uint8_t j = start; j < count; j++) {
|
for (uint8_t j = start; j < count; j++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
||||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
||||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_NEXUS) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTINEXUS)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
extern last_hit_t g_last_hit_tracker;
|
extern last_hit_t g_last_hit_tracker;
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ static bool rgb_matrix_solid_reactive_multinexus_range(uint8_t start, effect_par
|
|||||||
hsv.v = 0;
|
hsv.v = 0;
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
for (uint8_t j = start; j < count; j++) {
|
for (uint8_t j = start; j < count; j++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
||||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
||||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ bool rgb_matrix_solid_reactive_simple(effect_params_t* params) {
|
|||||||
// Max tick based on speed scale ensures results from scale16by8 with rgb_matrix_config.speed are no greater than 255
|
// Max tick based on speed scale ensures results from scale16by8 with rgb_matrix_config.speed are no greater than 255
|
||||||
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
uint16_t max_tick = 65535 / rgb_matrix_config.speed;
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
uint16_t tick = max_tick;
|
uint16_t tick = max_tick;
|
||||||
// Reverse search to find most recent key hit
|
// Reverse search to find most recent key hit
|
||||||
for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
|
for (int8_t j = g_last_hit_tracker.count - 1; j >= 0; j--) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_WIDE) || !defined(DISABLE_RGB_MATRIX_SOLID_REACTIVE_MULTIWIDE)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
extern last_hit_t g_last_hit_tracker;
|
extern last_hit_t g_last_hit_tracker;
|
||||||
|
|
||||||
@@ -15,6 +15,7 @@ static bool rgb_matrix_solid_reactive_multiwide_range(uint8_t start, effect_para
|
|||||||
hsv.v = 0;
|
hsv.v = 0;
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
for (uint8_t j = start; j < count; j++) {
|
for (uint8_t j = start; j < count; j++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
int16_t dx = point.x - g_last_hit_tracker.x[j];
|
||||||
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
int16_t dy = point.y - g_last_hit_tracker.y[j];
|
||||||
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
uint8_t dist = sqrt16(dx * dx + dy * dy);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
|
#if !defined(DISABLE_RGB_MATRIX_SOLID_SPLASH) || !defined(DISABLE_RGB_MATRIX_SOLID_MULTISPLASH)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
extern last_hit_t g_last_hit_tracker;
|
extern last_hit_t g_last_hit_tracker;
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ static bool rgb_matrix_solid_multisplash_range(uint8_t start, effect_params_t* p
|
|||||||
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
HSV hsv = { rgb_matrix_config.hue, rgb_matrix_config.sat, 0 };
|
||||||
uint8_t count = g_last_hit_tracker.count;
|
uint8_t count = g_last_hit_tracker.count;
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
hsv.v = 0;
|
hsv.v = 0;
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
for (uint8_t j = start; j < count; j++) {
|
for (uint8_t j = start; j < count; j++) {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
#ifdef RGB_MATRIX_KEYREACTIVE_ENABLED
|
||||||
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
#if !defined(DISABLE_RGB_MATRIX_SPLASH) || !defined(DISABLE_RGB_MATRIX_MULTISPLASH)
|
||||||
|
|
||||||
extern const rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
extern rgb_led g_rgb_leds[DRIVER_LED_TOTAL];
|
||||||
extern rgb_config_t rgb_matrix_config;
|
extern rgb_config_t rgb_matrix_config;
|
||||||
extern last_hit_t g_last_hit_tracker;
|
extern last_hit_t g_last_hit_tracker;
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ static bool rgb_matrix_multisplash_range(uint8_t start, effect_params_t* params)
|
|||||||
HSV hsv = { 0, rgb_matrix_config.sat, 0 };
|
HSV hsv = { 0, rgb_matrix_config.sat, 0 };
|
||||||
uint8_t count = g_last_hit_tracker.count;
|
uint8_t count = g_last_hit_tracker.count;
|
||||||
for (uint8_t i = led_min; i < led_max; i++) {
|
for (uint8_t i = led_min; i < led_max; i++) {
|
||||||
|
RGB_MATRIX_TEST_LED_FLAGS();
|
||||||
hsv.h = rgb_matrix_config.hue;
|
hsv.h = rgb_matrix_config.hue;
|
||||||
hsv.v = 0;
|
hsv.v = 0;
|
||||||
point_t point = g_rgb_leds[i].point;
|
point_t point = g_rgb_leds[i].point;
|
||||||
|
|||||||
@@ -67,19 +67,21 @@ typedef union {
|
|||||||
};
|
};
|
||||||
} matrix_co_t;
|
} matrix_co_t;
|
||||||
|
|
||||||
|
#define HAS_FLAGS(bits, flags) ((bits & flags) == flags)
|
||||||
|
#define HAS_ANY_FLAGS(bits, flags) ((bits & flags) != 0x00)
|
||||||
|
|
||||||
|
#define LED_FLAG_ALL 0xFF
|
||||||
|
#define LED_FLAG_NONE 0x00
|
||||||
|
#define LED_FLAG_MODIFIER 0x01
|
||||||
|
#define LED_FLAG_UNDERGLOW 0x02
|
||||||
|
#define LED_FLAG_KEYLIGHT 0x04
|
||||||
|
|
||||||
typedef struct PACKED {
|
typedef struct PACKED {
|
||||||
matrix_co_t matrix_co;
|
matrix_co_t matrix_co;
|
||||||
point_t point;
|
point_t point;
|
||||||
uint8_t modifier:1;
|
uint8_t flags;
|
||||||
} rgb_led;
|
} rgb_led;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
RGB_ZONE_OFF = 0,
|
|
||||||
RGB_ZONE_ALL,
|
|
||||||
RGB_ZONE_KEYS,
|
|
||||||
RGB_ZONE_UNDER,
|
|
||||||
} rgb_zone_t;
|
|
||||||
|
|
||||||
typedef union {
|
typedef union {
|
||||||
uint32_t raw;
|
uint32_t raw;
|
||||||
struct PACKED {
|
struct PACKED {
|
||||||
|
|||||||
@@ -443,9 +443,9 @@ static void led_matrix_massdrop_config_override(int i)
|
|||||||
|
|
||||||
uint8_t highest_active_layer = biton32(layer_state);
|
uint8_t highest_active_layer = biton32(layer_state);
|
||||||
|
|
||||||
if (led_lighting_mode == LED_MODE_KEYS_ONLY && g_rgb_leds[i].matrix_co.raw == 0xff) {
|
if (led_lighting_mode == LED_MODE_KEYS_ONLY && HAS_FLAGS(g_rgb_leds[i].flags, LED_FLAG_UNDERGLOW)) {
|
||||||
//Do not act on this LED
|
//Do not act on this LED
|
||||||
} else if (led_lighting_mode == LED_MODE_NON_KEYS_ONLY && g_rgb_leds[i].matrix_co.raw != 0xff) {
|
} else if (led_lighting_mode == LED_MODE_NON_KEYS_ONLY && !HAS_FLAGS(g_rgb_leds[i].flags, LED_FLAG_UNDERGLOW)) {
|
||||||
//Do not act on this LED
|
//Do not act on this LED
|
||||||
} else if (led_lighting_mode == LED_MODE_INDICATORS_ONLY) {
|
} else if (led_lighting_mode == LED_MODE_INDICATORS_ONLY) {
|
||||||
//Do not act on this LED (Only show indicators)
|
//Do not act on this LED (Only show indicators)
|
||||||
|
|||||||
Reference in New Issue
Block a user