feat: 实现事件驱动应用框架,支持前台/后台分离、事件优先级和CPU占用控制

This commit is contained in:
2026-07-10 11:30:48 +08:00
parent 00c00fb60e
commit b4fabf85b5
11 changed files with 2487 additions and 541 deletions

33
App/event.h Normal file
View File

@@ -0,0 +1,33 @@
#ifndef __EVENT_H__
#define __EVENT_H__
#include "config.h"
/* =========================================================================
* 事件队列模块接口声明
* ========================================================================= */
// 初始化事件队列
void EventQueue_Init(void);
// 将事件推入队列(非阻塞)
// 返回值1-成功0-队列已满
bit EventQueue_Push(SystemEvent evt);
// 从队列头部弹出一个事件
// 返回值:事件结构体,若队列为空则 key_event 为 KEY_EVENT_NONE
SystemEvent EventQueue_Pop(void);
// 判断队列是否为空
bit EventQueue_IsEmpty(void);
// 判断队列是否已满
bit EventQueue_IsFull(void);
// 获取队列中事件数量
u8 EventQueue_GetCount(void);
// 紧急事件直通函数:跳过队列直接发送给应用层
void EventQueue_EmergencyDispatch(SystemEvent evt);
#endif