ebe62c5284
- 在 CMakeLists.txt 中添加 boot_button.c 源文件以支持启动按钮功能 - 新增 ui_handlers.c 和 ui_handlers.h,处理 UI 事件并初始化启动按钮 - 实现 boot_button.c,配置 GPIO 中断和任务以响应启动按钮按下事件 - 更新 board_config.h,定义启动按钮的 GPIO 引脚
48 lines
842 B
C
48 lines
842 B
C
#include "ui_handlers.h"
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "boot_button.h"
|
|
#include "lvgl_port.h"
|
|
#include "ui.h"
|
|
#include "ui_events.h"
|
|
|
|
static bool s_showing_screen1;
|
|
|
|
static void ui_toggle_screen(void)
|
|
{
|
|
lvgl_port_lock();
|
|
if (s_showing_screen1) {
|
|
_ui_screen_change(&ui_Screen2, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, ui_Screen2_screen_init);
|
|
} else {
|
|
_ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_FADE_ON, 200, 0, ui_Screen1_screen_init);
|
|
}
|
|
s_showing_screen1 = !s_showing_screen1;
|
|
lvgl_port_unlock();
|
|
}
|
|
|
|
void ui_handlers_init(void)
|
|
{
|
|
boot_button_init(ui_toggle_screen);
|
|
}
|
|
|
|
void update_year_action(lv_event_t * e)
|
|
{
|
|
(void)e;
|
|
}
|
|
|
|
void click_button_two(lv_event_t * e)
|
|
{
|
|
(void)e;
|
|
}
|
|
|
|
void click_button_three(lv_event_t * e)
|
|
{
|
|
(void)e;
|
|
}
|
|
|
|
void click_button_one(lv_event_t * e)
|
|
{
|
|
(void)e;
|
|
}
|