void EXTI15_10_IRQHandler(void) #endif { if (EXTI_GetITStatus(KEY_BUTTON_EXTI_LINE) != RESET) { if (USB_OTG_dev.dev.DevRemoteWakeup) { #ifndef USE_STM3210C_EVAL if((USB_OTG_dev.cfg.low_power)&&(USB_OTG_dev.dev.device_status==USB_OTG_SUSPENDED)) { /* Reset SLEEPDEEP and SLEEPONEXIT bits */ SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk)); /* After wake-up from sleep mode, reconfigure the system clock */ /* After wake-up from STOP reconfigure the system clock */ /* Enable HSE */ RCC_HSEConfig(RCC_HSE_ON); /* Wait till HSE is ready */ while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET) {} /* Enable PLL */ RCC_PLLCmd(ENABLE); /* Wait till PLL is ready */ while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET) {} /* Select PLL as system clock source */ RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); /* Wait till PLL is used as system clock source */ while (RCC_GetSYSCLKSource() != 0x08) {} USB_OTG_UngateClock(&USB_OTG_dev); } #else SystemInit(); #endif USB_OTG_ActiveRemoteWakeup(&USB_OTG_dev); USB_OTG_dev.dev.device_status = USB_OTG_dev.dev.device_old_status; remote_wakeup =1; LCD_UsrLog("> USB Device woke up.\n"); } /* Clear the EXTI line pending bit */ EXTI_ClearITPendingBit(KEY_BUTTON_EXTI_LINE); } }
void Wakeup(void) { AlarmValue = 0xFFFFFFFF; /* USB wakeup */ USB_OTG_ActiveRemoteWakeup(&USB_OTG_dev); /* motherboard switch: WAKEUP_PIN short high */ GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_SET); delay_ms(500); GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_RESET); }
void EXTI15_10_IRQHandler(void) { if (EXTI_GetITStatus(USER1_BUTTON_EXTI_LINE) != RESET) { USB_OTG_ActiveRemoteWakeup(&USB_OTG_dev); /* Clear the EXTI line pending bit */ EXTI_ClearITPendingBit(USER1_BUTTON_EXTI_LINE); } }
/** * @brief This function handles EXTI0_IRQ Handler. * @param None * @retval None */ void EXTI0_IRQHandler(void) { if (EXTI_GetITStatus(EXTI_Line0) != RESET) { // if (USB_OTG_dev.dev.DevRemoteWakeup) { if((USB_OTG_dev.cfg.low_power)&&(USB_OTG_dev.dev.device_status==USB_OTG_SUSPENDED)) { /* Reset SLEEPDEEP and SLEEPONEXIT bits */ SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk)); /* After wake-up from sleep mode, reconfigure the system clock */ /* After wake-up from STOP reconfigure the system clock */ /* Enable HSE */ RCC_HSEConfig(RCC_HSE_ON); /* Wait till HSE is ready */ while (RCC_GetFlagStatus(RCC_FLAG_HSERDY) == RESET); /* Enable PLL */ RCC_PLLCmd(ENABLE); /* Wait till PLL is ready */ while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET); /* Select PLL as system clock source */ RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK); /* Wait till PLL is used as system clock source */ while (RCC_GetSYSCLKSource() != 0x08); USB_OTG_UngateClock(&USB_OTG_dev); } USB_OTG_ActiveRemoteWakeup(&USB_OTG_dev); USB_OTG_dev.dev.device_status = USB_OTG_dev.dev.device_old_status; // } /* Clear the EXTI line pending bit */ EXTI_ClearITPendingBit(EXTI_Line0); } }
void Wakeup(void) { AlarmValue = 0xFFFFFFFF; if(host_running()) return; /* USB wakeup */ USB_OTG_ActiveRemoteWakeup(&USB_OTG_dev); /* motherboard switch: WAKEUP_PIN short high (resp. low in case of SimpleCircuit) */ #ifdef SimpleCircuit GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_RESET); #else GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_SET); #endif /* SimpleCircuit */ delay_ms(500); #ifdef SimpleCircuit GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_SET); #else GPIO_WriteBit(OUT_PORT, WAKEUP_PIN, Bit_RESET); #endif /* SimpleCircuit */ }