aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/kprepublic/bm60hsrgb_iso
diff options
context:
space:
mode:
authorRyan2024-10-06 10:01:07 +0200
committerGitHub2024-10-06 10:01:07 +0200
commit208ebf54a905ce6e4e563a6811eca8c8dc8b17e1 (patch)
tree7bb6a8bdb5a641263c39236d0b655825ac37307b /keyboards/kprepublic/bm60hsrgb_iso
parent43e82ed5c72b7386ca91d1bd363ee092f77c1b9a (diff)
WS2812 API rework (#24364)
* Begin WS2812 API rework * Move RGBW conversion, clean up color.h, fix RGBW for AVR bitbang * Formatting & update PS2AVRGB I2C driver (untested) * Tested ARM bitbang RGB+RGBW * Tested ARM SPI RGB - RGBW not working * Tested ARM PWM RGB+RGBW * Tested RP2040 PIO driver RGB+RGBW * Update RGBLight * Formatting * Fix BM60HSRGB rev2 * Fix oddforge/vea * Fix 1k and XD002 RGBLite * Fix model_m/mschwingen * Fix handwired/promethium * Rename `WS2812_LED_TOTAL` for BM60HSRGB * Fix work_louder boards * Fix dawn60 * Fix rgbkb/pan * Fix neson_design/700e and n6 * Fix ergodox_ez/shine * ergodox_ez/shine: invert indices for left half * Fix matrix/abelx * Fix matrix/m20add * Remove custom rgblight driver for matrix/noah - should be done with lighting layers * Fix LED indexes for RGBLight split * Rename `convert_rgb_to_rgbw()` to `ws2812_rgb_to_rgbw()` * Update WS2812 API docs * `ergodox_ez/shine`: simplify LED index calculation * LED/RGB Matrix: Add weak function for LED index resolution * Bandaid fix for RGB Matrix splits not using WS2812 * `steelseries/prime_plus`: redo custom RGBLight driver * Update keyboards/steelseries/prime_plus/rgblight_custom.c Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com> --------- Co-authored-by: Dasky <32983009+daskygit@users.noreply.github.com>
Diffstat (limited to 'keyboards/kprepublic/bm60hsrgb_iso')
-rw-r--r--keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h6
-rw-r--r--keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c26
2 files changed, 11 insertions, 21 deletions
diff --git a/keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h b/keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h
index ea594e53cf..710e240aa4 100644
--- a/keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h
+++ b/keyboards/kprepublic/bm60hsrgb_iso/rev2/config.h
@@ -23,9 +23,9 @@
// Underglow LEDs are WS2812, but someone might want to use RGBLIGHT for them;
// don't use those LEDs in RGB Matrix in that case.
#ifdef RGBLIGHT_ENABLE
-# define WS2812_LED_TOTAL 0
+# define WS2812_LED_COUNT 0
#else
-# define WS2812_LED_TOTAL 6
+# define WS2812_LED_COUNT 6
#endif
-#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_TOTAL)
+#define RGB_MATRIX_LED_COUNT (IS31FL3733_LED_COUNT + WS2812_LED_COUNT)
diff --git a/keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c b/keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c
index 794dea5176..0d52d1bacb 100644
--- a/keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c
+++ b/keyboards/kprepublic/bm60hsrgb_iso/rev2/rev2.c
@@ -112,7 +112,7 @@ led_config_t g_led_config = { {
{ 3, 48 }, { 22, 48 }, { 33, 48 }, { 48, 48 }, { 63, 48 }, { 78, 48 }, { 93, 48 }, { 108, 48 }, { 123, 48 }, { 138, 48 }, { 153, 48 }, { 168, 48 }, { 194, 48 }, { 213, 48 },
// Ctrl, GUI, Alt, Space, RAlt, FN, Left, Down, Right
{ 3, 64 }, { 22, 64 }, { 33, 64 }, { 101, 64 }, { 135, 64 }, { 153, 64 }, { 195, 64 }, { 210, 64 }, { 225, 64 }
-# if WS2812_LED_TOTAL > 0
+# if WS2812_LED_COUNT > 0
,{ 28, 40}, { 62, 40}, { 96, 40}, {130, 40}, {164, 40}, {198, 40}
# endif
}, {
@@ -126,7 +126,7 @@ led_config_t g_led_config = { {
1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, 1, 4,
// Ctrl, GUI, Alt, Space, RAlt, FN, Left, Down, Right
1, 1, 1, 4, 1, 1, 1, 1, 1
-# if WS2812_LED_TOTAL > 0
+# if WS2812_LED_COUNT > 0
,2, 2, 2, 2, 2, 2
# endif
} };
@@ -147,10 +147,6 @@ bool rgb_matrix_indicators_kb(void) {
// Custom RGB Matrix driver that combines IS31FL3733 and WS2812
// ==========================================================================
-# if WS2812_LED_TOTAL > 0
-rgb_led_t rgb_matrix_ws2812_array[WS2812_LED_TOTAL];
-# endif
-
static void rgb_matrix_driver_init(void) {
i2c_init();
is31fl3733_init(0);
@@ -164,31 +160,25 @@ static void rgb_matrix_driver_init(void) {
static void rgb_matrix_driver_flush(void) {
is31fl3733_update_pwm_buffers(0);
-# if WS2812_LED_TOTAL > 0
- ws2812_setleds(rgb_matrix_ws2812_array, WS2812_LED_TOTAL);
+# if WS2812_LED_COUNT > 0
+ ws2812_flush();
# endif
}
static void rgb_matrix_driver_set_color(int index, uint8_t red, uint8_t green, uint8_t blue) {
if (index < IS31FL3733_LED_COUNT) {
is31fl3733_set_color(index, red, green, blue);
+# if WS2812_LED_COUNT > 0
} else {
-# if WS2812_LED_TOTAL > 0
- rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].r = red;
- rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].g = green;
- rgb_matrix_ws2812_array[index - IS31FL3733_LED_COUNT].b = blue;
+ ws2812_set_color(index - IS31FL3733_LED_COUNT, red, green, blue);
# endif
}
}
static void rgb_matrix_driver_set_color_all(uint8_t red, uint8_t green, uint8_t blue) {
is31fl3733_set_color_all(red, green, blue);
-# if WS2812_LED_TOTAL > 0
- for (uint8_t i = 0; i < WS2812_LED_TOTAL; i++) {
- rgb_matrix_ws2812_array[i].r = red;
- rgb_matrix_ws2812_array[i].g = green;
- rgb_matrix_ws2812_array[i].b = blue;
- }
+# if WS2812_LED_COUNT > 0
+ ws2812_set_color_all(red, green, blue);
# endif
}