123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- /*
- * @Author: chenjie
- * @Date: 2022-06-06
- * @LastEditTime: 2022-10-27
- * @LastEditors: chenjie
- * @Description:
- * @FilePath: \S32K146_4G\code\app\AppTaskMain.c
- * Copyright (c) 2022 by chenjie, All Rights Reserved.
- */
- #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);
- 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(TimerCounter%1000==0)
- {
- if(AppConfigInfo.eolFlg==true)
- {
- Dio_FlipChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5);
- }
- else
- {
- Dio_WriteChannel(DioConf_DioChannel_PTE9_GPIO_OUT_MCU_LED5, STD_ON);
- }
- }
- if(AppConfigInfo.appSaveFlg)
- {
- AppConfigInfo.appSaveFlg = false;
- HAL_EEP_Write(0,(uint8 *)&AppConfigInfo,sizeof(AppConfigInfo));
- }
- if(Fota_update_flag || Fota_error_flag)//升级指令发出,进行重启,或者FTP服务器出现问题,进行重启
- {
- //重启前保存数据
- AppConfigInfo.appSaveFlg = false;
- HAL_EEP_Write(0,(uint8 *)&AppConfigInfo,sizeof(AppConfigInfo));
- SystemSoftwareReset();
- }
- }
- }
- static void vTimerCallback(TimerHandle_t pxTimer)
- {
- uint32 ulTimerID;
- ulTimerID = (uint32)pvTimerGetTimerID(pxTimer);
- if(ulTimerID==0)
- {
- TimerCounter = TimerCounter + 10;
- }
- }
|