/* GPIO EXTI Callback function Handle remote-wakeup through key button.  */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
/* GPIO EXTI Callback function Handle remote-wakeup through key button.  */
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
  if (GPIO_Pin == KEY_BUTTON_PIN)
  {
    if ((((USBD_HandleTypeDef *)hpcd.pData)->dev_remote_wakeup == 1)&&
        (((USBD_HandleTypeDef *)hpcd.pData)->dev_state == USBD_STATE_SUSPENDED))
    {
      if ((&hpcd)->Init.low_power_enable)
      {
        SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));  
        SystemClockConfig_STOP();
      }
      __HAL_PCD_UNGATE_PHYCLOCK((&hpcd));
      HAL_PCD_ActivateRemoteWakeup((&hpcd));
      HAL_Delay(10);
      HAL_PCD_DeActivateRemoteWakeup((&hpcd));
      ((USBD_HandleTypeDef *)hpcd.pData)->dev_state = USBD_STATE_CONFIGURED;
      ((USBD_HandleTypeDef *)hpcd.pData)->dev_remote_wakeup=0;
      remotewakeupon = 1;
    }
  }
}