/** ****************************************************************************** * @file iwdg.c * @author AMG Energy Solution Application Team * @version V1.0.0 * @date 25-January-2022 * @brief Watchdog Service Routines. ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "iwdg.h" /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* WDT count cycle definition */ #define WDT_COUNT_CYCLE (16384u) /* Reset source definition */ #define RESET_WDT_TRIGGER (0u) #define RESET_OTHER_TRIGGER (1u) /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ //Initialize watch-dog void IWDG_Init(void) { stc_wdt_init_t stcWdtInit; /* configure structure initialization */ MEM_ZERO_STRUCT(stcWdtInit); stcWdtInit.enClkDiv = WdtPclk3Div8192; stcWdtInit.enCountCycle = WdtCountCycle16384; stcWdtInit.enRefreshRange = WdtRefresh100Pct; //WdtRefresh0To25Pct; stcWdtInit.enSleepModeCountEn = Disable; stcWdtInit.enRequestType = WdtTriggerResetRequest; WDT_Init(&stcWdtInit); /* First refresh to start WDT */ WDT_RefreshCounter(); }