Example #1
0
/**
  * @brief  EXTI line detection callbacks.
  * @param  GPIO_Pin: Specifies the pins connected EXTI line
  * @retval None
  */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  if(GPIO_Pin == KEY_BUTTON_PIN)
  {
    if(__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI) 
    {
      /* Set SYSCLK frequency to 180 MHz, coming from the PLL which is clocked by the HSE */
      SystemClockHSE_Config();
    }
    else /* PLL source is HSE oscillator */
    {
      /* Set SYSCLK frequency to 180 MHz, coming from the PLL which is clocked by the HSI */
      SystemClockHSI_Config();
    }
  }
}
Example #2
0
/**
  * @brief  switch in system clock out of ISR context.
  * @retval None
  */
static void SwitchSystemClock(void)
{
  if (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSI)
  {
    /* PLL source is HSI oscillator */
    /* Set SYSCLK frequency to 216 MHz, coming from the PLL which is clocked by HSE  */
    SystemClockHSE_Config();
  }
  else if (__HAL_RCC_GET_PLL_OSCSOURCE() == RCC_PLLSOURCE_HSE)
  {
    /* PLL source is HSE  oscillator */
    /* Set SYSCLK frequency to 216 MHz, coming from the PLL which is clocked by HSI */
    SystemClockHSI_Config();
  }

  /* reset global variable */
  SwitchClock = RESET;
}