1
0
Fork 0

Change led variable in rgb_matrix_drivers to avoid conflicts (#9412)

* Change `led` to `led_matrix` in rgb_matrix_drivers

Is a minor change that only affects the driver file. 

However, this will allow somebody to run rgblight along side rgb matrix
using the ws2812 driver, as well.  Specifically, so you can use the
custom driver for rgblight to set a different pin (barring a change to
the `ws2812_setleds` function).  

Courtesy of discord conversion:
https://discordapp.com/channels/440868230475677696/568161140534935572/721555623191248906

* Change name to be super specific

* Update rgb_matrix_drivers.c
This commit is contained in:
Drashna Jaelre 2020-06-20 15:07:26 -07:00 committed by GitHub
parent 8252f378d9
commit 30cdf9331a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -115,27 +115,27 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
#elif defined(WS2812) #elif defined(WS2812)
// LED color buffer // LED color buffer
LED_TYPE led[DRIVER_LED_TOTAL]; LED_TYPE rgb_matrix_ws2812_array[DRIVER_LED_TOTAL];
static void init(void) {} static void init(void) {}
static void flush(void) { static void flush(void) {
// Assumes use of RGB_DI_PIN // Assumes use of RGB_DI_PIN
ws2812_setleds(led, DRIVER_LED_TOTAL); ws2812_setleds(rgb_matrix_ws2812_array, DRIVER_LED_TOTAL);
} }
// Set an led in the buffer to a color // Set an led in the buffer to a color
static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) { static inline void setled(int i, uint8_t r, uint8_t g, uint8_t b) {
led[i].r = r; rgb_matrix_ws2812_array[i].r = r;
led[i].g = g; rgb_matrix_ws2812_array[i].g = g;
led[i].b = b; rgb_matrix_ws2812_array[i].b = b;
# ifdef RGBW # ifdef RGBW
convert_rgb_to_rgbw(led[i]); convert_rgb_to_rgbw(rgb_matrix_ws2812_array[i]);
# endif # endif
} }
static void setled_all(uint8_t r, uint8_t g, uint8_t b) { static void setled_all(uint8_t r, uint8_t g, uint8_t b) {
for (int i = 0; i < sizeof(led) / sizeof(led[0]); i++) { for (int i = 0; i < sizeof(rgb_matrix_ws2812_array) / sizeof(rgb_matrix_ws2812_array[0]); i++) {
setled(i, r, g, b); setled(i, r, g, b);
} }
} }