aboutsummaryrefslogtreecommitdiffstats
path: root/src/ws2812.h
diff options
context:
space:
mode:
authorLouis Burda <quent.burda@gmail.com>2023-01-28 23:35:59 +0100
committerLouis Burda <quent.burda@gmail.com>2023-01-28 23:35:59 +0100
commita08ae9e31873a094a5e7d47ae8cfd2edfe6a60a4 (patch)
tree9c9075631e97c21e255c3f964072fc2da412440b /src/ws2812.h
parentc70a527d0418b4f32437873f682680f451fa4fb8 (diff)
downloadsxkbd-a08ae9e31873a094a5e7d47ae8cfd2edfe6a60a4.tar.gz
sxkbd-a08ae9e31873a094a5e7d47ae8cfd2edfe6a60a4.zip
Add led blips for warnings and on startup
Diffstat (limited to 'src/ws2812.h')
-rw-r--r--src/ws2812.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ws2812.h b/src/ws2812.h
index 3a0cf5c..8c878ff 100644
--- a/src/ws2812.h
+++ b/src/ws2812.h
@@ -5,9 +5,9 @@
#include <stdbool.h>
-#define _WS2812_U8(v, s) (((uint32_t) (v) & 0xFF) << s)
-#define WS2812_U32RGB(r, g, b) \
- (_WS2812_U8(b, 0) | _WS2812_U8(r, 8) | _WS2812_U8(g, 16))
+#define _WS2812_U8(v, si, so) ((((uint32_t) (v) >> si) & 0xFF) << so)
+#define WS2812_U32RGB(rgb) (_WS2812_U8(rgb, 16, 0) \
+ | _WS2812_U8(rgb, 0, 8) | _WS2812_U8(rgb, 8, 16))
struct ws2812 {
PIO pio;