1
0
Fork 0

Change DRIVER_LED_COUNT to {LED,RGB}_MATRIX_LED_COUNT (#18399)

This commit is contained in:
Ryan 2022-09-23 22:46:23 +10:00 committed by GitHub
parent d967de0df7
commit 36c410592d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
577 changed files with 836 additions and 831 deletions

View file

@ -13,7 +13,7 @@ bool JELLYBEAN_RAINDROPS(effect_params_t* params) {
if (!params->init) {
// Change one LED every tick, make sure speed is not 0
if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 5 == 0) {
jellybean_raindrops_set_color(rand() % DRIVER_LED_TOTAL, params);
jellybean_raindrops_set_color(rand() % RGB_MATRIX_LED_COUNT, params);
}
return false;
}

View file

@ -7,7 +7,7 @@ RGB_MATRIX_EFFECT(PIXEL_FLOW)
static bool PIXEL_FLOW(effect_params_t* params) {
// LED state array
static RGB led[DRIVER_LED_TOTAL];
static RGB led[RGB_MATRIX_LED_COUNT];
static uint32_t wait_timer = 0;
if (wait_timer > g_rgb_timer) {
@ -21,7 +21,7 @@ static bool PIXEL_FLOW(effect_params_t* params) {
if (params->init) {
// Clear LEDs and fill the state array
rgb_matrix_set_color_all(0, 0, 0);
for (uint8_t j = 0; j < DRIVER_LED_TOTAL; ++j) {
for (uint8_t j = 0; j < RGB_MATRIX_LED_COUNT; ++j) {
led[j] = (random8() & 2) ? (RGB){0, 0, 0} : hsv_to_rgb((HSV){random8(), qadd8(random8() >> 1, 127), rgb_matrix_config.hsv.v});
}
}

View file

@ -41,7 +41,7 @@ static bool PIXEL_RAIN(effect_params_t* params) {
RGB_MATRIX_USE_LIMITS(led_min, led_max);
if (g_rgb_timer > wait_timer) {
rain_pixel(mod8(random8(), DRIVER_LED_TOTAL), params, random8() & 2);
rain_pixel(mod8(random8(), RGB_MATRIX_LED_COUNT), params, random8() & 2);
}
return rgb_matrix_check_finished_leds(led_max);
}

View file

@ -24,7 +24,7 @@ bool RAINDROPS(effect_params_t* params) {
if (!params->init) {
// Change one LED every tick, make sure speed is not 0
if (scale16by8(g_rgb_timer, qadd8(rgb_matrix_config.speed, 16)) % 10 == 0) {
raindrops_set_color(random8() % DRIVER_LED_TOTAL, params);
raindrops_set_color(random8() % RGB_MATRIX_LED_COUNT, params);
}
} else {
for (int i = led_min; i < led_max; i++) {

View file

@ -202,7 +202,7 @@ void rgb_matrix_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
void rgb_matrix_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
#if defined(RGB_MATRIX_ENABLE) && defined(RGB_MATRIX_SPLIT)
for (uint8_t i = 0; i < DRIVER_LED_TOTAL; i++)
for (uint8_t i = 0; i < RGB_MATRIX_LED_COUNT; i++)
rgb_matrix_set_color(i, red, green, blue);
#else
rgb_matrix_driver.set_color_all(red, green, blue);
@ -461,13 +461,13 @@ void rgb_matrix_indicators_advanced(effect_params_t *params) {
* and not sure which would be better. Otherwise, this should be called from
* rgb_task_render, right before the iter++ line.
*/
#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < RGB_MATRIX_LED_COUNT
uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * (params->iter - 1);
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT;
if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL;
if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT;
#else
uint8_t min = 0;
uint8_t max = DRIVER_LED_TOTAL;
uint8_t max = RGB_MATRIX_LED_COUNT;
#endif
rgb_matrix_indicators_advanced_kb(min, max);
rgb_matrix_indicators_advanced_user(min, max);

View file

@ -47,15 +47,15 @@
#endif
#ifndef RGB_MATRIX_LED_PROCESS_LIMIT
# define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5
# define RGB_MATRIX_LED_PROCESS_LIMIT (RGB_MATRIX_LED_COUNT + 4) / 5
#endif
#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < DRIVER_LED_TOTAL
#if defined(RGB_MATRIX_LED_PROCESS_LIMIT) && RGB_MATRIX_LED_PROCESS_LIMIT > 0 && RGB_MATRIX_LED_PROCESS_LIMIT < RGB_MATRIX_LED_COUNT
# if defined(RGB_MATRIX_SPLIT)
# define RGB_MATRIX_USE_LIMITS(min, max) \
uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL; \
if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT; \
uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \
if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \
if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0];
@ -63,20 +63,20 @@
# define RGB_MATRIX_USE_LIMITS(min, max) \
uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
if (max > DRIVER_LED_TOTAL) max = DRIVER_LED_TOTAL;
if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT;
# endif
#else
# if defined(RGB_MATRIX_SPLIT)
# define RGB_MATRIX_USE_LIMITS(min, max) \
uint8_t min = 0; \
uint8_t max = DRIVER_LED_TOTAL; \
uint8_t max = RGB_MATRIX_LED_COUNT; \
const uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT; \
if (is_keyboard_left() && (max > k_rgb_matrix_split[0])) max = k_rgb_matrix_split[0]; \
if (!(is_keyboard_left()) && (min < k_rgb_matrix_split[0])) min = k_rgb_matrix_split[0];
# else
# define RGB_MATRIX_USE_LIMITS(min, max) \
uint8_t min = 0; \
uint8_t max = DRIVER_LED_TOTAL;
uint8_t max = RGB_MATRIX_LED_COUNT;
# endif
#endif
@ -246,9 +246,9 @@ static inline bool rgb_matrix_check_finished_leds(uint8_t led_idx) {
uint8_t k_rgb_matrix_split[2] = RGB_MATRIX_SPLIT;
return led_idx < k_rgb_matrix_split[0];
} else
return led_idx < DRIVER_LED_TOTAL;
return led_idx < RGB_MATRIX_LED_COUNT;
#else
return led_idx < DRIVER_LED_TOTAL;
return led_idx < RGB_MATRIX_LED_COUNT;
#endif
}

View file

@ -106,7 +106,7 @@ static void init(void) {
# endif
# endif
for (int index = 0; index < DRIVER_LED_TOTAL; index++) {
for (int index = 0; index < RGB_MATRIX_LED_COUNT; index++) {
bool enabled = true;
// This only caches it for later
@ -336,13 +336,13 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
# endif
// LED color buffer
LED_TYPE rgb_matrix_ws2812_array[DRIVER_LED_TOTAL];
LED_TYPE rgb_matrix_ws2812_array[RGB_MATRIX_LED_COUNT];
static void init(void) {}
static void flush(void) {
// Assumes use of RGB_DI_PIN
ws2812_setleds(rgb_matrix_ws2812_array, DRIVER_LED_TOTAL);
ws2812_setleds(rgb_matrix_ws2812_array, RGB_MATRIX_LED_COUNT);
}
// Set an led in the buffer to a color

View file

@ -78,8 +78,8 @@ typedef struct PACKED {
typedef struct PACKED {
uint8_t matrix_co[MATRIX_ROWS][MATRIX_COLS];
led_point_t point[DRIVER_LED_TOTAL];
uint8_t flags[DRIVER_LED_TOTAL];
led_point_t point[RGB_MATRIX_LED_COUNT];
uint8_t flags[RGB_MATRIX_LED_COUNT];
} led_config_t;
typedef union {