commit b50765e6377eda0b6b4aa292379f8b01e48ae5c0
parent 1f1b153d6f5a25c6929af1562cb9d67b9843007e
Author: Louis Burda <quent.burda@gmail.com>
Date: Thu, 2 Feb 2023 18:05:36 +0100
Fix swapped led color channels
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/ws2812.c b/src/ws2812.c
@@ -39,7 +39,7 @@ ws2812_init(struct ws2812 *pix, PIO pio, uint pin)
void
ws2812_put(struct ws2812 *pix, uint32_t rgb) {
- rgb = ((rgb & 0xFF0000) >> 16) | ((rgb & 0x00FF00) << 8)
- | ((rgb & 0x0000FF) << 8);
+ rgb = ((rgb & 0xFF0000) >> 8) | ((rgb & 0x00FF00) << 8)
+ | (rgb & 0x0000FF);
pio_sm_put_blocking(pix->pio, pix->sm, rgb << 8u);
}