]> git.donarmstrong.com Git - qmk_firmware.git/commitdiff
Added a build flag for using a custom rgblight driver
authorLuiz Ribeiro <luizribeiro@gmail.com>
Sat, 10 Jun 2017 16:40:32 +0000 (12:40 -0400)
committerLuiz Ribeiro <luizribeiro@gmail.com>
Sun, 11 Jun 2017 16:30:48 +0000 (12:30 -0400)
build_keyboard.mk
keyboards/ps2avrGB/program
keyboards/ps2avrGB/rules.mk
quantum/light_ws2812.h
quantum/rgblight.c
quantum/rgblight.h
quantum/rgblight_types.h [new file with mode: 0644]

index dc9e5dad631f2d08102b2f84969d9118cb2362c9..550440cbcfe559dbda5df343dacfbc18d8672ba4 100644 (file)
@@ -198,12 +198,14 @@ endif
 
 ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
     OPT_DEFS += -DRGBLIGHT_ENABLE
-ifneq ($(strip $(DISABLE_WS2812)), yes)
-        SRC += $(QUANTUM_DIR)/light_ws2812.c
-endif
     SRC += $(QUANTUM_DIR)/rgblight.c
     CIE1931_CURVE = yes
     LED_BREATHING_TABLE = yes
+ifeq ($(strip $(RGBLIGHT_CUSTOM_DRIVER)), yes)
+                       OPT_DEFS += -DRGBLIGHT_CUSTOM_DRIVER
+else
+                       SRC += $(QUANTUM_DIR)/light_ws2812.c
+endif
 endif
 
 ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)
index a88d9cd9b042545a4b010848f700a75fe0785770..081a8219ced001921b80fea8bb65894431ae5b17 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3.5
 # Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
 #
 # This program is free software: you can redistribute it and/or modify
index 9fb27efed9079a6bb24d6751985771deff8445c7..9e76993c4a50490a86c7e3df035c22fcca22d9d0 100644 (file)
@@ -32,7 +32,7 @@ CONSOLE_ENABLE = yes
 COMMAND_ENABLE = yes
 BACKLIGHT_ENABLE = no
 RGBLIGHT_ENABLE = yes
-DISABLE_WS2812 = yes
+RGBLIGHT_CUSTOM_DRIVER = yes
 
 OPT_DEFS = -DDEBUG_LEVEL=0
 OPT_DEFS += -DBOOTLOADER_SIZE=2048
index 60924a0fb61d5895fb22bc7dfa1e9ff0027d4467..f7e0c31440ca0ab32ed76dd2281eed642a3995de 100755 (executable)
 //#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
index 4eec2a7762017a32fbf240bb077a18838f476150..49420de3769551cdff7531cf96a7603421e52006 100644 (file)
@@ -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
 
index 92130192ce37b436a2d1552937218713cd64cd6e..6b609da7fce48a72cb7095c4ac6a4d644c88482f 100644 (file)
 #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 (file)
index 0000000..1d1467a
--- /dev/null
@@ -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