721 lines
31 KiB
C
721 lines
31 KiB
C
|
|
#include "app_ui.h"
|
||
|
|
|
||
|
|
|
||
|
|
static void Create_Sine_wave(lv_event_t * e);
|
||
|
|
static void Create_Square_wave(lv_event_t * e);
|
||
|
|
|
||
|
|
|
||
|
|
LV_FONT_DECLARE(font_alipuhui20);
|
||
|
|
|
||
|
|
lv_obj_t * main_obj; // 主界面
|
||
|
|
lv_obj_t * main_text_label; // 主界面 欢迎语
|
||
|
|
lv_obj_t * icon_in_obj; // 应用界面
|
||
|
|
int icon_flag; // 标记现在进入哪个应用 在主界面时为0
|
||
|
|
lv_obj_t * sure_in_obj;
|
||
|
|
lv_timer_t * my_lv_timer;
|
||
|
|
int roller_flag;
|
||
|
|
|
||
|
|
|
||
|
|
// 全局变量,用于存储当前选择的参数名称和数值
|
||
|
|
static const char * selected_param_name;
|
||
|
|
static const char * selected_param_value;
|
||
|
|
// 全局变量用于保存当前界面信息
|
||
|
|
lv_obj_t * main_screen, * param_screen, * adjust_screen;
|
||
|
|
lv_obj_t * value_roller;
|
||
|
|
const char *default_value = "0"; // 示例声明
|
||
|
|
|
||
|
|
// 定义全局变量存储参数值
|
||
|
|
#define PARAM_VALUE_SIZE 25 // 定义缓冲区大小
|
||
|
|
char amplitude[PARAM_VALUE_SIZE] = "002.11"; // 幅度
|
||
|
|
char frequency[PARAM_VALUE_SIZE] = "003.22"; // 频率
|
||
|
|
char offset[PARAM_VALUE_SIZE] = "300.00"; // 偏置
|
||
|
|
static char temp1[5], temp2[5], temp3[5], temp4[5], temp5[5];
|
||
|
|
int values[5]; // 存储分解后的数字
|
||
|
|
lv_obj_t *rollers[5]; // 存储滚轮对象
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
// 滚轮事件回调
|
||
|
|
static void roller_event_handler(lv_event_t *e) {
|
||
|
|
|
||
|
|
// 从每个滚轮中获取选中的值
|
||
|
|
lv_roller_get_selected_str(rollers[0], temp1, sizeof(temp1));
|
||
|
|
lv_roller_get_selected_str(rollers[1], temp2, sizeof(temp2));
|
||
|
|
lv_roller_get_selected_str(rollers[2], temp3, sizeof(temp3));
|
||
|
|
lv_roller_get_selected_str(rollers[3], temp4, sizeof(temp4));
|
||
|
|
lv_roller_get_selected_str(rollers[4], temp5, sizeof(temp5));
|
||
|
|
|
||
|
|
|
||
|
|
// 根据点击的参数显示对应的调节界面
|
||
|
|
if (roller_flag == 1) {
|
||
|
|
snprintf(amplitude, PARAM_VALUE_SIZE, "%s%s%s.%s%s", temp1, temp2, temp3, temp4, temp5);
|
||
|
|
}
|
||
|
|
else if (roller_flag == 2) {
|
||
|
|
snprintf(frequency, PARAM_VALUE_SIZE, "%s%s%s.%s%s", temp1, temp2, temp3, temp4, temp5);
|
||
|
|
} else if (roller_flag == 3) {
|
||
|
|
snprintf(offset, PARAM_VALUE_SIZE, "%s%s%s.%s%s", temp1, temp2, temp3, temp4, temp5);
|
||
|
|
}
|
||
|
|
//snprintf(amplitude, PARAM_VALUE_SIZE, "%s%s%s.%s%s", temp1, temp2, temp3, temp4, temp5);
|
||
|
|
// 确保拼接的字符串不会超出 param_value 的大小
|
||
|
|
}
|
||
|
|
|
||
|
|
void back_event_handler(lv_event_t * e) {
|
||
|
|
lv_obj_del(sure_in_obj);
|
||
|
|
lv_obj_del(icon_in_obj);
|
||
|
|
// Create_Sine_wave(icon_in_obj); // 已禁用显示屏功能
|
||
|
|
}
|
||
|
|
|
||
|
|
// 参数行点击事件处理函数
|
||
|
|
void rollers_event_handler(lv_event_t * e) {
|
||
|
|
// 滚轮选项
|
||
|
|
const char *digit_options = "0\n1\n2\n3\n4\n5\n6\n7\n8\n9";
|
||
|
|
// 创建一个界面对象
|
||
|
|
static lv_style_t style;
|
||
|
|
lv_style_init(&style);
|
||
|
|
lv_style_set_radius(&style, 10);
|
||
|
|
lv_style_set_bg_opa(&style, LV_OPA_COVER);
|
||
|
|
lv_style_set_bg_color(&style, lv_color_hex(0x003366));
|
||
|
|
lv_style_set_bg_grad_color(&style, lv_color_hex(0x00BF00));
|
||
|
|
lv_style_set_bg_grad_dir(&style, LV_GRAD_DIR_VER);
|
||
|
|
lv_style_set_border_width(&style, 0);
|
||
|
|
lv_style_set_pad_all(&style, 0);
|
||
|
|
lv_style_set_width(&style, 320);
|
||
|
|
lv_style_set_height(&style, 240);
|
||
|
|
|
||
|
|
sure_in_obj = lv_obj_create(lv_scr_act());
|
||
|
|
lv_obj_add_style(sure_in_obj, &style, 0);
|
||
|
|
lv_obj_set_size(sure_in_obj, 320, 240); // 设置容器大小为屏幕大小
|
||
|
|
lv_obj_center(sure_in_obj); // 居中显示
|
||
|
|
|
||
|
|
// 标题
|
||
|
|
lv_obj_t * title = lv_label_create(sure_in_obj);
|
||
|
|
lv_obj_set_style_text_font(title, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(title, selected_param_name);
|
||
|
|
lv_obj_set_style_text_color(title, lv_color_hex(0xFFFFFF), 0);
|
||
|
|
lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 10);
|
||
|
|
|
||
|
|
for (int i = 0; i < 5; i++) {
|
||
|
|
rollers[i] = lv_roller_create(sure_in_obj);
|
||
|
|
lv_roller_set_options(rollers[i], digit_options, LV_ROLLER_MODE_INFINITE);
|
||
|
|
lv_roller_set_visible_row_count(rollers[i], 1);
|
||
|
|
lv_obj_set_width(rollers[i], 50);
|
||
|
|
lv_obj_align(rollers[i], LV_ALIGN_CENTER, -120 + i*60, 0);
|
||
|
|
lv_roller_set_selected(rollers[i], values[i], LV_ANIM_OFF);
|
||
|
|
}
|
||
|
|
// 创建小数点
|
||
|
|
lv_obj_t *circle = lv_obj_create(sure_in_obj); // 创建一个对象
|
||
|
|
lv_obj_set_size(circle, 5, 5); // 设置大小,宽高相等模拟圆点
|
||
|
|
lv_obj_set_style_radius(circle, LV_RADIUS_CIRCLE, 0); // 设置为圆形
|
||
|
|
lv_obj_set_style_bg_color(circle, lv_color_hex(0xFFFFFF), 0); // 设置背景颜色
|
||
|
|
lv_obj_align(circle, LV_ALIGN_CENTER, 30, 0);
|
||
|
|
// 为每个滚轮添加事件回调
|
||
|
|
for (int i = 0; i < 5; i++) {
|
||
|
|
lv_obj_add_event_cb(rollers[i], roller_event_handler, LV_EVENT_VALUE_CHANGED, rollers);
|
||
|
|
}
|
||
|
|
|
||
|
|
// 确定按钮
|
||
|
|
lv_obj_t * confirm_btn = lv_btn_create(sure_in_obj);
|
||
|
|
lv_obj_set_size(confirm_btn, 80, 40);
|
||
|
|
lv_obj_align(confirm_btn, LV_ALIGN_BOTTOM_MID, 0, -20);
|
||
|
|
|
||
|
|
lv_obj_t * label = lv_label_create(confirm_btn);
|
||
|
|
lv_obj_set_style_text_font(label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(label, "确定");
|
||
|
|
lv_obj_center(label);
|
||
|
|
|
||
|
|
// 点击参数时返回
|
||
|
|
lv_obj_add_event_cb(confirm_btn, back_event_handler, LV_EVENT_CLICKED, NULL);
|
||
|
|
}
|
||
|
|
|
||
|
|
//参数点击事件回调
|
||
|
|
static void param_event_handler(lv_event_t *e) {
|
||
|
|
lv_obj_t * row = lv_event_get_target(e); // 获取触发事件的对象
|
||
|
|
lv_obj_t * param_label = lv_obj_get_child(row, 0); // 获取参数名称的标签
|
||
|
|
lv_obj_t * value_label = lv_obj_get_child(row, 1); // 获取参数值的标签
|
||
|
|
roller_flag=0;
|
||
|
|
// 获取参数名称和值
|
||
|
|
selected_param_name = lv_label_get_text(param_label);
|
||
|
|
selected_param_value = lv_label_get_text(value_label);
|
||
|
|
// 根据点击的参数显示对应的调节界面
|
||
|
|
if (strcmp(selected_param_name, "幅度/mV") == 0) {
|
||
|
|
roller_flag=1;
|
||
|
|
int j = 0;
|
||
|
|
for (int i = 0; i < strlen(amplitude); i++) {
|
||
|
|
if (amplitude[i] != '.') { // 只提取数字部分
|
||
|
|
values[j++] = amplitude[i] - '0'; // 将字符转换为数字
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// rollers_event_handler(icon_in_obj); // 已禁用显示屏功能
|
||
|
|
}
|
||
|
|
else if (strcmp(selected_param_name, "频率/Hz") == 0) {
|
||
|
|
roller_flag=2;
|
||
|
|
int j = 0;
|
||
|
|
for (int i = 0; i < strlen(frequency); i++) {
|
||
|
|
if (frequency[i] != '.') { // 只提取数字部分
|
||
|
|
values[j++] = frequency[i] - '0'; // 将字符转换为数字
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// rollers_event_handler(icon_in_obj); // 已禁用显示屏功能
|
||
|
|
} else if (strcmp(selected_param_name, "偏置/mV") == 0) {
|
||
|
|
roller_flag=3;
|
||
|
|
int j = 0;
|
||
|
|
for (int i = 0; i < strlen(offset); i++) {
|
||
|
|
if (offset[i] != '.') { // 只提取数字部分
|
||
|
|
values[j++] = offset[i] - '0'; // 将字符转换为数字
|
||
|
|
}
|
||
|
|
}
|
||
|
|
// rollers_event_handler(icon_in_obj); // 已禁用显示屏功能
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/******************************** 第1个图标 正常心电 应用程序*************************************************************************************/
|
||
|
|
lv_obj_t * ned_label;
|
||
|
|
lv_obj_t * ned_back;
|
||
|
|
static void ned_back_cb(lv_event_t * e)
|
||
|
|
{
|
||
|
|
lv_obj_del(icon_in_obj); // 删除画布
|
||
|
|
icon_flag = 0;
|
||
|
|
}
|
||
|
|
static void Normal_electrocardiogram(lv_event_t * e)
|
||
|
|
{
|
||
|
|
// 创建一个界面对象
|
||
|
|
static lv_style_t style;
|
||
|
|
lv_style_init(&style);
|
||
|
|
lv_style_set_radius(&style, 10);
|
||
|
|
lv_style_set_bg_opa( &style, LV_OPA_COVER );
|
||
|
|
lv_style_set_bg_color(&style, lv_color_hex(0xffffff));
|
||
|
|
lv_style_set_border_width(&style, 0);
|
||
|
|
lv_style_set_pad_all(&style, 0);
|
||
|
|
lv_style_set_width(&style, 320);
|
||
|
|
lv_style_set_height(&style, 240);
|
||
|
|
icon_in_obj = lv_obj_create(lv_scr_act());
|
||
|
|
lv_obj_add_style(icon_in_obj, &style, 0);
|
||
|
|
// 创建标题背景
|
||
|
|
lv_obj_t *ned_title = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(ned_title, 320, 40);
|
||
|
|
lv_obj_set_style_pad_all(ned_title, 0, 0); // 设置间隙
|
||
|
|
lv_obj_align(ned_title, LV_ALIGN_TOP_LEFT, 0, 0);
|
||
|
|
lv_obj_set_style_bg_color(ned_title, lv_color_hex(0xb87fa8), 0);
|
||
|
|
// 显示标题
|
||
|
|
ned_label = lv_label_create(ned_title);
|
||
|
|
lv_label_set_text(ned_label, "正常心电");
|
||
|
|
lv_obj_set_style_text_color(ned_label, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_set_style_text_font(ned_label, &font_alipuhui20, 0);
|
||
|
|
lv_obj_align(ned_label, LV_ALIGN_CENTER, 0, 0);
|
||
|
|
// 创建后退按钮
|
||
|
|
ned_back = lv_btn_create(ned_title);
|
||
|
|
lv_obj_align(ned_back, LV_ALIGN_LEFT_MID, 0, 0);
|
||
|
|
lv_obj_set_size(ned_back, 60, 40);
|
||
|
|
lv_obj_set_style_border_width(ned_back, 0, 0); // 设置边框宽度
|
||
|
|
lv_obj_set_style_pad_all(ned_back, 0, 0); // 设置间隙
|
||
|
|
lv_obj_set_style_bg_opa(ned_back, LV_OPA_COVER, LV_PART_MAIN); // 背景可见
|
||
|
|
lv_obj_set_style_bg_color(ned_back, lv_color_hex(0x006600), LV_PART_MAIN); // 设置按钮背景为绿色
|
||
|
|
lv_obj_set_style_shadow_opa(ned_back, LV_OPA_TRANSP, LV_PART_MAIN); // 阴影透明
|
||
|
|
lv_obj_add_event_cb(ned_back, ned_back_cb, LV_EVENT_CLICKED, NULL); // 添加按键处理函数
|
||
|
|
|
||
|
|
lv_obj_t *label_back = lv_label_create(ned_back);
|
||
|
|
lv_label_set_text(label_back, LV_SYMBOL_LEFT); // 按键上显示左箭头符号
|
||
|
|
lv_obj_set_style_text_font(label_back, &lv_font_montserrat_20, 0);
|
||
|
|
lv_obj_set_style_text_color(label_back, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_align(label_back, LV_ALIGN_CENTER, -10, 0);
|
||
|
|
|
||
|
|
// 参数数组
|
||
|
|
const char * param_names[] = {"幅度/mV", "频率/Hz", "偏置/mV"};
|
||
|
|
const char *param_values[] = {amplitude, frequency, offset};
|
||
|
|
// 循环创建参数显示
|
||
|
|
for (int i = 0; i < 3; i++) {
|
||
|
|
// 创建参数行容器
|
||
|
|
lv_obj_t * param_row = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(param_row, 200, 40);
|
||
|
|
lv_obj_align(param_row, LV_ALIGN_TOP_MID, 0, 50 + i * 50);
|
||
|
|
|
||
|
|
// 设置参数名称
|
||
|
|
lv_obj_t * param_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(param_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(param_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(param_label, param_names[i]);
|
||
|
|
lv_obj_align(param_label, LV_ALIGN_LEFT_MID, 10, 0);
|
||
|
|
|
||
|
|
// 设置参数值
|
||
|
|
lv_obj_t * value_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(value_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(value_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(value_label, param_values[i]);
|
||
|
|
lv_obj_align(value_label, LV_ALIGN_RIGHT_MID, -10, 0);
|
||
|
|
|
||
|
|
// 点击参数时进入调整界面
|
||
|
|
lv_obj_add_event_cb(param_row, param_event_handler, LV_EVENT_CLICKED, NULL);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/******************************** 第2个图标 正弦波 ******************************************************************************************/
|
||
|
|
lv_obj_t * sine_label;
|
||
|
|
lv_obj_t * sine_back;
|
||
|
|
static void sine_back_cb(lv_event_t * e)
|
||
|
|
{
|
||
|
|
lv_obj_del(icon_in_obj); // 删除画布
|
||
|
|
icon_flag = 0;
|
||
|
|
}
|
||
|
|
static void Create_Sine_wave(lv_event_t * e)
|
||
|
|
{
|
||
|
|
// 创建一个界面对象
|
||
|
|
static lv_style_t style;
|
||
|
|
lv_style_init(&style);
|
||
|
|
lv_style_set_radius(&style, 10);
|
||
|
|
lv_style_set_bg_opa( &style, LV_OPA_COVER );
|
||
|
|
lv_style_set_bg_color(&style, lv_color_hex(0xffffff));
|
||
|
|
lv_style_set_border_width(&style, 0);
|
||
|
|
lv_style_set_pad_all(&style, 0);
|
||
|
|
lv_style_set_width(&style, 320);
|
||
|
|
lv_style_set_height(&style, 240);
|
||
|
|
|
||
|
|
icon_in_obj = lv_obj_create(lv_scr_act());
|
||
|
|
lv_obj_add_style(icon_in_obj, &style, 0);
|
||
|
|
|
||
|
|
// 创建标题背景
|
||
|
|
lv_obj_t *sine_title = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(sine_title, 320, 40);
|
||
|
|
lv_obj_set_style_pad_all(sine_title, 0, 0); // 设置间隙
|
||
|
|
lv_obj_align(sine_title, LV_ALIGN_TOP_LEFT, 0, 0);
|
||
|
|
lv_obj_set_style_bg_color(sine_title, lv_color_hex(0xb87fa8), 0);
|
||
|
|
// 显示标题
|
||
|
|
sine_label = lv_label_create(sine_title);
|
||
|
|
lv_label_set_text(sine_label, "正弦波");
|
||
|
|
lv_obj_set_style_text_color(sine_label, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_set_style_text_font(sine_label, &font_alipuhui20, 0);
|
||
|
|
lv_obj_align(sine_label, LV_ALIGN_CENTER, 0, 0);
|
||
|
|
|
||
|
|
// 创建后退按钮
|
||
|
|
sine_back = lv_btn_create(sine_title);
|
||
|
|
lv_obj_align(sine_back, LV_ALIGN_LEFT_MID, 0, 0);
|
||
|
|
lv_obj_set_size(sine_back, 60, 40);
|
||
|
|
lv_obj_set_style_border_width(sine_back, 0, 0); // 设置边框宽度
|
||
|
|
lv_obj_set_style_pad_all(sine_back, 0, 0); // 设置间隙
|
||
|
|
lv_obj_set_style_bg_opa(sine_back, LV_OPA_COVER, LV_PART_MAIN); // 背景可见
|
||
|
|
lv_obj_set_style_bg_color(sine_back, lv_color_hex(0x006600), LV_PART_MAIN); // 设置按钮背景为绿色
|
||
|
|
lv_obj_set_style_shadow_opa(sine_back, LV_OPA_TRANSP, LV_PART_MAIN); // 阴影透明
|
||
|
|
lv_obj_add_event_cb(sine_back, sine_back_cb, LV_EVENT_CLICKED, NULL); // 添加按键处理函数
|
||
|
|
|
||
|
|
lv_obj_t *label_back = lv_label_create(sine_back);
|
||
|
|
lv_label_set_text(label_back, LV_SYMBOL_LEFT); // 按键上显示左箭头符号
|
||
|
|
lv_obj_set_style_text_font(label_back, &lv_font_montserrat_20, 0);
|
||
|
|
lv_obj_set_style_text_color(label_back, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_align(label_back, LV_ALIGN_CENTER, -20, 0);
|
||
|
|
|
||
|
|
|
||
|
|
// 参数数组
|
||
|
|
const char * param_names[] = {"幅度/mV", "频率/Hz", "偏置/mV"};
|
||
|
|
const char *param_values[] = {amplitude, frequency, offset};
|
||
|
|
// 循环创建参数显示
|
||
|
|
for (int i = 0; i < 3; i++) {
|
||
|
|
// 创建参数行容器
|
||
|
|
lv_obj_t * param_row = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(param_row, 200, 40);
|
||
|
|
lv_obj_align(param_row, LV_ALIGN_TOP_MID, 0, 50 + i * 50);
|
||
|
|
|
||
|
|
// 设置参数名称
|
||
|
|
lv_obj_t * param_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(param_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(param_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(param_label, param_names[i]);
|
||
|
|
lv_obj_align(param_label, LV_ALIGN_LEFT_MID, 10, 0);
|
||
|
|
|
||
|
|
// 设置参数值
|
||
|
|
lv_obj_t * value_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(value_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(value_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(value_label, param_values[i]);
|
||
|
|
lv_obj_align(value_label, LV_ALIGN_RIGHT_MID, -10, 0);
|
||
|
|
|
||
|
|
// 点击参数时进入调整界面
|
||
|
|
lv_obj_add_event_cb(param_row, param_event_handler, LV_EVENT_CLICKED, NULL);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/******************************** 第3个图标 方波 应用程序******************************************************************************************/
|
||
|
|
lv_obj_t * square_label;
|
||
|
|
lv_obj_t * square_back;
|
||
|
|
static void square_back_cb(lv_event_t * e)
|
||
|
|
{
|
||
|
|
lv_obj_del(icon_in_obj); // 删除画布
|
||
|
|
icon_flag = 0;
|
||
|
|
}
|
||
|
|
static void Create_Square_wave(lv_event_t * e)
|
||
|
|
{
|
||
|
|
// 创建一个界面对象
|
||
|
|
static lv_style_t style;
|
||
|
|
lv_style_init(&style);
|
||
|
|
lv_style_set_radius(&style, 10);
|
||
|
|
lv_style_set_bg_opa( &style, LV_OPA_COVER );
|
||
|
|
lv_style_set_bg_color(&style, lv_color_hex(0xffffff));
|
||
|
|
lv_style_set_border_width(&style, 0);
|
||
|
|
lv_style_set_pad_all(&style, 0);
|
||
|
|
lv_style_set_width(&style, 320);
|
||
|
|
lv_style_set_height(&style, 240);
|
||
|
|
|
||
|
|
icon_in_obj = lv_obj_create(lv_scr_act());
|
||
|
|
lv_obj_add_style(icon_in_obj, &style, 0);
|
||
|
|
|
||
|
|
// 创建标题背景
|
||
|
|
lv_obj_t *sine_title = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(sine_title, 320, 40);
|
||
|
|
lv_obj_set_style_pad_all(sine_title, 0, 0); // 设置间隙
|
||
|
|
lv_obj_align(sine_title, LV_ALIGN_TOP_LEFT, 0, 0);
|
||
|
|
lv_obj_set_style_bg_color(sine_title, lv_color_hex(0xb87fa8), 0);
|
||
|
|
// 显示标题
|
||
|
|
square_label = lv_label_create(sine_title);
|
||
|
|
lv_label_set_text(square_label, "方波");
|
||
|
|
lv_obj_set_style_text_color(square_label, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_set_style_text_font(square_label, &font_alipuhui20, 0);
|
||
|
|
lv_obj_align(square_label, LV_ALIGN_CENTER, 0, 0);
|
||
|
|
|
||
|
|
// 创建后退按钮
|
||
|
|
square_back = lv_btn_create(sine_title);
|
||
|
|
lv_obj_align(square_back, LV_ALIGN_LEFT_MID, 0, 0);
|
||
|
|
lv_obj_set_size(square_back, 60, 40);
|
||
|
|
lv_obj_set_style_border_width(square_back, 0, 0); // 设置边框宽度
|
||
|
|
lv_obj_set_style_pad_all(square_back, 0, 0); // 设置间隙
|
||
|
|
lv_obj_set_style_bg_opa(square_back, LV_OPA_COVER, LV_PART_MAIN); // 背景可见
|
||
|
|
lv_obj_set_style_bg_color(square_back, lv_color_hex(0x006600), LV_PART_MAIN); // 设置按钮背景为绿色
|
||
|
|
lv_obj_set_style_shadow_opa(square_back, LV_OPA_TRANSP, LV_PART_MAIN); // 阴影透明
|
||
|
|
lv_obj_add_event_cb(square_back, square_back_cb, LV_EVENT_CLICKED, NULL); // 添加按键处理函数
|
||
|
|
|
||
|
|
lv_obj_t *label_back = lv_label_create(square_back);
|
||
|
|
lv_label_set_text(label_back, LV_SYMBOL_LEFT); // 按键上显示左箭头符号
|
||
|
|
lv_obj_set_style_text_font(label_back, &lv_font_montserrat_20, 0);
|
||
|
|
lv_obj_set_style_text_color(label_back, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_align(label_back, LV_ALIGN_CENTER, -20, 0);
|
||
|
|
|
||
|
|
|
||
|
|
// 参数数组
|
||
|
|
const char * param_names[] = {"幅度/mV", "频率/Hz", "偏置/mV"};
|
||
|
|
const char *param_values[] = {amplitude, frequency, offset};
|
||
|
|
// 循环创建参数显示
|
||
|
|
for (int i = 0; i < 3; i++) {
|
||
|
|
// 创建参数行容器
|
||
|
|
lv_obj_t * param_row = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(param_row, 200, 40);
|
||
|
|
lv_obj_align(param_row, LV_ALIGN_TOP_MID, 0, 50 + i * 50);
|
||
|
|
|
||
|
|
// 设置参数名称
|
||
|
|
lv_obj_t * param_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(param_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(param_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(param_label, param_names[i]);
|
||
|
|
lv_obj_align(param_label, LV_ALIGN_LEFT_MID, 10, 0);
|
||
|
|
|
||
|
|
// 设置参数值
|
||
|
|
lv_obj_t * value_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(value_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(value_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(value_label, param_values[i]);
|
||
|
|
lv_obj_align(value_label, LV_ALIGN_RIGHT_MID, -10, 0);
|
||
|
|
|
||
|
|
// 点击参数时进入调整界面
|
||
|
|
lv_obj_add_event_cb(param_row, param_event_handler, LV_EVENT_CLICKED, NULL);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/******************************** 第4个图标 三角波 应用程序 ***************************************************************************************/
|
||
|
|
lv_obj_t * triangle_label;
|
||
|
|
lv_obj_t * triangle_back;
|
||
|
|
static void triangle_back_cb(lv_event_t * e)
|
||
|
|
{
|
||
|
|
lv_obj_del(icon_in_obj); // 删除画布
|
||
|
|
icon_flag = 0;
|
||
|
|
}
|
||
|
|
static void Create_Triangle_wave(lv_event_t * e)
|
||
|
|
{
|
||
|
|
// 创建一个界面对象
|
||
|
|
static lv_style_t style;
|
||
|
|
lv_style_init(&style);
|
||
|
|
lv_style_set_radius(&style, 10);
|
||
|
|
lv_style_set_bg_opa( &style, LV_OPA_COVER );
|
||
|
|
lv_style_set_bg_color(&style, lv_color_hex(0xffffff));
|
||
|
|
lv_style_set_border_width(&style, 0);
|
||
|
|
lv_style_set_pad_all(&style, 0);
|
||
|
|
lv_style_set_width(&style, 320);
|
||
|
|
lv_style_set_height(&style, 240);
|
||
|
|
|
||
|
|
icon_in_obj = lv_obj_create(lv_scr_act());
|
||
|
|
lv_obj_add_style(icon_in_obj, &style, 0);
|
||
|
|
|
||
|
|
// 创建标题背景
|
||
|
|
lv_obj_t *sine_title = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(sine_title, 320, 40);
|
||
|
|
lv_obj_set_style_pad_all(sine_title, 0, 0); // 设置间隙
|
||
|
|
lv_obj_align(sine_title, LV_ALIGN_TOP_LEFT, 0, 0);
|
||
|
|
lv_obj_set_style_bg_color(sine_title, lv_color_hex(0xb87fa8), 0);
|
||
|
|
// 显示标题
|
||
|
|
triangle_label = lv_label_create(sine_title);
|
||
|
|
lv_label_set_text(triangle_label, "三角波");
|
||
|
|
lv_obj_set_style_text_color(triangle_label, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_set_style_text_font(triangle_label, &font_alipuhui20, 0);
|
||
|
|
lv_obj_align(triangle_label, LV_ALIGN_CENTER, 0, 0);
|
||
|
|
|
||
|
|
// 创建后退按钮
|
||
|
|
triangle_back = lv_btn_create(sine_title);
|
||
|
|
lv_obj_align(triangle_back, LV_ALIGN_LEFT_MID, 0, 0);
|
||
|
|
lv_obj_set_size(triangle_back, 60, 40);
|
||
|
|
lv_obj_set_style_border_width(triangle_back, 0, 0); // 设置边框宽度
|
||
|
|
lv_obj_set_style_pad_all(triangle_back, 0, 0); // 设置间隙
|
||
|
|
lv_obj_set_style_bg_opa(triangle_back, LV_OPA_COVER, LV_PART_MAIN); // 背景可见
|
||
|
|
lv_obj_set_style_bg_color(triangle_back, lv_color_hex(0x006600), LV_PART_MAIN); // 设置按钮背景为绿色
|
||
|
|
lv_obj_set_style_shadow_opa(triangle_back, LV_OPA_TRANSP, LV_PART_MAIN); // 阴影透明
|
||
|
|
lv_obj_add_event_cb(triangle_back, triangle_back_cb, LV_EVENT_CLICKED, NULL); // 添加按键处理函数
|
||
|
|
|
||
|
|
lv_obj_t *label_back = lv_label_create(triangle_back);
|
||
|
|
lv_label_set_text(label_back, LV_SYMBOL_LEFT); // 按键上显示左箭头符号
|
||
|
|
lv_obj_set_style_text_font(label_back, &lv_font_montserrat_20, 0);
|
||
|
|
lv_obj_set_style_text_color(label_back, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_align(label_back, LV_ALIGN_CENTER, -20, 0);
|
||
|
|
|
||
|
|
|
||
|
|
// 参数数组
|
||
|
|
const char * param_names[] = {"幅度/mV", "频率/Hz", "偏置/mV"};
|
||
|
|
const char *param_values[] = {amplitude, frequency, offset};
|
||
|
|
// 循环创建参数显示
|
||
|
|
for (int i = 0; i < 3; i++) {
|
||
|
|
// 创建参数行容器
|
||
|
|
lv_obj_t * param_row = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(param_row, 200, 40);
|
||
|
|
lv_obj_align(param_row, LV_ALIGN_TOP_MID, 0, 50 + i * 50);
|
||
|
|
|
||
|
|
// 设置参数名称
|
||
|
|
lv_obj_t * param_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(param_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(param_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(param_label, param_names[i]);
|
||
|
|
lv_obj_align(param_label, LV_ALIGN_LEFT_MID, 10, 0);
|
||
|
|
|
||
|
|
// 设置参数值
|
||
|
|
lv_obj_t * value_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(value_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(value_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(value_label, param_values[i]);
|
||
|
|
lv_obj_align(value_label, LV_ALIGN_RIGHT_MID, -10, 0);
|
||
|
|
|
||
|
|
// 点击参数时进入调整界面
|
||
|
|
lv_obj_add_event_cb(param_row, param_event_handler, LV_EVENT_CLICKED, NULL);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/******************************** 第5个图标 异常心电 应用程序**************************************************************************************/
|
||
|
|
lv_obj_t * abecg_label;
|
||
|
|
lv_obj_t * abecg_back;
|
||
|
|
static void abecg_back_cb(lv_event_t * e)
|
||
|
|
{
|
||
|
|
lv_obj_del(icon_in_obj); // 删除画布
|
||
|
|
icon_flag = 0;
|
||
|
|
}
|
||
|
|
static void Create_Abecg_wave(lv_event_t * e)
|
||
|
|
{
|
||
|
|
// 创建一个界面对象
|
||
|
|
static lv_style_t style;
|
||
|
|
lv_style_init(&style);
|
||
|
|
lv_style_set_radius(&style, 10);
|
||
|
|
lv_style_set_bg_opa( &style, LV_OPA_COVER );
|
||
|
|
lv_style_set_bg_color(&style, lv_color_hex(0xffffff));
|
||
|
|
lv_style_set_border_width(&style, 0);
|
||
|
|
lv_style_set_pad_all(&style, 0);
|
||
|
|
lv_style_set_width(&style, 320);
|
||
|
|
lv_style_set_height(&style, 240);
|
||
|
|
|
||
|
|
icon_in_obj = lv_obj_create(lv_scr_act());
|
||
|
|
lv_obj_add_style(icon_in_obj, &style, 0);
|
||
|
|
|
||
|
|
// 创建标题背景
|
||
|
|
lv_obj_t *sine_title = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(sine_title, 320, 40);
|
||
|
|
lv_obj_set_style_pad_all(sine_title, 0, 0); // 设置间隙
|
||
|
|
lv_obj_align(sine_title, LV_ALIGN_TOP_LEFT, 0, 0);
|
||
|
|
lv_obj_set_style_bg_color(sine_title, lv_color_hex(0xb87fa8), 0);
|
||
|
|
// 显示标题
|
||
|
|
abecg_label = lv_label_create(sine_title);
|
||
|
|
lv_label_set_text(abecg_label, "异常心电");
|
||
|
|
lv_obj_set_style_text_color(abecg_label, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_set_style_text_font(abecg_label, &font_alipuhui20, 0);
|
||
|
|
lv_obj_align(abecg_label, LV_ALIGN_CENTER, 0, 0);
|
||
|
|
|
||
|
|
// 创建后退按钮
|
||
|
|
abecg_back = lv_btn_create(sine_title);
|
||
|
|
lv_obj_align(abecg_back, LV_ALIGN_LEFT_MID, 0, 0);
|
||
|
|
lv_obj_set_size(abecg_back, 60, 40);
|
||
|
|
lv_obj_set_style_border_width(abecg_back, 0, 0); // 设置边框宽度
|
||
|
|
lv_obj_set_style_pad_all(abecg_back, 0, 0); // 设置间隙
|
||
|
|
lv_obj_set_style_bg_opa(abecg_back, LV_OPA_COVER, LV_PART_MAIN); // 背景可见
|
||
|
|
lv_obj_set_style_bg_color(abecg_back, lv_color_hex(0x006600), LV_PART_MAIN); // 设置按钮背景为绿色
|
||
|
|
lv_obj_set_style_shadow_opa(abecg_back, LV_OPA_TRANSP, LV_PART_MAIN); // 阴影透明
|
||
|
|
lv_obj_add_event_cb(abecg_back, abecg_back_cb, LV_EVENT_CLICKED, NULL); // 添加按键处理函数
|
||
|
|
|
||
|
|
lv_obj_t *label_back = lv_label_create(abecg_back);
|
||
|
|
lv_label_set_text(label_back, LV_SYMBOL_LEFT); // 按键上显示左箭头符号
|
||
|
|
lv_obj_set_style_text_font(label_back, &lv_font_montserrat_20, 0);
|
||
|
|
lv_obj_set_style_text_color(label_back, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_obj_align(label_back, LV_ALIGN_CENTER, -20, 0);
|
||
|
|
|
||
|
|
|
||
|
|
// 参数数组
|
||
|
|
const char * param_names[] = {"幅度/mV", "频率/Hz", "偏置/mV"};
|
||
|
|
const char *param_values[] = {amplitude, frequency, offset};
|
||
|
|
// 循环创建参数显示
|
||
|
|
for (int i = 0; i < 3; i++) {
|
||
|
|
// 创建参数行容器
|
||
|
|
lv_obj_t * param_row = lv_obj_create(icon_in_obj);
|
||
|
|
lv_obj_set_size(param_row, 200, 40);
|
||
|
|
lv_obj_align(param_row, LV_ALIGN_TOP_MID, 0, 50 + i * 50);
|
||
|
|
|
||
|
|
// 设置参数名称
|
||
|
|
lv_obj_t * param_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(param_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(param_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(param_label, param_names[i]);
|
||
|
|
lv_obj_align(param_label, LV_ALIGN_LEFT_MID, 10, 0);
|
||
|
|
|
||
|
|
// 设置参数值
|
||
|
|
lv_obj_t * value_label = lv_label_create(param_row);
|
||
|
|
lv_obj_set_style_text_color(value_label, lv_color_hex(0x00BF00), 0);
|
||
|
|
lv_obj_set_style_text_font(value_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_text(value_label, param_values[i]);
|
||
|
|
lv_obj_align(value_label, LV_ALIGN_RIGHT_MID, -10, 0);
|
||
|
|
|
||
|
|
// 点击参数时进入调整界面
|
||
|
|
lv_obj_add_event_cb(param_row, param_event_handler, LV_EVENT_CLICKED, NULL);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/******************************** 第6个图标 蓝牙设置 应用程序***********************************************************************************/
|
||
|
|
|
||
|
|
/******************************** 主界面 ******************************/
|
||
|
|
|
||
|
|
void lv_main_page(void)
|
||
|
|
{
|
||
|
|
lvgl_port_lock(0);
|
||
|
|
|
||
|
|
// 创建主界面基本对象
|
||
|
|
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x000000), 0); // 修改背景为黑色
|
||
|
|
|
||
|
|
static lv_style_t style;
|
||
|
|
lv_style_init(&style);
|
||
|
|
lv_style_set_radius(&style, 10);
|
||
|
|
lv_style_set_bg_opa( &style, LV_OPA_COVER );
|
||
|
|
lv_style_set_bg_color(&style, lv_color_hex(0x00BFFF));
|
||
|
|
lv_style_set_bg_grad_color( &style, lv_color_hex( 0x00BF00 ) );
|
||
|
|
lv_style_set_bg_grad_dir( &style, LV_GRAD_DIR_VER );
|
||
|
|
lv_style_set_border_width(&style, 0);
|
||
|
|
lv_style_set_pad_all(&style, 0);
|
||
|
|
lv_style_set_width(&style, 320);
|
||
|
|
lv_style_set_height(&style, 240);
|
||
|
|
|
||
|
|
main_obj = lv_obj_create(lv_scr_act());
|
||
|
|
lv_obj_add_style(main_obj, &style, 0);
|
||
|
|
|
||
|
|
// 显示右上角符号
|
||
|
|
lv_obj_t * sylbom_label = lv_label_create(main_obj);
|
||
|
|
lv_obj_set_style_text_font(sylbom_label, &lv_font_montserrat_20, 0);
|
||
|
|
lv_obj_set_style_text_color(sylbom_label, lv_color_hex(0xffffff), 0);
|
||
|
|
lv_label_set_text(sylbom_label, LV_SYMBOL_BLUETOOTH" "LV_SYMBOL_WIFI); // 显示蓝牙和wifi图标
|
||
|
|
lv_obj_align_to(sylbom_label, main_obj, LV_ALIGN_TOP_RIGHT, -10, 10);
|
||
|
|
|
||
|
|
// 显示左上角欢迎语
|
||
|
|
main_text_label = lv_label_create(main_obj);
|
||
|
|
lv_obj_set_style_text_font(main_text_label, &font_alipuhui20, 0);
|
||
|
|
lv_label_set_long_mode(main_text_label, LV_LABEL_LONG_SCROLL_CIRCULAR); /*Circular scroll*/
|
||
|
|
lv_obj_set_width(main_text_label, 280);
|
||
|
|
lv_label_set_text(main_text_label, "欢迎使用轻讯模拟仪");
|
||
|
|
lv_obj_align_to(main_text_label, main_obj, LV_ALIGN_TOP_LEFT, 8, 5);
|
||
|
|
|
||
|
|
// 设置应用图标style
|
||
|
|
static lv_style_t btn_style;
|
||
|
|
lv_style_init(&btn_style);
|
||
|
|
lv_style_set_radius(&btn_style, 16);
|
||
|
|
lv_style_set_bg_opa( &btn_style, LV_OPA_COVER );
|
||
|
|
lv_style_set_text_color(&btn_style, lv_color_hex(0xffffff));
|
||
|
|
lv_style_set_border_width(&btn_style, 0);
|
||
|
|
lv_style_set_pad_all(&btn_style, 5);
|
||
|
|
lv_style_set_width(&btn_style, 80);
|
||
|
|
lv_style_set_height(&btn_style, 80);
|
||
|
|
|
||
|
|
// 创建第1个应用图标
|
||
|
|
lv_obj_t * icon1 = lv_btn_create(main_obj);
|
||
|
|
lv_obj_add_style(icon1, &btn_style, 0);
|
||
|
|
lv_obj_set_style_bg_color(icon1, lv_color_hex(0x30a830), 0);
|
||
|
|
lv_obj_set_pos(icon1, 15, 50);
|
||
|
|
lv_obj_add_event_cb(icon1, Normal_electrocardiogram, LV_EVENT_CLICKED, NULL);
|
||
|
|
|
||
|
|
// 创建按钮文字
|
||
|
|
lv_obj_t * label1 = lv_label_create(icon1);
|
||
|
|
lv_label_set_text(label1, "正常心电"); // 设置标签文本
|
||
|
|
lv_obj_set_style_text_color(label1, lv_color_hex(0xFFFFFF), 0); // 设置文字颜色为白色
|
||
|
|
lv_obj_set_style_text_font(label1, &font_alipuhui20, 0);
|
||
|
|
lv_obj_center(label1); // 将文字居中显示
|
||
|
|
|
||
|
|
// 创建第2个应用图标
|
||
|
|
lv_obj_t * icon2 = lv_btn_create(main_obj);
|
||
|
|
lv_obj_add_style(icon2, &btn_style, 0);
|
||
|
|
lv_obj_set_style_bg_color(icon2, lv_color_hex(0xf87c30), 0);
|
||
|
|
lv_obj_set_pos(icon2, 120, 50);
|
||
|
|
lv_obj_add_event_cb(icon2, Create_Sine_wave, LV_EVENT_CLICKED, NULL);
|
||
|
|
|
||
|
|
// 创建按钮文字
|
||
|
|
lv_obj_t * label2 = lv_label_create(icon2);
|
||
|
|
lv_label_set_text(label2, "正弦波"); // 设置标签文本
|
||
|
|
lv_obj_set_style_text_color(label2, lv_color_hex(0xFFFFFF), 0); // 设置文字颜色为白色
|
||
|
|
lv_obj_set_style_text_font(label2, &font_alipuhui20, 0);
|
||
|
|
lv_obj_center(label2); // 将文字居中显示
|
||
|
|
|
||
|
|
// 创建第3个应用图标
|
||
|
|
lv_obj_t * icon3 = lv_btn_create(main_obj);
|
||
|
|
lv_obj_add_style(icon3, &btn_style, 0);
|
||
|
|
lv_obj_set_style_bg_color(icon3, lv_color_hex(0x008b8b), 0);
|
||
|
|
lv_obj_set_pos(icon3, 225, 50);
|
||
|
|
lv_obj_add_event_cb(icon3, Create_Square_wave, LV_EVENT_CLICKED, NULL);
|
||
|
|
|
||
|
|
// 创建按钮文字
|
||
|
|
lv_obj_t * label3 = lv_label_create(icon3);
|
||
|
|
lv_label_set_text(label3, "方波"); // 设置标签文本
|
||
|
|
lv_obj_set_style_text_color(label3, lv_color_hex(0xFFFFFF), 0); // 设置文字颜色为白色
|
||
|
|
lv_obj_set_style_text_font(label3, &font_alipuhui20, 0);
|
||
|
|
lv_obj_center(label3); // 将文字居中显示
|
||
|
|
|
||
|
|
// 创建第4个应用图标
|
||
|
|
lv_obj_t * icon4 = lv_btn_create(main_obj);
|
||
|
|
lv_obj_add_style(icon4, &btn_style, 0);
|
||
|
|
lv_obj_set_style_bg_color(icon4, lv_color_hex(0xd8b010), 0);
|
||
|
|
lv_obj_set_pos(icon4, 15, 147);
|
||
|
|
lv_obj_add_event_cb(icon4, Create_Triangle_wave, LV_EVENT_CLICKED, NULL);
|
||
|
|
|
||
|
|
// 创建按钮文字
|
||
|
|
lv_obj_t * label4 = lv_label_create(icon4);
|
||
|
|
lv_label_set_text(label4, "三角波"); // 设置标签文本
|
||
|
|
lv_obj_set_style_text_color(label4, lv_color_hex(0xFFFFFF), 0); // 设置文字颜色为白色
|
||
|
|
lv_obj_set_style_text_font(label4, &font_alipuhui20, 0);
|
||
|
|
lv_obj_center(label4); // 将文字居中显示
|
||
|
|
|
||
|
|
// 创建第5个应用图标
|
||
|
|
lv_obj_t * icon5 = lv_btn_create(main_obj);
|
||
|
|
lv_obj_add_style(icon5, &btn_style, 0);
|
||
|
|
lv_obj_set_style_bg_color(icon5, lv_color_hex(0xcd5c5c), 0);
|
||
|
|
lv_obj_set_pos(icon5, 120, 147);
|
||
|
|
lv_obj_add_event_cb(icon5, Create_Abecg_wave, LV_EVENT_CLICKED, NULL);
|
||
|
|
|
||
|
|
// 创建按钮文字
|
||
|
|
lv_obj_t * label5 = lv_label_create(icon5);
|
||
|
|
lv_label_set_text(label5, "异常心电"); // 设置标签文本
|
||
|
|
lv_obj_set_style_text_color(label5, lv_color_hex(0xFFFFFF), 0); // 设置文字颜色为白色
|
||
|
|
lv_obj_set_style_text_font(label5, &font_alipuhui20, 0);
|
||
|
|
lv_obj_center(label5); // 将文字居中显示
|
||
|
|
|
||
|
|
|
||
|
|
// 创建第6个应用图标
|
||
|
|
lv_obj_t *icon6 = lv_btn_create(main_obj);
|
||
|
|
lv_obj_add_style(icon6, &btn_style, 0);
|
||
|
|
lv_obj_set_style_bg_color(icon6, lv_color_hex(0xb87fa8), 0);
|
||
|
|
lv_obj_set_pos(icon6, 225, 147);
|
||
|
|
//lv_obj_add_event_cb(icon6, btset_event_handler, LV_EVENT_CLICKED, NULL);
|
||
|
|
|
||
|
|
// lv_obj_t * img6 = lv_img_create(icon6);
|
||
|
|
// LV_IMG_DECLARE(img_btset_icon);
|
||
|
|
// lv_img_set_src(img6, &img_btset_icon);
|
||
|
|
// lv_obj_align(img6, LV_ALIGN_CENTER, 0, 0);
|
||
|
|
|
||
|
|
lvgl_port_unlock();
|
||
|
|
}
|
||
|
|
|