Files
Power-Pico/Power_Pico/User/Tasks/Src/user_MessageTask.c

45 lines
1.1 KiB
C
Raw Normal View History

2025-10-19 11:59:32 +08:00
/* Private includes -----------------------------------------------------------*/
//includes
#include "user_TasksInit.h"
#include "user_MessageTask.h"
#include "usart.h"
2025-10-20 20:17:00 +08:00
#include "BL24C02.h"
2025-10-19 11:59:32 +08:00
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
2025-10-19 12:13:49 +08:00
2025-10-19 11:59:32 +08:00
/* 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");
2025-10-20 20:17:00 +08:00
EEPROM_UpdateCommand_Write(true);
HAL_Delay(100);
// reset
NVIC_SystemReset();
2025-10-19 11:59:32 +08:00
} else {
// do nothing
}
}
osDelay(500);
}
}