2025-10-19 11:59:32 +08:00
|
|
|
/* Private includes -----------------------------------------------------------*/
|
|
|
|
|
//includes
|
|
|
|
|
#include "user_TasksInit.h"
|
|
|
|
|
#include "user_MessageTask.h"
|
2026-02-07 13:29:07 +08:00
|
|
|
#include "usbd_cdc_if.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)
|
|
|
|
|
{
|
2026-02-07 13:29:07 +08:00
|
|
|
if(get_update_request()) {
|
2025-10-19 11:59:32 +08:00
|
|
|
|
|
|
|
|
// clear the flag
|
2026-02-07 13:29:07 +08:00
|
|
|
set_update_request(false);
|
|
|
|
|
// set the EEPROM flag
|
|
|
|
|
EEPROM_UpdateCommand_Write(true);
|
|
|
|
|
HAL_Delay(100);
|
2026-02-08 19:30:56 +08:00
|
|
|
USER_USB_DEVICE_DeInit();
|
|
|
|
|
// 给予PC足够的时间来识别设备断开
|
|
|
|
|
HAL_Delay(500);
|
2026-02-07 13:29:07 +08:00
|
|
|
// reset
|
|
|
|
|
NVIC_SystemReset();
|
2025-10-19 11:59:32 +08:00
|
|
|
}
|
|
|
|
|
osDelay(500);
|
|
|
|
|
}
|
|
|
|
|
}
|