summaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2024-04-28 00:36:54 +1000
committerGitHub <noreply@github.com>2024-04-28 00:36:54 +1000
commit0ff53b24984e88f385638e47ea076b4d2945c0c6 (patch)
tree73c0e43df640c132507cb146447adfb7d0ed4b49 /platforms
parent8f8fffc1740be81fbfe4a07a74e9f03962c1062a (diff)
Rename `RGBW` define to `WS2812_RGBW` (#23585)
Diffstat (limited to 'platforms')
-rw-r--r--platforms/avr/drivers/ws2812_i2c.c2
-rw-r--r--platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c6
-rw-r--r--platforms/chibios/drivers/ws2812_bitbang.c2
-rw-r--r--platforms/chibios/drivers/ws2812_pwm.c8
-rw-r--r--platforms/chibios/drivers/ws2812_spi.c4
5 files changed, 11 insertions, 11 deletions
diff --git a/platforms/avr/drivers/ws2812_i2c.c b/platforms/avr/drivers/ws2812_i2c.c
index 60b466c32a..86a5ac8394 100644
--- a/platforms/avr/drivers/ws2812_i2c.c
+++ b/platforms/avr/drivers/ws2812_i2c.c
@@ -1,7 +1,7 @@
1#include "ws2812.h" 1#include "ws2812.h"
2#include "i2c_master.h" 2#include "i2c_master.h"
3 3
4#ifdef RGBW 4#ifdef WS2812_RGBW
5# error "RGBW not supported" 5# error "RGBW not supported"
6#endif 6#endif
7 7
diff --git a/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c b/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c
index 95a827e4b8..41a5311719 100644
--- a/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c
+++ b/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c
@@ -161,7 +161,7 @@ static void ws2812_dma_callback(void* p, uint32_t ct) {
161 // FIFO is already empty. 161 // FIFO is already empty.
162 rtcnt_t time_to_completion = (pio_sm_get_tx_fifo_level(pio, STATE_MACHINE) + 1) * MAX(WS2812_T1H + WS2812_T1L, WS2812_T0H + WS2812_T0L); 162 rtcnt_t time_to_completion = (pio_sm_get_tx_fifo_level(pio, STATE_MACHINE) + 1) * MAX(WS2812_T1H + WS2812_T1L, WS2812_T0H + WS2812_T0L);
163 163
164#if defined(RGBW) 164#if defined(WS2812_RGBW)
165 time_to_completion *= 32; 165 time_to_completion *= 32;
166#else 166#else
167 time_to_completion *= 24; 167 time_to_completion *= 24;
@@ -222,7 +222,7 @@ void ws2812_init(void) {
222 sm_config_set_sideset(&config, 1, false, false); 222 sm_config_set_sideset(&config, 1, false, false);
223#endif 223#endif
224 224
225#if defined(RGBW) 225#if defined(WS2812_RGBW)
226 sm_config_set_out_shift(&config, false, true, 32); 226 sm_config_set_out_shift(&config, false, true, 32);
227#else 227#else
228 sm_config_set_out_shift(&config, false, true, 24); 228 sm_config_set_out_shift(&config, false, true, 24);
@@ -270,7 +270,7 @@ void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
270 sync_ws2812_transfer(); 270 sync_ws2812_transfer();
271 271
272 for (int i = 0; i < leds; i++) { 272 for (int i = 0; i < leds; i++) {
273#if defined(RGBW) 273#if defined(WS2812_RGBW)
274 WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, ledarray[i].w); 274 WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, ledarray[i].w);
275#else 275#else
276 WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, 0); 276 WS2812_BUFFER[i] = rgbw8888_to_u32(ledarray[i].r, ledarray[i].g, ledarray[i].b, 0);
diff --git a/platforms/chibios/drivers/ws2812_bitbang.c b/platforms/chibios/drivers/ws2812_bitbang.c
index 9ed6bacd5a..96378ec0ac 100644
--- a/platforms/chibios/drivers/ws2812_bitbang.c
+++ b/platforms/chibios/drivers/ws2812_bitbang.c
@@ -101,7 +101,7 @@ void ws2812_setleds(rgb_led_t *ledarray, uint16_t leds) {
101 sendByte(ledarray[i].r); 101 sendByte(ledarray[i].r);
102#endif 102#endif
103 103
104#ifdef RGBW 104#ifdef WS2812_RGBW
105 sendByte(ledarray[i].w); 105 sendByte(ledarray[i].w);
106#endif 106#endif
107 } 107 }
diff --git a/platforms/chibios/drivers/ws2812_pwm.c b/platforms/chibios/drivers/ws2812_pwm.c
index 7dc3414ead..1e9d2ebb41 100644
--- a/platforms/chibios/drivers/ws2812_pwm.c
+++ b/platforms/chibios/drivers/ws2812_pwm.c
@@ -16,7 +16,7 @@
16 16
17/* Adapted from https://github.com/joewa/WS2812-LED-Driver_ChibiOS/ */ 17/* Adapted from https://github.com/joewa/WS2812-LED-Driver_ChibiOS/ */
18 18
19#ifdef RGBW 19#ifdef WS2812_RGBW
20# define WS2812_CHANNELS 4 20# define WS2812_CHANNELS 4
21#else 21#else
22# define WS2812_CHANNELS 3 22# define WS2812_CHANNELS 3
@@ -262,7 +262,7 @@
262# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 0, (bit)) 262# define WS2812_BLUE_BIT(led, bit) WS2812_BIT((led), 0, (bit))
263#endif 263#endif
264 264
265#ifdef RGBW 265#ifdef WS2812_RGBW
266/** 266/**
267 * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given white bit 267 * @brief Determine the index in @ref ws2812_frame_buffer "the frame buffer" of a given white bit
268 * 268 *
@@ -381,7 +381,7 @@ void ws2812_write_led_rgbw(uint16_t led_number, uint8_t r, uint8_t g, uint8_t b,
381 ws2812_frame_buffer[WS2812_RED_BIT(led_number, bit)] = ((r >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; 381 ws2812_frame_buffer[WS2812_RED_BIT(led_number, bit)] = ((r >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
382 ws2812_frame_buffer[WS2812_GREEN_BIT(led_number, bit)] = ((g >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; 382 ws2812_frame_buffer[WS2812_GREEN_BIT(led_number, bit)] = ((g >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
383 ws2812_frame_buffer[WS2812_BLUE_BIT(led_number, bit)] = ((b >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; 383 ws2812_frame_buffer[WS2812_BLUE_BIT(led_number, bit)] = ((b >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
384#ifdef RGBW 384#ifdef WS2812_RGBW
385 ws2812_frame_buffer[WS2812_WHITE_BIT(led_number, bit)] = ((w >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0; 385 ws2812_frame_buffer[WS2812_WHITE_BIT(led_number, bit)] = ((w >> bit) & 0x01) ? WS2812_DUTYCYCLE_1 : WS2812_DUTYCYCLE_0;
386#endif 386#endif
387 } 387 }
@@ -390,7 +390,7 @@ void ws2812_write_led_rgbw(uint16_t led_number, uint8_t r, uint8_t g, uint8_t b,
390// Setleds for standard RGB 390// Setleds for standard RGB
391void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) { 391void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
392 for (uint16_t i = 0; i < leds; i++) { 392 for (uint16_t i = 0; i < leds; i++) {
393#ifdef RGBW 393#ifdef WS2812_RGBW
394 ws2812_write_led_rgbw(i, ledarray[i].r, ledarray[i].g, ledarray[i].b, ledarray[i].w); 394 ws2812_write_led_rgbw(i, ledarray[i].r, ledarray[i].g, ledarray[i].b, ledarray[i].w);
395#else 395#else
396 ws2812_write_led(i, ledarray[i].r, ledarray[i].g, ledarray[i].b); 396 ws2812_write_led(i, ledarray[i].r, ledarray[i].g, ledarray[i].b);
diff --git a/platforms/chibios/drivers/ws2812_spi.c b/platforms/chibios/drivers/ws2812_spi.c
index 5b990ccaa0..ad2e87781c 100644
--- a/platforms/chibios/drivers/ws2812_spi.c
+++ b/platforms/chibios/drivers/ws2812_spi.c
@@ -76,7 +76,7 @@
76#endif 76#endif
77 77
78#define BYTES_FOR_LED_BYTE 4 78#define BYTES_FOR_LED_BYTE 4
79#ifdef RGBW 79#ifdef WS2812_RGBW
80# define WS2812_CHANNELS 4 80# define WS2812_CHANNELS 4
81#else 81#else
82# define WS2812_CHANNELS 3 82# define WS2812_CHANNELS 3
@@ -131,7 +131,7 @@ static void set_led_color_rgb(rgb_led_t color, int pos) {
131 for (int j = 0; j < 4; j++) 131 for (int j = 0; j < 4; j++)
132 tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.r, j); 132 tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 2 + j] = get_protocol_eq(color.r, j);
133#endif 133#endif
134#ifdef RGBW 134#ifdef WS2812_RGBW
135 for (int j = 0; j < 4; j++) 135 for (int j = 0; j < 4; j++)
136 tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 4 + j] = get_protocol_eq(color.w, j); 136 tx_start[BYTES_FOR_LED * pos + BYTES_FOR_LED_BYTE * 4 + j] = get_protocol_eq(color.w, j);
137#endif 137#endif