mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
加入串口消息处理任务
This commit is contained in:
41
Power_Pico/User/Tasks/Src/user_MessageTask.c
Normal file
41
Power_Pico/User/Tasks/Src/user_MessageTask.c
Normal file
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user