mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
分离LVGL task到新文件
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -826,6 +826,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\Tasks\Src\user_HardwareInitTask.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>user_LVGLTask.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\User\Tasks\Src\user_LVGLTask.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>user_KeyTask.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
16
Power_Pico/User/Tasks/Inc/user_LVGLTask.h
Normal file
16
Power_Pico/User/Tasks/Inc/user_LVGLTask.h
Normal 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
|
||||
|
||||
52
Power_Pico/User/Tasks/Src/user_LVGLTask.c
Normal file
52
Power_Pico/User/Tasks/Src/user_LVGLTask.c
Normal 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);
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user