Clean up RGB LED type (#21859)
This commit is contained in:
parent
1e3095f9cc
commit
41bd4e35a0
63 changed files with 222 additions and 243 deletions
|
@ -83,12 +83,6 @@
|
|||
# pragma pack(push, 1)
|
||||
#endif
|
||||
|
||||
#ifdef RGBW
|
||||
# define LED_TYPE cRGBW
|
||||
#else
|
||||
# define LED_TYPE RGB
|
||||
#endif
|
||||
|
||||
#define WS2812_BYTE_ORDER_RGB 0
|
||||
#define WS2812_BYTE_ORDER_GRB 1
|
||||
#define WS2812_BYTE_ORDER_BGR 2
|
||||
|
@ -97,26 +91,7 @@
|
|||
# define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_GRB
|
||||
#endif
|
||||
|
||||
typedef struct PACKED {
|
||||
#if (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_GRB)
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
uint8_t b;
|
||||
#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_RGB)
|
||||
uint8_t r;
|
||||
uint8_t g;
|
||||
uint8_t b;
|
||||
#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_BGR)
|
||||
uint8_t b;
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
#endif
|
||||
} cRGB;
|
||||
|
||||
typedef cRGB RGB;
|
||||
|
||||
// WS2812 specific layout
|
||||
typedef struct PACKED {
|
||||
typedef struct PACKED rgb_led_t {
|
||||
#if (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_GRB)
|
||||
uint8_t g;
|
||||
uint8_t r;
|
||||
|
@ -130,10 +105,14 @@ typedef struct PACKED {
|
|||
uint8_t g;
|
||||
uint8_t r;
|
||||
#endif
|
||||
#ifdef RGBW
|
||||
uint8_t w;
|
||||
} cRGBW;
|
||||
#endif
|
||||
} rgb_led_t;
|
||||
|
||||
typedef struct PACKED {
|
||||
typedef rgb_led_t RGB;
|
||||
|
||||
typedef struct PACKED HSV {
|
||||
uint8_t h;
|
||||
uint8_t s;
|
||||
uint8_t v;
|
||||
|
@ -146,5 +125,5 @@ typedef struct PACKED {
|
|||
RGB hsv_to_rgb(HSV hsv);
|
||||
RGB hsv_to_rgb_nocie(HSV hsv);
|
||||
#ifdef RGBW
|
||||
void convert_rgb_to_rgbw(LED_TYPE *led);
|
||||
void convert_rgb_to_rgbw(rgb_led_t *led);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue