分离LVGL task到新文件

This commit is contained in:
不吃油炸鸡
2026-02-02 10:49:17 +08:00
parent 508718358a
commit 787cdbd2d5
9 changed files with 23601 additions and 23552 deletions

View File

@@ -0,0 +1,16 @@
#ifndef __USER_LVGLTASK_H__
#define __USER_LVGLTASK_H__
#ifdef __cplusplus
extern "C" {
#endif
void LvHandlerTask(void *argument);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,52 @@
/* Private includes -----------------------------------------------------------*/
//includes
//bsp
#include "key.h"
// tasks
#include "user_TasksInit.h"
#include "user_LVGLTask.h"
//gui
#include "lvgl.h"
#include "lv_lib_pm.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/**
* @brief FreeRTOS Tick Hook, to increase the LVGL tick
* @param None
* @retval None
*/
void TaskTickHook(void)
{
//to increase the LVGL tick
lv_tick_inc(1);
}
/**
* @brief LVGL Handler task, to run the lvgl
* @param argument: Not used
* @retval None
*/
void LvHandlerTask(void *argument)
{
key_event_t key_event;
while(1)
{
if(osMessageQueueGet(Key_MessageQueue, &key_event, NULL, 1)==osOK) {
lv_lib_pm_handle_key_event(&key_event);
}
lv_task_handler();
osDelay(1);
}
}

View File

@@ -30,7 +30,7 @@ void MessageTask(void *argument)
// check the received message is "update\r\n" ?
if(strcmp((const char *)uart_receive_buf, "update\r\n") == 0) {
// send response
printf("start update\r\n");
UART6_TX_Send((uint8_t *)"start update\r\n", 14);
EEPROM_UpdateCommand_Write(true);
HAL_Delay(100);
// reset

View File

@@ -14,6 +14,7 @@
//tasks
#include "user_HardwareInitTask.h"
#include "user_LVGLTask.h"
#include "user_PDUFPTask.h"
#include "user_KeyTask.h"
#include "user_MessageTask.h"
@@ -116,37 +117,3 @@ void User_Tasks_Init(void)
}
/**
* @brief FreeRTOS Tick Hook, to increase the LVGL tick
* @param None
* @retval None
*/
void TaskTickHook(void)
{
//to increase the LVGL tick
lv_tick_inc(1);
}
/**
* @brief LVGL Handler task, to run the lvgl
* @param argument: Not used
* @retval None
*/
void LvHandlerTask(void *argument)
{
key_event_t key_event;
while(1)
{
if(osMessageQueueGet(Key_MessageQueue, &key_event, NULL, 1)==osOK) {
lv_lib_pm_handle_key_event(&key_event);
}
lv_task_handler();
osDelay(1);
}
}