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
This commit is contained in:
XScorpion2 2019-06-04 13:04:30 -05:00 committed by MechMerlin
parent 661a9154ae
commit e7711b3b66
9 changed files with 28 additions and 58 deletions

View file

@ -25,7 +25,7 @@
#include <avr/io.h> #include <avr/io.h>
#include <avr/interrupt.h> #include <avr/interrupt.h>
#include "rgblight_types.h" #include "color.h"
/* User Interface /* User Interface

View file

@ -28,7 +28,7 @@
//#include "ws2812_config.h" //#include "ws2812_config.h"
//#include "i2cmaster.h" //#include "i2cmaster.h"
#include "rgblight_types.h" #include "quantum/color.h"
/* User Interface /* User Interface
* *

View file

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "hal.h" #include "hal.h"
#include "rgblight_types.h" #include "color.h"
void set_leds_color_rgb(LED_TYPE color); void set_leds_color_rgb(LED_TYPE color);

View file

@ -1,8 +1,7 @@
#pragma once #pragma once
#include "hal.h" #include "hal.h"
#include "rgblight_types.h" #include "color.h"
void set_leds_color_rgb(LED_TYPE color); void set_leds_color_rgb(LED_TYPE color);
void set_led_color_rgb(LED_TYPE color, int pos); void set_led_color_rgb(LED_TYPE color, int pos);

View file

@ -1,7 +1,7 @@
#include "ws2812.h" #include "ws2812.h"
#include "rgbsps.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) { void rgbsps_set(uint8_t index, uint8_t r, uint8_t g, uint8_t b) {
led[index].r = r; led[index].r = r;

View file

@ -73,7 +73,7 @@
#ifndef RGBLIGHT_CUSTOM_DRIVER #ifndef RGBLIGHT_CUSTOM_DRIVER
#include "ws2812.h" #include "ws2812.h"
#endif #endif
#include "rgblight_types.h" #include "color.h"
#include "rgblight_list.h" #include "rgblight_list.h"
extern LED_TYPE led[RGBLED_NUM]; extern LED_TYPE led[RGBLED_NUM];

View file

@ -32,12 +32,30 @@
#pragma pack( push, 1 ) #pragma pack( push, 1 )
#endif #endif
#ifdef RGBW
#define LED_TYPE cRGBW
#else
#define LED_TYPE RGB
#endif
// WS2812 specific layout
typedef struct PACKED typedef struct PACKED
{ {
uint8_t r;
uint8_t g; uint8_t g;
uint8_t r;
uint8_t b; 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 typedef struct PACKED
{ {
@ -50,6 +68,6 @@ typedef struct PACKED
#pragma pack( pop ) #pragma pack( pop )
#endif #endif
RGB hsv_to_rgb( HSV hsv ); RGB hsv_to_rgb(HSV hsv);
#endif // COLOR_H #endif // COLOR_H

View file

@ -132,7 +132,7 @@ enum RGBLIGHT_EFFECT_MODE {
#ifndef RGBLIGHT_CUSTOM_DRIVER #ifndef RGBLIGHT_CUSTOM_DRIVER
#include "ws2812.h" #include "ws2812.h"
#endif #endif
#include "rgblight_types.h" #include "color.h"
#include "rgblight_list.h" #include "rgblight_list.h"
#if defined(__AVR__) #if defined(__AVR__)

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#ifndef RGBLIGHT_TYPES
#define RGBLIGHT_TYPES
#ifdef __AVR__
#include <avr/io.h>
#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