Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add definition WS2812_BYTE_ORDER to fix RGB LED issues #10184

Merged
merged 12 commits into from
Dec 6, 2020
Prev Previous commit
Next Next commit
update per PR request
  • Loading branch information
hineybush committed Aug 27, 2020
commit 9e06514e91e9d97fb35c6b91582d25da5e3b2c77
2 changes: 1 addition & 1 deletion docs/ws2812_driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Without correction, this causes the two internal LEDs to swap colors and display
The default setting GRB allows other addressable LEDs to work properly with the correct byte structure (G[7-0]R[7-0]G[7-0]), however the WS2812B-2020 needs the green and red bytes reversed.

```c
#define WS2812_BYTE_ORDER RGB
#define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_RGB
```

hineybush marked this conversation as resolved.
Show resolved Hide resolved
### Bitbang
Expand Down
14 changes: 7 additions & 7 deletions quantum/color.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@
# define LED_TYPE RGB
#endif

#define WS2812_BYTE_ORDER_RGB 0
#define WS2812_BYTE_ORDER_GRB 1

#ifndef WS2812_BYTE_ORDER
// default structure - G[7..0]R[7..0]B[7..0]
// WS2812 specific layout
# define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_GRB
#endif
typedef struct PACKED {
hineybush marked this conversation as resolved.
Show resolved Hide resolved
#if (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_GRB)
uint8_t g;
uint8_t r;
uint8_t b;
} cRGB;
#elif (WS2812_BYTE_ORDER == RGB)
// WS2812B-2020 structure - R[7..0]G[7..0]B[7..0]
typedef struct PACKED {
#elif (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_RGB)
uint8_t r;
uint8_t g;
uint8_t b;
} cRGB;
#endif
} cRGB;
typedef cRGB RGB;
hineybush marked this conversation as resolved.
Show resolved Hide resolved

// WS2812 specific layout
Expand Down