From 548db44f01dd23bf11837182d81f34129ad9260d 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:59:32 +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/Src/user_MessageTask.c | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Power_Pico/User/Tasks/Src/user_MessageTask.c diff --git a/Power_Pico/User/Tasks/Src/user_MessageTask.c b/Power_Pico/User/Tasks/Src/user_MessageTask.c new file mode 100644 index 0000000..567bc9d --- /dev/null +++ b/Power_Pico/User/Tasks/Src/user_MessageTask.c @@ -0,0 +1,41 @@ +/* Private includes -----------------------------------------------------------*/ +//includes +#include "user_TasksInit.h" +#include "user_MessageTask.h" +#include "usart.h" + +/* Private typedef -----------------------------------------------------------*/ + +/* Private define ------------------------------------------------------------*/ + +/* Private variables ---------------------------------------------------------*/ +uint8_t test_flag = 0; +/* Private function prototypes -----------------------------------------------*/ + + +/** + * @brief task for check the usart message + * @param argument: Not used + * @retval None + */ +void MessageTask(void *argument) +{ + while(1) + { + if(uart_receive_flag == 1) { + + // clear the flag + uart_receive_flag = 0; + // 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"); + // jump to bootloader + } else { + // do nothing + } + + } + osDelay(500); + } +}