feat(display): 集成LVGL图形库并重构显示模块
- 将display_test_module重命名为display_module - 集成LVGL配置到prj.conf中,包括颜色深度、双缓冲等设置 - 添加UI主界面实现(ui_main.c),包含标题和副标题显示 - 实现背光控制功能替代原有的测试图案绘制 - 调整LCD配置参数(mdac从0x70改为0xA0) - 修改日志级别从DEBUG降至ERROR以优化性能 - 在CMakeLists.txt中添加UI模块源文件引用
This commit is contained in:
34
src/ui/ui_main.c
Normal file
34
src/ui/ui_main.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include "ui_main.h"
|
||||
|
||||
static bool ui_initialized;
|
||||
|
||||
void ui_main_init(void)
|
||||
{
|
||||
lv_obj_t *screen;
|
||||
lv_obj_t *title;
|
||||
lv_obj_t *subtitle;
|
||||
|
||||
if (ui_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
screen = lv_screen_active();
|
||||
lv_obj_set_style_bg_color(screen, lv_color_hex(0x101418), 0);
|
||||
lv_obj_set_style_text_color(screen, lv_color_hex(0xF5F7FA), 0);
|
||||
|
||||
title = lv_label_create(screen);
|
||||
lv_label_set_text(title, "Hello World");
|
||||
lv_obj_set_style_text_font(title, &lv_font_montserrat_14, 0);
|
||||
lv_obj_align(title, LV_ALIGN_CENTER, 0, -10);
|
||||
|
||||
subtitle = lv_label_create(screen);
|
||||
lv_label_set_text(subtitle, "WH Mini Keyboard");
|
||||
lv_obj_set_style_text_opa(subtitle, LV_OPA_70, 0);
|
||||
lv_obj_align(subtitle, LV_ALIGN_CENTER, 0, 14);
|
||||
|
||||
ui_initialized = true;
|
||||
}
|
||||
14
src/ui/ui_main.h
Normal file
14
src/ui/ui_main.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef BLINKY_UI_MAIN_H_
|
||||
#define BLINKY_UI_MAIN_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void ui_main_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BLINKY_UI_MAIN_H_ */
|
||||
Reference in New Issue
Block a user