大致的主监控代码:
xTaskCreate( vSysGuard_Task, "vSysGuard_Task", configMINIMAL_STACK_SIZE, NULL, configMAX_PRIORITIES - 1, NULL );
void vSysGuard_Task(void *pvParameters)
{
#if USER_IWDG_ENABLE
IWDG_Config(IWDG_Prescaler_128 ,625); // 4S
#endif /* USER_IWDG_ENABLE */
while(1)
{
vTaskDelay(1000 / portTICK_RATE_MS);
#if USER_IWDG_ENABLE
IWDG_Feed();
#endif /* USER_IWDG_ENABLE */
SysGuard_Scan(); // 扫描各个线程返回的状态是否正确
}
}
|