summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorLuiz Ribeiro <luizribeiro@gmail.com>2017-06-10 18:40:32 +0200
committerLuiz Ribeiro <luizribeiro@gmail.com>2017-06-11 18:30:48 +0200
commitd4cd5dda5c3e3c5b8b8d4db5d0bbed2fec0c770d (patch)
tree8f62acf6a849da7f7c61c18635b905ba8cd63132 /quantum
parent964d7060e1176d487a1f9dfe9bb76b491983748d (diff)
downloadqmk_firmware-d4cd5dda5c3e3c5b8b8d4db5d0bbed2fec0c770d.tar.gz
qmk_firmware-d4cd5dda5c3e3c5b8b8d4db5d0bbed2fec0c770d.tar.xz
Added a build flag for using a custom rgblight driver
Diffstat (limited to 'quantum')
-rwxr-xr-xquantum/light_ws2812.h18
-rw-r--r--quantum/rgblight.c3
-rw-r--r--quantum/rgblight.h3
-rw-r--r--quantum/rgblight_types.h44
4 files changed, 50 insertions, 18 deletions
diff --git a/quantum/light_ws2812.h b/quantum/light_ws2812.h
index 60924a0fb..f7e0c3144 100755
--- a/quantum/light_ws2812.h
+++ b/quantum/light_ws2812.h
@@ -28,23 +28,7 @@
//#include "ws2812_config.h"
//#include "i2cmaster.h"
-#ifdef RGBW
- #define LED_TYPE struct cRGBW
-#else
- #define LED_TYPE struct cRGB
-#endif
-
-
-/*
- * Structure of the LED array
- *
- * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106
- * cRGBW: RGBW for SK6812RGBW
- */
-
-struct cRGB { uint8_t g; uint8_t r; uint8_t b; };
-struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;};
-
+#include "rgblight_types.h"
/* User Interface
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 4eec2a776..49420de37 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -364,7 +364,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
rgblight_set();
}
-__attribute__ ((weak))
+#ifndef RGBLIGHT_CUSTOM_DRIVER
void rgblight_set(void) {
if (rgblight_config.enable) {
#ifdef RGBW
@@ -385,6 +385,7 @@ void rgblight_set(void) {
#endif
}
}
+#endif
#ifdef RGBLIGHT_ANIMATIONS
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 92130192c..6b609da7f 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -61,7 +61,10 @@
#include <stdint.h>
#include <stdbool.h>
#include "eeconfig.h"
+#ifndef RGBLIGHT_CUSTOM_DRIVER
#include "light_ws2812.h"
+#endif
+#include "rgblight_types.h"
extern LED_TYPE led[RGBLED_NUM];
diff --git a/quantum/rgblight_types.h b/quantum/rgblight_types.h
new file mode 100644
index 000000000..1d1467a12
--- /dev/null
+++ b/quantum/rgblight_types.h
@@ -0,0 +1,44 @@
+/*
+ * light weight WS2812 lib include
+ *
+ * Version 2.3 - Nev 29th 2015
+ * Author: Tim (cpldcpu@gmail.com)
+ *
+ * Please do not change this file! All configuration is handled in "ws2812_config.h"
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef RGBLIGHT_TYPES
+
+#include <avr/io.h>
+
+#ifdef RGBW
+ #define LED_TYPE struct cRGBW
+#else
+ #define LED_TYPE struct cRGB
+#endif
+
+
+/*
+ * Structure of the LED array
+ *
+ * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106
+ * cRGBW: RGBW for SK6812RGBW
+ */
+
+struct cRGB { uint8_t g; uint8_t r; uint8_t b; };
+struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;};
+
+#endif