示例#1
0
/**
  * @brief  Initializes the WWDG peripheral.
  *   This function set Window Register = WindowValue, Counter Register according
  *   to Counter and \b ENABLE \b WWDG
  * @param  Counter : WWDG counter value
  * @param  WindowValue : specifies the WWDG Window Register, range is 0x00 to 0x7F.
  * @retval None
  */
void WWDG_Init(uint8_t Counter, uint8_t WindowValue)
{
  /* Check the parameters */
  assert_param(IS_WWDG_WINDOW_LIMIT_VALUE(WindowValue));
  WWDG->WR = WWDG_WR_RESET_VALUE;
  WWDG->CR = (uint8_t)(WWDG_CR_WDGA | Counter);
  WWDG->WR = (uint8_t)((uint8_t)(~WWDG_CR_WDGA) & (uint8_t) WindowValue);
}
/**
  * @brief  Sets the WWDG window value.
  * @param  WindowValue: specifies the window value to be compared to the downcounter.
  *         This parameter value must be lower than 0x80.
  * @retval None
  */
void WWDG_SetWindowValue(uint8_t WindowValue)
{
  __IO uint8_t tmpreg = 0;

  /* Check the parameters */
  assert_param(IS_WWDG_WINDOW_LIMIT_VALUE(WindowValue));

  /* Set W[6:0] bits according to WindowValue value */
  tmpreg |= (uint8_t) (WindowValue & (uint8_t) BIT_MASK);

  /* Store the new value */
  WWDG->WR = tmpreg;
}
示例#3
0
/**
  * @brief  Sets the WWDG window value.
  * @param  WindowValue: specifies the window value to be compared to the downcounter.
  *   This parameter value must be lower than 0x80.
  * @retval None
  */
void WWDG_SetWindowValue(uint8_t WindowValue)
{
  /* Check the parameters */
  assert_param(IS_WWDG_WINDOW_LIMIT_VALUE(WindowValue));
  WWDG->WR = (uint8_t)((uint8_t)(~WWDG_CR_WDGA) & (uint8_t) WindowValue);
}