summaryrefslogtreecommitdiffstats
path: root/quantum/rgb_matrix
diff options
context:
space:
mode:
Diffstat (limited to 'quantum/rgb_matrix')
-rw-r--r--quantum/rgb_matrix/animations/typing_heatmap_anim.h7
-rw-r--r--quantum/rgb_matrix/rgb_matrix.c9
-rw-r--r--quantum/rgb_matrix/rgb_matrix.h20
-rw-r--r--quantum/rgb_matrix/rgb_matrix_drivers.c50
-rw-r--r--quantum/rgb_matrix/rgb_matrix_types.h6
5 files changed, 70 insertions, 22 deletions
diff --git a/quantum/rgb_matrix/animations/typing_heatmap_anim.h b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
index 00d137f1a6..d09bdc4631 100644
--- a/quantum/rgb_matrix/animations/typing_heatmap_anim.h
+++ b/quantum/rgb_matrix/animations/typing_heatmap_anim.h
@@ -1,6 +1,9 @@
#if defined(RGB_MATRIX_FRAMEBUFFER_EFFECTS) && defined(ENABLE_RGB_MATRIX_TYPING_HEATMAP)
RGB_MATRIX_EFFECT(TYPING_HEATMAP)
# ifdef RGB_MATRIX_CUSTOM_EFFECT_IMPLS
+# ifndef RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP
+# define RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP 32
+# endif
# ifndef RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS
# define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 25
@@ -16,7 +19,7 @@ RGB_MATRIX_EFFECT(TYPING_HEATMAP)
void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
# ifdef RGB_MATRIX_TYPING_HEATMAP_SLIM
// Limit effect to pressed keys
- g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32);
+ g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP);
# else
if (g_led_config.matrix_co[row][col] == NO_LED) { // skip as pressed key doesn't have an led position
return;
@@ -27,7 +30,7 @@ void process_rgb_matrix_typing_heatmap(uint8_t row, uint8_t col) {
continue;
}
if (i_row == row && i_col == col) {
- g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], 32);
+ g_rgb_frame_buffer[row][col] = qadd8(g_rgb_frame_buffer[row][col], RGB_MATRIX_TYPING_HEATMAP_INCREASE_STEP);
} else {
# define LED_DISTANCE(led_a, led_b) sqrt16(((int16_t)(led_a.x - led_b.x) * (int16_t)(led_a.x - led_b.x)) + ((int16_t)(led_a.y - led_b.y) * (int16_t)(led_a.y - led_b.y)))
uint8_t distance = LED_DISTANCE(g_led_config.point[g_led_config.matrix_co[row][col]], g_led_config.point[g_led_config.matrix_co[i_row][i_col]]);
diff --git a/quantum/rgb_matrix/rgb_matrix.c b/quantum/rgb_matrix/rgb_matrix.c
index bbb706da69..1f3912cf7e 100644
--- a/quantum/rgb_matrix/rgb_matrix.c
+++ b/quantum/rgb_matrix/rgb_matrix.c
@@ -459,14 +459,7 @@ 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 < 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 > RGB_MATRIX_LED_COUNT) max = RGB_MATRIX_LED_COUNT;
-#else
- uint8_t min = 0;
- uint8_t max = RGB_MATRIX_LED_COUNT;
-#endif
+ RGB_MATRIX_USE_LIMITS_ITER(min, max, params->iter - 1);
rgb_matrix_indicators_advanced_kb(min, max);
}
diff --git a/quantum/rgb_matrix/rgb_matrix.h b/quantum/rgb_matrix/rgb_matrix.h
index 62078f6e60..9ea248b66d 100644
--- a/quantum/rgb_matrix/rgb_matrix.h
+++ b/quantum/rgb_matrix/rgb_matrix.h
@@ -28,6 +28,8 @@
# include "is31fl3731.h"
#elif defined(IS31FL3733)
# include "is31fl3733.h"
+#elif defined(IS31FL3736)
+# include "is31fl3736.h"
#elif defined(IS31FL3737)
# include "is31fl3737.h"
#elif defined(IS31FL3741)
@@ -52,34 +54,36 @@
#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; \
+# 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(min, max) \
- uint8_t min = RGB_MATRIX_LED_PROCESS_LIMIT * params->iter; \
- uint8_t max = min + RGB_MATRIX_LED_PROCESS_LIMIT; \
+# 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(min, max) \
+# 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(min, max) \
- uint8_t min = 0; \
+# define RGB_MATRIX_USE_LIMITS_ITER(min, max, iter) \
+ uint8_t min = 0; \
uint8_t max = RGB_MATRIX_LED_COUNT;
# endif
#endif
+#define RGB_MATRIX_USE_LIMITS(min, max) RGB_MATRIX_USE_LIMITS_ITER(min, max, params->iter)
+
#define RGB_MATRIX_INDICATOR_SET_COLOR(i, r, g, b) \
if (i >= led_min && i < led_max) { \
rgb_matrix_set_color(i, r, g, b); \
diff --git a/quantum/rgb_matrix/rgb_matrix_drivers.c b/quantum/rgb_matrix/rgb_matrix_drivers.c
index 5b81915845..d65121baf4 100644
--- a/quantum/rgb_matrix/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix/rgb_matrix_drivers.c
@@ -23,7 +23,7 @@
* be here if shared between boards.
*/
-#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3737) || defined(IS31FL3741) || defined(IS31FLCOMMON) || defined(CKLED2001)
+#if defined(IS31FL3731) || defined(IS31FL3733) || defined(IS31FL3736) || defined(IS31FL3737) || defined(IS31FL3741) || defined(IS31FLCOMMON) || defined(CKLED2001)
# include "i2c_master.h"
// TODO: Remove this at some later date
@@ -72,6 +72,18 @@ static void init(void) {
# endif
# endif
+# elif defined(IS31FL3736)
+ IS31FL3736_init(DRIVER_ADDR_1);
+# if defined(DRIVER_ADDR_2)
+ IS31FL3736_init(DRIVER_ADDR_2);
+# if defined(DRIVER_ADDR_3)
+ IS31FL3736_init(DRIVER_ADDR_3);
+# if defined(DRIVER_ADDR_4)
+ IS31FL3736_init(DRIVER_ADDR_4);
+# endif
+# endif
+# endif
+
# elif defined(IS31FL3737)
IS31FL3737_init(DRIVER_ADDR_1);
# if defined(DRIVER_ADDR_2)
@@ -120,6 +132,8 @@ static void init(void) {
IS31FL3731_set_led_control_register(index, enabled, enabled, enabled);
# elif defined(IS31FL3733)
IS31FL3733_set_led_control_register(index, enabled, enabled, enabled);
+# elif defined(IS31FL3736)
+ IS31FL3736_set_led_control_register(index, enabled, enabled, enabled);
# elif defined(IS31FL3737)
IS31FL3737_set_led_control_register(index, enabled, enabled, enabled);
# elif defined(IS31FL3741)
@@ -156,6 +170,18 @@ static void init(void) {
# endif
# endif
+# elif defined(IS31FL3736)
+ IS31FL3736_update_led_control_registers(DRIVER_ADDR_1, 0);
+# if defined(DRIVER_ADDR_2)
+ IS31FL3736_update_led_control_registers(DRIVER_ADDR_2, 1);
+# if defined(DRIVER_ADDR_3)
+ IS31FL3736_update_led_control_registers(DRIVER_ADDR_3, 2);
+# if defined(DRIVER_ADDR_4)
+ IS31FL3736_update_led_control_registers(DRIVER_ADDR_4, 3);
+# endif
+# endif
+# endif
+
# elif defined(IS31FL3737)
IS31FL3737_update_led_control_registers(DRIVER_ADDR_1, 0);
# if defined(DRIVER_ADDR_2)
@@ -242,6 +268,27 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
.set_color_all = IS31FL3733_set_color_all,
};
+# elif defined(IS31FL3736)
+static void flush(void) {
+ IS31FL3736_update_pwm_buffers(DRIVER_ADDR_1, 0);
+# if defined(DRIVER_ADDR_2)
+ IS31FL3736_update_pwm_buffers(DRIVER_ADDR_2, 1);
+# if defined(DRIVER_ADDR_3)
+ IS31FL3736_update_pwm_buffers(DRIVER_ADDR_3, 2);
+# if defined(DRIVER_ADDR_4)
+ IS31FL3736_update_pwm_buffers(DRIVER_ADDR_4, 3);
+# endif
+# endif
+# endif
+}
+
+const rgb_matrix_driver_t rgb_matrix_driver = {
+ .init = init,
+ .flush = flush,
+ .set_color = IS31FL3736_set_color,
+ .set_color_all = IS31FL3736_set_color_all,
+};
+
# elif defined(IS31FL3737)
static void flush(void) {
IS31FL3737_update_pwm_buffers(DRIVER_ADDR_1, 0);
@@ -359,7 +406,6 @@ 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, RGB_MATRIX_LED_COUNT);
}
diff --git a/quantum/rgb_matrix/rgb_matrix_types.h b/quantum/rgb_matrix/rgb_matrix_types.h
index eea603c41c..53ff7321b8 100644
--- a/quantum/rgb_matrix/rgb_matrix_types.h
+++ b/quantum/rgb_matrix/rgb_matrix_types.h
@@ -83,16 +83,18 @@ typedef struct PACKED {
} led_config_t;
typedef union {
- uint32_t raw;
+ uint64_t raw;
struct PACKED {
uint8_t enable : 2;
uint8_t mode : 6;
HSV hsv;
- uint8_t speed; // EECONFIG needs to be increased to support this
+ uint8_t speed;
led_flags_t flags;
};
} rgb_config_t;
+_Static_assert(sizeof(rgb_config_t) == sizeof(uint64_t), "RGB Matrix EECONFIG out of spec.");
+
#if defined(_MSC_VER)
# pragma pack(pop)
#endif