summaryrefslogtreecommitdiff
path: root/quantum
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-04-14 20:50:35 -0400
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-04-14 17:50:35 -0700
commit5fcd744ddba591829a129560992b2e43fb615d4d (patch)
tree33b78133af1563f5dfa1e125a37f86e30a7df1cb /quantum
parentd7ba190cd9b90bce3a00dfa2a9afe4b3bf0a1dbb (diff)
downloadqmk_firmware-5fcd744ddba591829a129560992b2e43fb615d4d.tar.gz
qmk_firmware-5fcd744ddba591829a129560992b2e43fb615d4d.zip
Features/ws2812 matrix driver (#5418)
* WS2812 driver implementation for RGB Matrix * Added driver configuration docs
Diffstat (limited to 'quantum')
-rw-r--r--quantum/rgb_matrix.h6
-rw-r--r--quantum/rgb_matrix_drivers.c21
-rw-r--r--quantum/rgblight.c4
3 files changed, 29 insertions, 2 deletions
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h
index 0e193dcb2f..0a11f26920 100644
--- a/quantum/rgb_matrix.h
+++ b/quantum/rgb_matrix.h
@@ -28,9 +28,11 @@
#ifdef IS31FL3731
#include "is31fl3731.h"
#elif defined (IS31FL3733)
- #include "is31fl3733.h"
+ #include "is31fl3733.h"
#elif defined (IS31FL3737)
- #include "is31fl3737.h"
+ #include "is31fl3737.h"
+#elif defined (WS2812)
+ #include "ws2812.h"
#endif
#ifndef RGB_MATRIX_LED_FLUSH_LIMIT
diff --git a/quantum/rgb_matrix_drivers.c b/quantum/rgb_matrix_drivers.c
index 3b7d58483a..3814dd61fc 100644
--- a/quantum/rgb_matrix_drivers.c
+++ b/quantum/rgb_matrix_drivers.c
@@ -97,4 +97,25 @@ const rgb_matrix_driver_t rgb_matrix_driver = {
};
#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
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 08515564bc..e2410424e4 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -63,7 +63,11 @@ const uint16_t RGBLED_GRADIENT_RANGES[] PROGMEM = {360, 240, 180, 120, 90};
rgblight_config_t rgblight_config;
bool is_rgblight_initialized = false;
+#ifndef LED_ARRAY
LED_TYPE led[RGBLED_NUM];
+ #define LED_ARRAY led
+#endif
+
bool rgblight_timer_enabled = false;
static uint8_t clipping_start_pos = 0;