1
0
Fork 0

Features/ws2812 matrix driver (#5418)

* WS2812 driver implementation for RGB Matrix

* Added driver configuration docs
This commit is contained in:
XScorpion2 2019-04-14 20:50:35 -04:00 committed by MechMerlin
parent d7ba190cd9
commit 5fcd744ddb
11 changed files with 177 additions and 13 deletions

View file

@ -27,6 +27,12 @@
#include <util/delay.h>
#include "debug.h"
#if !defined(LED_ARRAY) && defined(RGB_MATRIX_ENABLE)
// LED color buffer
LED_TYPE led[DRIVER_LED_TOTAL];
#define LED_ARRAY led
#endif
#ifdef RGBW_BB_TWI
// Port for the I2C
@ -141,6 +147,25 @@ unsigned char I2C_Write(unsigned char c)
#endif
#ifdef RGB_MATRIX_ENABLE
// Set an led in the buffer to a color
void inline ws2812_setled(int i, uint8_t r, uint8_t g, uint8_t b)
{
led[i].r = r;
led[i].g = g;
led[i].b = b;
}
void ws2812_setled_all (uint8_t r, uint8_t g, uint8_t b)
{
for (int i = 0; i < RGBLED_NUM; i++) {
led[i].r = r;
led[i].g = g;
led[i].b = b;
}
}
#endif
// Setleds for standard RGB
void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds)
{