UP 优化key库

This commit is contained in:
JiXieShi
2024-06-23 14:14:35 +08:00
parent 8bf40f0d9c
commit 58afcd9d81
3 changed files with 16 additions and 21 deletions

View File

@@ -56,14 +56,15 @@ struct Key_List {
void key_init(Key_t *key, uint8_t(*pin_level)(uint8_t), uint8_t active_level, uint8_t key_id);
/**
* @brief 绑定按键事件回调函数
* @param key: [输入] 指向按键结构体指针
* @brief 为按键设置回调函数
* @param key: [输入] 按键结构体指针
* @param event: [输入] 按键事件类型
* @param cb: [输入] 按键事件回调函数
* @param cb: [输入] 回调函数指针
* @param start: [输入] 是否立即启用
* @return void
* @example key_attach(&my_key, PRESS_DOWN, key_press_callback);
*/
void key_attach(Key_t *key, PressEvent event, Key_Callback_t cb);
* @example key_attach(&my_key, PRESS_EVENT_LONG_PRESS, key_callback_func, true);
**/
void key_attach(Key_t *key, PressEvent event, Key_Callback_t cb, bool start);
/**
* @brief 获取按键当前事件