Merge pull request #13 from ErgoDox-EZ/feature/ws2812_matrix
Features/ws2812 matrix driver (#5418)
This commit is contained in:
@@ -3,3 +3,4 @@
|
|||||||
04-12-2019 - Enhancement for Eager debouncing (and Ergodox EZ host sleep fix) (qmk#5621)
|
04-12-2019 - Enhancement for Eager debouncing (and Ergodox EZ host sleep fix) (qmk#5621)
|
||||||
04-16-2019 - Fix logic for Combo feature (qmk#5610)
|
04-16-2019 - Fix logic for Combo feature (qmk#5610)
|
||||||
04-16-2019 - Fix info.json for Ergodox EZ
|
04-16-2019 - Fix info.json for Ergodox EZ
|
||||||
|
04-16-2019 - Add support for WS2812 based RGB Matrix
|
||||||
@@ -114,7 +114,7 @@ ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 IS31FL3737 custom
|
VALID_MATRIX_TYPES := yes IS31FL3731 IS31FL3733 IS31FL3737 WS2812 custom
|
||||||
|
|
||||||
LED_MATRIX_ENABLE ?= no
|
LED_MATRIX_ENABLE ?= no
|
||||||
ifneq ($(strip $(LED_MATRIX_ENABLE)), no)
|
ifneq ($(strip $(LED_MATRIX_ENABLE)), no)
|
||||||
@@ -172,6 +172,11 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), IS31FL3737)
|
|||||||
SRC += i2c_master.c
|
SRC += i2c_master.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(strip $(RGB_MATRIX_ENABLE)), WS2812)
|
||||||
|
OPT_DEFS += -DWS2812
|
||||||
|
SRC += ws2812.c
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
|
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
|
||||||
OPT_DEFS += -DTAP_DANCE_ENABLE
|
OPT_DEFS += -DTAP_DANCE_ENABLE
|
||||||
SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
|
SRC += $(QUANTUM_DIR)/process_keycode/process_tap_dance.c
|
||||||
|
|||||||
@@ -27,6 +27,12 @@
|
|||||||
#include <util/delay.h>
|
#include <util/delay.h>
|
||||||
#include "debug.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
|
#ifdef RGBW_BB_TWI
|
||||||
|
|
||||||
// Port for the I2C
|
// Port for the I2C
|
||||||
@@ -141,6 +147,25 @@ unsigned char I2C_Write(unsigned char c)
|
|||||||
|
|
||||||
#endif
|
#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
|
// Setleds for standard RGB
|
||||||
void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds)
|
void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,7 +30,6 @@
|
|||||||
|
|
||||||
#include "rgblight_types.h"
|
#include "rgblight_types.h"
|
||||||
|
|
||||||
|
|
||||||
/* User Interface
|
/* User Interface
|
||||||
*
|
*
|
||||||
* Input:
|
* Input:
|
||||||
@@ -43,6 +42,10 @@
|
|||||||
* - Send out the LED data
|
* - Send out the LED data
|
||||||
* - Wait 50<35>s to reset the LEDs
|
* - Wait 50<35>s to reset the LEDs
|
||||||
*/
|
*/
|
||||||
|
#ifdef RGB_MATRIX_ENABLE
|
||||||
|
void ws2812_setled (int index, uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
void ws2812_setled_all (uint8_t r, uint8_t g, uint8_t b);
|
||||||
|
#endif
|
||||||
|
|
||||||
void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds);
|
void ws2812_setleds (LED_TYPE *ledarray, uint16_t number_of_leds);
|
||||||
void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask);
|
void ws2812_setleds_pin (LED_TYPE *ledarray, uint16_t number_of_leds,uint8_t pinmask);
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include "is31fl3733.h"
|
#include "is31fl3733.h"
|
||||||
#elif defined (IS31FL3737)
|
#elif defined (IS31FL3737)
|
||||||
#include "is31fl3737.h"
|
#include "is31fl3737.h"
|
||||||
|
#elif defined (WS2812)
|
||||||
|
#include "ws2812.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef RGB_MATRIX_LED_FLUSH_LIMIT
|
#ifndef RGB_MATRIX_LED_FLUSH_LIMIT
|
||||||
|
|||||||
@@ -97,4 +97,25 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#elif defined(WS2812)
|
||||||
|
|
||||||
|
extern LED_TYPE led[RGBLED_NUM];
|
||||||
|
|
||||||
|
static void flush( void )
|
||||||
|
{
|
||||||
|
// Assumes use of RGB_DI_PIN
|
||||||
|
ws2812_setleds(led, RGBLED_NUM);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void init( void )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
const rgb_matrix_driver_t rgb_matrix_driver = {
|
||||||
|
.init = init,
|
||||||
|
.flush = flush,
|
||||||
|
.set_color = ws2812_setled,
|
||||||
|
.set_color_all = ws2812_setled_all,
|
||||||
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -63,7 +63,11 @@ const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
|
|||||||
rgblight_config_t rgblight_config;
|
rgblight_config_t rgblight_config;
|
||||||
bool is_rgblight_initialized = false;
|
bool is_rgblight_initialized = false;
|
||||||
|
|
||||||
|
#ifndef LED_ARRAY
|
||||||
LED_TYPE led[RGBLED_NUM];
|
LED_TYPE led[RGBLED_NUM];
|
||||||
|
#define LED_ARRAY led
|
||||||
|
#endif
|
||||||
|
|
||||||
bool rgblight_timer_enabled = false;
|
bool rgblight_timer_enabled = false;
|
||||||
|
|
||||||
static uint8_t clipping_start_pos = 0;
|
static uint8_t clipping_start_pos = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user