freertos_f407/User/application/app.c

52 lines
1.5 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 "app.h"
#include "board.h"
#include "os.h"
#include "shell_port.h"
#include "../system/sgl/sgl.h"
static TaskHandle_t business_task_handle = NULL;
void sgl_print_hello(void)
{
/* 设置页面背景为黑色,使白色文字可见 */
sgl_page_set_color(sgl_screen_act(), sgl_rgb(0x00, 0x00, 0x00));
/* 全屏 label居中显示 Hello World */
sgl_obj_t *label = sgl_label_create(NULL);
sgl_obj_set_pos(label, 0, 0);
sgl_obj_set_size(label, 240, 240);
sgl_label_set_text(label, "Hello World");
sgl_label_set_font(label, &song23);
sgl_label_set_text_color(label, sgl_rgb(0xFF, 0xFF, 0xFF));
sgl_label_set_text_align(label, SGL_ALIGN_CENTER);
}
void business_task(void *pvParameters)
{
/* 启动时显示 Hello World 2 秒 */
sgl_print_hello();
sgl_task_handle();
vTaskDelay(2000);
for (;;)
{
rtc_update();
lcd_rtc_test();
sgl_task_handle();
led_toggle(LED_USER);
vTaskDelay(1000);
}
}
void app_init(void)
{
userShellInit(); // 初始化shell
// 创建任务
xTaskCreate((TaskFunction_t)business_task, // 任务入口函数
(const char *)"business_task", // 任务名字
(uint16_t)1024, // 任务栈大小
(void *)NULL, // 任务入口函数参数
(UBaseType_t)1, // 任务优先级
(TaskHandle_t *)&business_task_handle); // 任务句柄
}