From c5bb90333e68247547604d4ded1ef4b2a1e06a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=90=83=E6=B2=B9=E7=82=B8=E9=B8=A1?= <1425962791@qq.com> Date: Sun, 19 Oct 2025 11:58:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E4=B8=B2=E5=8F=A3=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E5=A4=84=E7=90=86=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Power_Pico/User/Tasks/Inc/user_MessageTask.h | 16 ++++++++++++++++ .../User/Tasks/Src/user_HardwareInitTask.c | 5 ++--- Power_Pico/User/Tasks/Src/user_TasksInit.c | 10 ++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 Power_Pico/User/Tasks/Inc/user_MessageTask.h diff --git a/Power_Pico/User/Tasks/Inc/user_MessageTask.h b/Power_Pico/User/Tasks/Inc/user_MessageTask.h new file mode 100644 index 0000000..16892bb --- /dev/null +++ b/Power_Pico/User/Tasks/Inc/user_MessageTask.h @@ -0,0 +1,16 @@ +#ifndef __USER_MESSAGETASK_H__ +#define __USER_MESSAGETASK_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +void MessageTask(void *argument); + + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/Power_Pico/User/Tasks/Src/user_HardwareInitTask.c b/Power_Pico/User/Tasks/Src/user_HardwareInitTask.c index fc86491..13da5bf 100644 --- a/Power_Pico/User/Tasks/Src/user_HardwareInitTask.c +++ b/Power_Pico/User/Tasks/Src/user_HardwareInitTask.c @@ -46,11 +46,10 @@ void HardwareInitTask(void *argument) vTaskSuspendAll(); // uart start - HAL_UART_Receive_DMA(&huart6, (uint8_t*)uart_receive_str, USART_RX_BUFFER_SIZE); + HAL_UART_Receive_DMA(&huart6, (uint8_t*)uart_receive_buf, USART_RX_BUFFER_SIZE); __HAL_UART_ENABLE_IT(&huart6, UART_IT_IDLE); // UART6_TX_Send((uint8_t *)"power-pico\r\n", 13); - // HAL_UART_Transmit_DMA(&huart6,(uint8_t *)"power-pico\r\n",13); // queue for voltage and current global_voltage_queue = queue_create(32); @@ -87,7 +86,7 @@ void HardwareInitTask(void *argument) sys_settings.backlight_level = 80; sys_settings.key_sound_enable = 0; sys_settings.language_select = 0; - sys_settings.rotation = 270; + sys_settings.rotation = 180; // FUSB CC pin dis connect HAL_GPIO_WritePin(GPIOB, GPIO_PIN_10, GPIO_PIN_RESET); diff --git a/Power_Pico/User/Tasks/Src/user_TasksInit.c b/Power_Pico/User/Tasks/Src/user_TasksInit.c index 0af30f9..0baa0e3 100644 --- a/Power_Pico/User/Tasks/Src/user_TasksInit.c +++ b/Power_Pico/User/Tasks/Src/user_TasksInit.c @@ -13,6 +13,7 @@ #include "user_HardwareInitTask.h" #include "user_PDUFPTask.h" #include "user_KeyTask.h" +#include "user_MessageTask.h" /* Private typedef -----------------------------------------------------------*/ @@ -52,6 +53,14 @@ const osThreadAttr_t KeyTask_attributes = { .priority = (osPriority_t) osPriorityNormal, }; +// message task +osThreadId_t MessageTaskHandle; +const osThreadAttr_t MessageTask_attributes = { + .name = "MessageTask", + .stack_size = 128 * 1, + .priority = (osPriority_t) osPriorityHigh, +}; + //LVGL Handler task osThreadId_t LvHandlerTaskHandle; const osThreadAttr_t LvHandlerTask_attributes = { @@ -88,6 +97,7 @@ void User_Tasks_Init(void) HardwareInitTaskHandle = osThreadNew(HardwareInitTask, NULL, &HardwareInitTask_attributes); // PDUFPTaskHandle = osThreadNew(PDUFPTask, NULL, &PDUFPTask_attributes); KeyTaskHandle = osThreadNew(KeyTask, NULL, &KeyTask_attributes); + MessageTaskHandle = osThreadNew(MessageTask, NULL, &MessageTask_attributes); LvHandlerTaskHandle = osThreadNew(LvHandlerTask, NULL, &LvHandlerTask_attributes); /* add events, ... */