/**
  ******************************************************************************
  * @file     WWDG_CFG.c
  * @author   SINOMCU-AE
  * @brief    WWDG config
  *    
  *          This file provides functions to WWDG config.
  *         
  ******************************************************************************
  * @attention 
  *                           DISCLAIMER
  * The present firmware which is for guidance only aims at providing customers
  * with coding information regarding their products in order for them to save
  * time. As a result, SinoMCU shall not be held liable for any direct,indirect
  * or consequential damages with respect to any claims arising from the content 
  * of such firmware and/or the use made by customers of the coding information 
  * contained herein in connection with their products.
  *
  * <h2><center>&copy; Copyright (c) 2021 sinomcu All rights reserved.</center></h2>
  *
  ******************************************************************************
  */
    
#include "WWDG_CFG.h"

/**
  * @brief  WWDG config Function
  * @param  None
  * @retval None
  */
void wwdg_init(void) {
  MS32_WWDG_InitTypeDef WwdgInitStr= {0};

  MS32_WWDG_StructInit(&WwdgInitStr);
#if(defined(SYSCLK_USE_PLL_48M) && SYSCLK_USE_PLL_48M) 
  WwdgInitStr.Prescaler = MS32_WWDG_PRESCALER_8;           // Pclk PLL 48M 
#else
  WwdgInitStr.Prescaler = MS32_WWDG_PRESCALER_1;           // Pclk HSI 8M,
#endif
  WwdgInitStr.Window    = WWDG_WIN_USER;
  WwdgInitStr.Counter   = WWDG_CNT_USER;
  MS32_WWDG_Init(&WwdgInitStr);                            // init function had enable clock,and enable WWDG
}

/******************************** END OF FILE *********************************/
