统一指示灯
This commit is contained in:
1 parent
af4f0edc08
commit
32a3a87ef2
7 files changed
+292
-11
No files matched your search
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* @file rgb.h
|
||||
* @brief 单颗 WS2812 RGB LED 控制 (RMT)
|
||||
*
|
||||
* 使用 RMT 外设驱动一颗 WS2812 / SK6812 等可寻址 RGB LED。
|
||||
* 提供 RGB 直接设色与 HSV 设色, 调用即刷新, 无需手动 flush。
|
||||
*/
|
||||
|
||||
#ifndef RGB_H
|
||||
#define RGB_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief 初始化 RGB LED
|
||||
* @param gpio 数据引脚编号
|
||||
*/
|
||||
void rgb_init(int gpio);
|
||||
|
||||
/**
|
||||
* @brief 设置 RGB 颜色 (立即生效)
|
||||
* @param r 红色 0~255
|
||||
* @param g 绿色 0~255
|
||||
* @param b 蓝色 0~255
|
||||
*/
|
||||
void rgb_set(uint8_t r, uint8_t g, uint8_t b);
|
||||
|
||||
/**
|
||||
* @brief 以 HSV 色彩设置颜色 (立即生效)
|
||||
* @param h 色相 0~359
|
||||
* @param s 饱和度 0~100
|
||||
* @param v 明度 0~100
|
||||
*/
|
||||
void rgb_set_hsv(uint16_t h, uint8_t s, uint8_t v);
|
||||
|
||||
/**
|
||||
* @brief 熄灭 LED
|
||||
*/
|
||||
void rgb_off(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* RGB_H */
|
||||
Reference in new issue
Block a user