From a40997aa12029f24ef0904d9af6415c975c4322f Mon Sep 17 00:00:00 2001
From: guowenxue <guowenxue@gmail.com>
Date: Tue, 07 Jul 2026 23:17:44 +0800
Subject: [PATCH] Add ex1.ws2812b example code

---
 ex1.ws2812b/Board/ws2812b.h |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/ex1.ws2812b/Board/ws2812b.h b/ex1.ws2812b/Board/ws2812b.h
new file mode 100644
index 0000000..2f48bb5
--- /dev/null
+++ b/ex1.ws2812b/Board/ws2812b.h
@@ -0,0 +1,55 @@
+/**********************************************************************
+ *   Copyright: (C)2024 LingYun IoT System Studio
+ *      Author: GuoWenxue<guowenxue@gmail.com>
+ *
+ * Description: WS2812B strip lights driver on ISKBoard
+ *
+ * Reference  : https://blog.csdn.net/Lennon8_8/article/details/108980808
+ *
+ *   ChangeLog:
+ *        Version    Date       Author            Description
+ *        V1.0.0  2024.08.29    GuoWenxue      Release initial version
+ *
+ ***********************************************************************/
+
+#ifndef __WS2812B_H_
+#define __WS2812B_H_
+
+#include "stm32l4xx_hal.h"
+
+#define WS2812_NUM  3
+
+#define PIXEL_OFF     0          /* off   */
+#define PIXEL_B       (0xFF<<0)  /* blue  */
+#define PIXEL_R       (0xFF<<8)  /* red   */
+#define PIXEL_G       (0xFF<<16) /* green */
+#define PIXEL_W       (0xFFFFFF) /* white */
+
+/* Composition of 24 bits data: GRB888
+ * +----+----+----+----+----+----+----+----+----+
+ * | G7 | ...| G0 | R7 | ...| R0 | B7 | ...| B0 |
+ * +----+----+----+----+----+----+----+----+----+
+ */
+typedef struct pixel_s
+{
+    uint32_t    blue:8;
+    uint32_t    red:8;
+    uint32_t    green:8;
+} pixel_t;
+
+typedef union color_u
+{
+    pixel_t    pixel;
+    uint32_t   data;
+} color_t;
+
+
+extern void ws2812b_init(void);
+
+extern void ws2812b_reset(void);
+
+extern int ws2812b_turn(int which, color_t color);
+
+extern void ws2812b_blink(void);
+
+#endif /* __WS2812B_H_ */

--
Gitblit v1.10.0