mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
42 lines
1.0 KiB
C
42 lines
1.0 KiB
C
/* 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);
|
|
}
|
|
}
|