aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-06-04 13:04:30 -0500
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-06-04 11:04:30 -0700
commite7711b3b665c7df0a2a1d7272580cc01be28590d (patch)
tree7077e62abc3eb3fb3524092c1acabd164a8ae50c
parent661a9154ae8178c39f244c687f6e298c11561d08 (diff)
downloadqmk_firmware-e7711b3b665c7df0a2a1d7272580cc01be28590d.tar.gz
qmk_firmware-e7711b3b665c7df0a2a1d7272580cc01be28590d.zip
Moving rgb typedefs into a single location (#5978)
Because someone named the define poorly Using full relative path as handwired/promethium has a color.h file
-rwxr-xr-xdrivers/avr/apa102.h2
-rw-r--r--drivers/avr/ws2812.h2
-rw-r--r--keyboards/cannonkeys/bluepill/ws2812.h2
-rw-r--r--keyboards/cannonkeys/stm32f072/ws2812.h3
-rw-r--r--keyboards/handwired/promethium/rgbsps.c2
-rw-r--r--keyboards/mxss/rgblight.h2
-rw-r--r--quantum/color.h22
-rw-r--r--quantum/rgblight.h2
-rw-r--r--quantum/rgblight_types.h47
9 files changed, 27 insertions, 57 deletions
diff --git a/drivers/avr/apa102.h b/drivers/avr/apa102.h
index e7d7c3684..5d852e067 100755
--- a/drivers/avr/apa102.h
+++ b/drivers/avr/apa102.h
@@ -25,7 +25,7 @@
25#include <avr/io.h> 25#include <avr/io.h>
26#include <avr/interrupt.h> 26#include <avr/interrupt.h>
27 27
28#include "rgblight_types.h" 28#include "color.h"
29 29
30 30
31/* User Interface 31/* User Interface
diff --git a/drivers/avr/ws2812.h b/drivers/avr/ws2812.h
index ecb1dc4d1..95f540b18 100644
--- a/drivers/avr/ws2812.h
+++ b/drivers/avr/ws2812.h
@@ -28,7 +28,7 @@
28//#include "ws2812_config.h" 28//#include "ws2812_config.h"
29//#include "i2cmaster.h" 29//#include "i2cmaster.h"
30 30
31#include "rgblight_types.h" 31#include "quantum/color.h"
32 32
33/* User Interface 33/* User Interface
34 * 34 *
diff --git a/keyboards/cannonkeys/bluepill/ws2812.h b/keyboards/cannonkeys/bluepill/ws2812.h
index 3b61ddcfa..be37df766 100644
--- a/keyboards/cannonkeys/bluepill/ws2812.h
+++ b/keyboards/cannonkeys/bluepill/ws2812.h
@@ -1,7 +1,7 @@
1#pragma once 1#pragma once
2 2
3#include "hal.h" 3#include "hal.h"
4#include "rgblight_types.h" 4#include "color.h"
5 5
6 6
7void set_leds_color_rgb(LED_TYPE color); 7void set_leds_color_rgb(LED_TYPE color);
diff --git a/keyboards/cannonkeys/stm32f072/ws2812.h b/keyboards/cannonkeys/stm32f072/ws2812.h
index 3b61ddcfa..9b545fcd5 100644
--- a/keyboards/cannonkeys/stm32f072/ws2812.h
+++ b/keyboards/cannonkeys/stm32f072/ws2812.h
@@ -1,8 +1,7 @@
1#pragma once 1#pragma once
2 2
3#include "hal.h" 3#include "hal.h"
4#include "rgblight_types.h" 4#include "color.h"
5
6 5
7void set_leds_color_rgb(LED_TYPE color); 6void set_leds_color_rgb(LED_TYPE color);
8void set_led_color_rgb(LED_TYPE color, int pos); 7void set_led_color_rgb(LED_TYPE color, int pos);
diff --git a/keyboards/handwired/promethium/rgbsps.c b/keyboards/handwired/promethium/rgbsps.c
index 84fac1ae1..f43987691 100644
--- a/keyboards/handwired/promethium/rgbsps.c
+++ b/keyboards/handwired/promethium/rgbsps.c
@@ -1,7 +1,7 @@
1#include "ws2812.h" 1#include "ws2812.h"
2#include "rgbsps.h" 2#include "rgbsps.h"
3 3
4struct cRGB led[RGBSPS_NUM]; 4cRGB led[RGBSPS_NUM];
5 5
6void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b) { 6void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b) {
7 led[index].r = r; 7 led[index].r = r;
diff --git a/keyboards/mxss/rgblight.h b/keyboards/mxss/rgblight.h
index 5205974f9..0013a3438 100644
--- a/keyboards/mxss/rgblight.h
+++ b/keyboards/mxss/rgblight.h
@@ -73,7 +73,7 @@
73#ifndef RGBLIGHT_CUSTOM_DRIVER 73#ifndef RGBLIGHT_CUSTOM_DRIVER
74#include "ws2812.h" 74#include "ws2812.h"
75#endif 75#endif
76#include "rgblight_types.h" 76#include "color.h"
77#include "rgblight_list.h" 77#include "rgblight_list.h"
78 78
79extern LED_TYPE led[RGBLED_NUM]; 79extern LED_TYPE led[RGBLED_NUM];
diff --git a/quantum/color.h b/quantum/color.h
index 9d51d45ad..22bb08351 100644
--- a/quantum/color.h
+++ b/quantum/color.h
@@ -32,12 +32,30 @@
32#pragma pack( push, 1 ) 32#pragma pack( push, 1 )
33#endif 33#endif
34 34
35#ifdef RGBW
36 #define LED_TYPE cRGBW
37#else
38 #define LED_TYPE RGB
39#endif
40
41// WS2812 specific layout
35typedef struct PACKED 42typedef struct PACKED
36{ 43{
44 uint8_t g;
37 uint8_t r; 45 uint8_t r;
46 uint8_t b;
47} cRGB;
48
49typedef cRGB RGB;
50
51// WS2812 specific layout
52typedef struct PACKED
53{
38 uint8_t g; 54 uint8_t g;
55 uint8_t r;
39 uint8_t b; 56 uint8_t b;
40} RGB; 57 uint8_t w;
58} cRGBW;
41 59
42typedef struct PACKED 60typedef struct PACKED
43{ 61{
@@ -50,6 +68,6 @@ typedef struct PACKED
50#pragma pack( pop ) 68#pragma pack( pop )
51#endif 69#endif
52 70
53RGB hsv_to_rgb( HSV hsv ); 71RGB hsv_to_rgb(HSV hsv);
54 72
55#endif // COLOR_H 73#endif // COLOR_H
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 064522a2b..cba18ae72 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -132,7 +132,7 @@ enum RGBLIGHT_EFFECT_MODE {
132#ifndef RGBLIGHT_CUSTOM_DRIVER 132#ifndef RGBLIGHT_CUSTOM_DRIVER
133#include "ws2812.h" 133#include "ws2812.h"
134#endif 134#endif
135#include "rgblight_types.h" 135#include "color.h"
136#include "rgblight_list.h" 136#include "rgblight_list.h"
137 137
138#if defined(__AVR__) 138#if defined(__AVR__)
diff --git a/quantum/rgblight_types.h b/quantum/rgblight_types.h
deleted file mode 100644
index 49ef5c8ea..000000000
--- a/quantum/rgblight_types.h
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * light weight WS2812 lib include
3 *
4 * Version 2.3 - Nev 29th 2015
5 * Author: Tim (cpldcpu@gmail.com)
6 *
7 * Please do not change this file! All configuration is handled in "ws2812_config.h"
8 *
9 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 */
22
23#ifndef RGBLIGHT_TYPES
24#define RGBLIGHT_TYPES
25
26#ifdef __AVR__
27 #include <avr/io.h>
28#endif
29
30#ifdef RGBW
31 #define LED_TYPE struct cRGBW
32#else
33 #define LED_TYPE struct cRGB
34#endif
35
36
37/*
38 * Structure of the LED array
39 *
40 * cRGB: RGB for WS2812S/B/C/D, SK6812, SK6812Mini, SK6812WWA, APA104, APA106
41 * cRGBW: RGBW for SK6812RGBW
42 */
43
44struct cRGB { uint8_t g; uint8_t r; uint8_t b; };
45struct cRGBW { uint8_t g; uint8_t r; uint8_t b; uint8_t w;};
46
47#endif