summaryrefslogtreecommitdiff
path: root/quantum/color.h
diff options
context:
space:
mode:
authorRyan <fauxpark@gmail.com>2023-09-04 10:19:59 +1000
committerGitHub <noreply@github.com>2023-09-04 01:19:59 +0100
commit41bd4e35a09cc50f45112074d2b776254a3a17f8 (patch)
tree9258c5ad40dda232e3b8271942b436bdafa6f115 /quantum/color.h
parent1e3095f9cce45fab0a566e692b1ff1c2047cfa08 (diff)
Clean up RGB LED type (#21859)
Diffstat (limited to 'quantum/color.h')
-rw-r--r--quantum/color.h37
1 files changed, 8 insertions, 29 deletions
diff --git a/quantum/color.h b/quantum/color.h
index 135ad623b5..a0414a291f 100644
--- a/quantum/color.h
+++ b/quantum/color.h
@@ -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 rgb_led_t RGB;
-typedef struct PACKED {
+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