From e7711b3b665c7df0a2a1d7272580cc01be28590d Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Tue, 4 Jun 2019 13:04:30 -0500 Subject: [PATCH] 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 --- drivers/avr/apa102.h | 2 +- drivers/avr/ws2812.h | 2 +- keyboards/cannonkeys/bluepill/ws2812.h | 2 +- keyboards/cannonkeys/stm32f072/ws2812.h | 3 +- keyboards/handwired/promethium/rgbsps.c | 2 +- keyboards/mxss/rgblight.h | 2 +- quantum/color.h | 24 +++++++++++-- quantum/rgblight.h | 2 +- quantum/rgblight_types.h | 47 ------------------------- 9 files changed, 28 insertions(+), 58 deletions(-) delete mode 100644 quantum/rgblight_types.h 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 @@ #include #include -#include "rgblight_types.h" +#include "color.h" /* 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 @@ //#include "ws2812_config.h" //#include "i2cmaster.h" -#include "rgblight_types.h" +#include "quantum/color.h" /* User Interface * 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 @@ #pragma once #include "hal.h" -#include "rgblight_types.h" +#include "color.h" void 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 @@ #pragma once #include "hal.h" -#include "rgblight_types.h" - +#include "color.h" void set_leds_color_rgb(LED_TYPE color); void 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 @@ #include "ws2812.h" #include "rgbsps.h" -struct cRGB led[RGBSPS_NUM]; +cRGB led[RGBSPS_NUM]; void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b) { 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 @@ #ifndef RGBLIGHT_CUSTOM_DRIVER #include "ws2812.h" #endif -#include "rgblight_types.h" +#include "color.h" #include "rgblight_list.h" extern 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 @@ #pragma pack( push, 1 ) #endif +#ifdef RGBW + #define LED_TYPE cRGBW +#else + #define LED_TYPE RGB +#endif + +// WS2812 specific layout typedef struct PACKED { - uint8_t r; uint8_t g; + uint8_t r; uint8_t b; -} RGB; +} cRGB; + +typedef cRGB RGB; + +// WS2812 specific layout +typedef struct PACKED +{ + uint8_t g; + uint8_t r; + uint8_t b; + uint8_t w; +} cRGBW; typedef struct PACKED { @@ -50,6 +68,6 @@ typedef struct PACKED #pragma pack( pop ) #endif -RGB hsv_to_rgb( HSV hsv ); +RGB hsv_to_rgb(HSV hsv); #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 { #ifndef RGBLIGHT_CUSTOM_DRIVER #include "ws2812.h" #endif -#include "rgblight_types.h" +#include "color.h" #include "rgblight_list.h" #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 @@ -/* - * 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 . - */ - -#ifndef RGBLIGHT_TYPES -#define RGBLIGHT_TYPES - -#ifdef __AVR__ - #include -#endif - -#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