forked from mirrors/qmk_userspace
RGB/LED matrix use limits size optimisation (#22325)
This commit is contained in:
parent
896d3dc497
commit
f293658147
4 changed files with 89 additions and 66 deletions
|
@ -107,35 +107,19 @@
|
|||
# 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 < RGB_MATRIX_LED_COUNT
|
||||
# if defined(RGB_MATRIX_SPLIT)
|
||||
# define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \
|
||||
uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * (iter); \
|
||||
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
|
||||
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];
|
||||
# else
|
||||
# define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \
|
||||
uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * (iter); \
|
||||
uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
|
||||
if (max > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT;
|
||||
# endif
|
||||
#else
|
||||
# if defined(RGB_MATRIX_SPLIT)
|
||||
# define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \
|
||||
uint8_t min = 0; \
|
||||
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_ITER(min, max, iter) \
|
||||
uint8_t min = 0; \
|
||||
uint8_t max = RGB_MATRIX_LED_COUNT;
|
||||
# endif
|
||||
#endif
|
||||
struct rgb_matrix_limits_t {
|
||||
uint8_t led_min_index;
|
||||
uint8_t led_max_index;
|
||||
};
|
||||
|
||||
struct rgb_matrix_limits_t rgb_matrix_get_limits(uint8_t iter);
|
||||
|
||||
#define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \
|
||||
struct rgb_matrix_limits_t limits = rgb_matrix_get_limits(iter); \
|
||||
uint8_t min = limits.led_min_index; \
|
||||
uint8_t max = limits.led_max_index; \
|
||||
(void)min; \
|
||||
(void)max;
|
||||
|
||||
#define RGB_MATRIX_USE_LIMITS(min, max) RGB_MATRIX_USE_LIMITS_ITER(min, max, params->iter)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue