/* * AppTaskMain.c * * Created on: 2022年2月22日 * Author: QiXiang_CHENJIE */ #include "AppTaskMain.h" #include "hal_fls.h" static void vTimerCallback(TimerHandle_t pxTimer); void MainTask(void *pvParameters) { (void)pvParameters; TimerHandle_t monitorTimer; monitorTimer = xTimerCreate("monitor", 10, pdTRUE, (void *)0, vTimerCallback); xTimerStart(monitorTimer, 0); TimerHandle_t monitorTimer1ms; monitorTimer1ms = xTimerCreate("monitor1ms", 1, pdTRUE, (void *)0, vTimer1msCallback); xTimerStart(monitorTimer1ms, 0); sleep_mutex = xSemaphoreCreateBinary(); uint32 *eppromAddStart = 0x14000000; if (*(uint8 *)(eppromAddStart) == 0xff) { HAL_EEP_Write(0, (uint8 *)&AppConfigInfo, sizeof(AppConfigInfo)); } HAL_EEP_Read(0, (uint8 *)&AppConfigInfo, sizeof(AppConfigInfo)); while (1) { vTaskDelay(pdMS_TO_TICKS(10)); if (HAL_Is100msTickTimeout()) { if (IsFeedWdg == TRUE) { WATCHDOG_HAL_Feed(); } } if (AppConfigInfo.appSaveFlg) { AppConfigInfo.appSaveFlg = false; HAL_EEP_Write(0, (uint8 *)&AppConfigInfo, sizeof(AppConfigInfo)); } if (Fota_update_flag || Fota_error_flag) { // 重启前保存数据 AppConfigInfo.appSaveFlg = false; HAL_EEP_Write(0, (uint8 *)&AppConfigInfo, sizeof(AppConfigInfo)); SystemSoftwareReset(); } #ifndef SEGGER_RTT_PRINTF MCUEnterSleep(); #endif } } static void vTimerCallback(TimerHandle_t pxTimer) { uint32 ulTimerID; ulTimerID = (uint32)pvTimerGetTimerID(pxTimer); if (ulTimerID == 0) { TimerCounter = TimerCounter + 10; } }