feat(caf): 集成事件管理器并配置CAF模块
- 在prj.conf中启用CAF、堆内存池和日志配置 - 替换kernel头文件为应用事件管理器相关头文件 - 添加模块状态事件支持用于报告就绪状态 - 初始化应用事件管理器并在初始化失败时记录错误
This commit is contained in:
14
src/main.c
14
src/main.c
@@ -1,6 +1,18 @@
|
|||||||
#include <zephyr/kernel.h>
|
#include <app_event_manager.h>
|
||||||
|
|
||||||
|
#define MODULE main
|
||||||
|
#include <caf/events/module_state_event.h>
|
||||||
|
|
||||||
|
#include <zephyr/logging/log.h>
|
||||||
|
LOG_MODULE_REGISTER(MODULE);
|
||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
|
if (app_event_manager_init()) {
|
||||||
|
LOG_ERR("Application Event Manager not initialized");
|
||||||
|
} else {
|
||||||
|
module_set_state(MODULE_STATE_READY);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user