1
0
Fork 0

Added a build flag for using a custom rgblight driver

This commit is contained in:
Luiz Ribeiro 2017-06-10 12:40:32 -04:00
parent 964d7060e1
commit d4cd5dda5c
7 changed files with 57 additions and 23 deletions

View file

@ -198,12 +198,14 @@ endif
ifeq ($(strip $(RGBLIGHT_ENABLE)), yes) ifeq ($(strip $(RGBLIGHT_ENABLE)), yes)
OPT_DEFS += -DRGBLIGHT_ENABLE OPT_DEFS += -DRGBLIGHT_ENABLE
ifneq ($(strip $(DISABLE_WS2812)), yes)
SRC += $(QUANTUM_DIR)/light_ws2812.c
endif
SRC += $(QUANTUM_DIR)/rgblight.c SRC += $(QUANTUM_DIR)/rgblight.c
CIE1931_CURVE = yes CIE1931_CURVE = yes
LED_BREATHING_TABLE = 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 endif
ifeq ($(strip $(TAP_DANCE_ENABLE)), yes) ifeq ($(strip $(TAP_DANCE_ENABLE)), yes)

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python #!/usr/bin/env python3.5
# Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com> # Copyright 2017 Luiz Ribeiro <luizribeiro@gmail.com>
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify

View file

@ -32,7 +32,7 @@ CONSOLE_ENABLE = yes
COMMAND_ENABLE = yes COMMAND_ENABLE = yes
BACKLIGHT_ENABLE = no BACKLIGHT_ENABLE = no
RGBLIGHT_ENABLE = yes RGBLIGHT_ENABLE = yes
DISABLE_WS2812 = yes RGBLIGHT_CUSTOM_DRIVER = yes
OPT_DEFS = -DDEBUG_LEVEL=0 OPT_DEFS = -DDEBUG_LEVEL=0
OPT_DEFS += -DBOOTLOADER_SIZE=2048 OPT_DEFS += -DBOOTLOADER_SIZE=2048

View file

@ -28,23 +28,7 @@
//#include "ws2812_config.h" //#include "ws2812_config.h"
//#include "i2cmaster.h" //#include "i2cmaster.h"
#ifdef RGBW #include "rgblight_types.h"
#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;};
/* User Interface /* User Interface

View file

@ -364,7 +364,7 @@ void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
rgblight_set(); rgblight_set();
} }
__attribute__ ((weak)) #ifndef RGBLIGHT_CUSTOM_DRIVER
void rgblight_set(void) { void rgblight_set(void) {
if (rgblight_config.enable) { if (rgblight_config.enable) {
#ifdef RGBW #ifdef RGBW
@ -385,6 +385,7 @@ void rgblight_set(void) {
#endif #endif
} }
} }
#endif
#ifdef RGBLIGHT_ANIMATIONS #ifdef RGBLIGHT_ANIMATIONS

View file

@ -61,7 +61,10 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
#include "eeconfig.h" #include "eeconfig.h"
#ifndef RGBLIGHT_CUSTOM_DRIVER
#include "light_ws2812.h" #include "light_ws2812.h"
#endif
#include "rgblight_types.h"
extern LED_TYPE led[RGBLED_NUM]; extern LED_TYPE led[RGBLED_NUM];

44
quantum/rgblight_types.h Normal file
View file

@ -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