ebe62c5284
- 在 CMakeLists.txt 中添加 boot_button.c 源文件以支持启动按钮功能 - 新增 ui_handlers.c 和 ui_handlers.h,处理 UI 事件并初始化启动按钮 - 实现 boot_button.c,配置 GPIO 中断和任务以响应启动按钮按下事件 - 更新 board_config.h,定义启动按钮的 GPIO 引脚
44 lines
984 B
C
44 lines
984 B
C
#include "esp_log.h"
|
|
#include "nvs_flash.h"
|
|
|
|
#include "board_config.h"
|
|
#include "display.h"
|
|
#include "lvgl_port.h"
|
|
#include "touch.h"
|
|
#include "ui.h"
|
|
#include "ui_handlers.h"
|
|
#include "wifi_manager.h"
|
|
|
|
static const char *TAG = "app";
|
|
|
|
void app_main(void)
|
|
{
|
|
esp_log_level_set("*", ESP_LOG_INFO);
|
|
|
|
esp_err_t ret = nvs_flash_init();
|
|
if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) {
|
|
ESP_ERROR_CHECK(nvs_flash_erase());
|
|
ret = nvs_flash_init();
|
|
}
|
|
ESP_ERROR_CHECK(ret);
|
|
|
|
esp_lcd_panel_io_handle_t io_handle = NULL;
|
|
esp_lcd_panel_handle_t panel_handle = NULL;
|
|
ESP_ERROR_CHECK(display_init(&io_handle, &panel_handle));
|
|
|
|
lv_display_t *display = lvgl_port_init(io_handle, panel_handle);
|
|
|
|
#if BOARD_TOUCH_ENABLED
|
|
ESP_ERROR_CHECK(touch_init(display));
|
|
#endif
|
|
|
|
lvgl_port_lock();
|
|
ui_init();
|
|
lvgl_port_unlock();
|
|
|
|
ui_handlers_init();
|
|
|
|
ESP_LOGI(TAG, "Starting WiFi");
|
|
wifi_manager_init();
|
|
}
|