添加了完整的LED效果系统架构,包括: - 新增主题颜色定义文件theme_color.h - 实现key fade LED效果算法,支持按键触发的渐变效果 - 创建LED效果注册机制和通用接口 - 配置17个LED像素与按键映射关系 - 将原有简单的周期性效果替换为基于按键事件的动态效果 CMakeLists.txt中添加了新的源文件路径和实现文件。 BREAKING CHANGE: LED效果从固定的周期性变化改为响应按键事件的动态效果。
28 lines
521 B
C
28 lines
521 B
C
#include <stddef.h>
|
|
|
|
#include "led_effect.h"
|
|
|
|
extern struct led_effect led_effect_key_fade;
|
|
|
|
static struct led_effect *const effect_registry[LED_EFFECT_ID_COUNT] = {
|
|
[LED_EFFECT_ID_KEY_FADE] = &led_effect_key_fade,
|
|
};
|
|
|
|
const struct led_effect *led_effect_get(enum led_effect_id id)
|
|
{
|
|
if (id >= LED_EFFECT_ID_COUNT) {
|
|
return NULL;
|
|
}
|
|
|
|
return effect_registry[id];
|
|
}
|
|
|
|
struct led_effect *led_effect_get_mutable(enum led_effect_id id)
|
|
{
|
|
if (id >= LED_EFFECT_ID_COUNT) {
|
|
return NULL;
|
|
}
|
|
|
|
return effect_registry[id];
|
|
}
|