DockerFluxDC/main/main.c

59 lines
1.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include <stdio.h>
#include "main.h"
/* 创建LVGL界面包含按钮 */
static void lvgl_create_ui(void)
{
// 创建按钮对象(居中显示)
lv_obj_t *btn = lv_btn_create(lv_scr_act()); // 在屏幕上创建按钮
lv_obj_set_size(btn, 120, 60); // 设置按钮大小
lv_obj_center(btn); // 按钮居中
// 为按钮添加点击事件
// lv_obj_add_event_cb(btn, btn_click_event_cb, LV_EVENT_ALL, NULL);
// 在按钮上创建文本标签
lv_obj_t *label = lv_label_create(btn); // 在按钮内创建标签
lv_label_set_text(label, "ClickMe"); // 设置标签文本
lv_obj_center(label); // 标签在按钮内居中
}
void app_main(void)
{
// 创建用于进行消息分发的任务
xTaskCreate(
msg_dispatch_task, // 任务函数
"msg_dispatch_task", // 任务名称
4096, // 任务栈大小
NULL, // 任务参数
1, // 任务优先级
NULL // 任务句柄
);
// 创建用于进行电源管理的任务:电源开关按键控制、屏幕背光调节、电池电量检测等
xTaskCreate(
power_manager_task, // 任务函数
"power_task", // 任务名称
4096, // 任务栈大小
NULL, // 任务参数
1, // 任务优先级
NULL // 任务句柄
);
initialize_display_and_touch(); //初始化显示界面和触摸屏
lvgl_create_ui();
while (1)
{
vTaskDelay(1000);
}
}