minor usb cleanup
This commit is contained in:
parent
d6e68ce761
commit
7beb6b8ac5
|
@ -78,9 +78,9 @@ void usb_conf_clksource(void)
|
||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
void Enter_LowPowerMode(void)
|
void usb_enter_LowPowerMode(void)
|
||||||
{
|
{
|
||||||
printf("usb enter low power mode\r\n");
|
printf_usb("usb enter low power mode\r\n");
|
||||||
bDeviceState = SUSPENDED;
|
bDeviceState = SUSPENDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,10 +91,10 @@ void Enter_LowPowerMode(void)
|
||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
void Leave_LowPowerMode(void)
|
void usb_leave_LowPowerMode(void)
|
||||||
{
|
{
|
||||||
DEVICE_INFO *pInfo = &Device_Info;
|
DEVICE_INFO *pInfo = &Device_Info;
|
||||||
printf("usb leave low power mode\r\n");
|
printf_usb("usb leave low power mode\r\n");
|
||||||
if (pInfo->Current_Configuration != 0)
|
if (pInfo->Current_Configuration != 0)
|
||||||
bDeviceState = CONFIGURED;
|
bDeviceState = CONFIGURED;
|
||||||
else
|
else
|
||||||
|
@ -141,7 +141,7 @@ void usb_intr_init(void)
|
||||||
*
|
*
|
||||||
* @return None
|
* @return None
|
||||||
*/
|
*/
|
||||||
void USB_Port_Set(FunctionalState NewState, FunctionalState Pin_In_IPU)
|
void usb_gpio_init(FunctionalState NewState, FunctionalState Pin_In_IPU)
|
||||||
{
|
{
|
||||||
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
|
||||||
|
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
void usb_conf_clksource(void);
|
void usb_conf_clksource(void);
|
||||||
void usb_intr_init(void);
|
void usb_intr_init(void);
|
||||||
|
|
||||||
void Enter_LowPowerMode(void);
|
void usb_enter_LowPowerMode(void);
|
||||||
void Leave_LowPowerMode(void);
|
void usb_leave_LowPowerMode(void);
|
||||||
|
|
||||||
void USB_Port_Set(FunctionalState NewState, FunctionalState Pin_In_IPU);
|
void usb_gpio_init(FunctionalState NewState, FunctionalState Pin_In_IPU);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ void USBD_Status_Out(void)
|
||||||
void USBD_init(void)
|
void USBD_init(void)
|
||||||
{
|
{
|
||||||
uint8_t i;
|
uint8_t i;
|
||||||
uint32_t timeout;
|
volatile uint32_t timeout;
|
||||||
|
|
||||||
pInformation->Current_Configuration = 0;
|
pInformation->Current_Configuration = 0;
|
||||||
PowerOn();
|
PowerOn();
|
||||||
|
@ -206,9 +206,9 @@ void USBD_init(void)
|
||||||
USB_SIL_Init();
|
USB_SIL_Init();
|
||||||
bDeviceState = UNCONNECTED;
|
bDeviceState = UNCONNECTED;
|
||||||
|
|
||||||
USB_Port_Set(DISABLE, DISABLE);
|
usb_gpio_init(DISABLE, DISABLE);
|
||||||
for (timeout = SystemCoreClock >> 5; timeout; timeout--);
|
for (timeout = SystemCoreClock >> 5; timeout; timeout--);
|
||||||
USB_Port_Set(ENABLE, ENABLE);
|
usb_gpio_init(ENABLE, ENABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
|
|
@ -115,7 +115,7 @@ void Suspend(void)
|
||||||
wCNTR |= CNTR_LPMODE;
|
wCNTR |= CNTR_LPMODE;
|
||||||
_SetCNTR(wCNTR);
|
_SetCNTR(wCNTR);
|
||||||
|
|
||||||
Enter_LowPowerMode();
|
usb_enter_LowPowerMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
|
@ -132,7 +132,7 @@ void Resume_Init(void)
|
||||||
wCNTR = _GetCNTR();
|
wCNTR = _GetCNTR();
|
||||||
wCNTR &= (~CNTR_LPMODE);
|
wCNTR &= (~CNTR_LPMODE);
|
||||||
_SetCNTR(wCNTR);
|
_SetCNTR(wCNTR);
|
||||||
Leave_LowPowerMode();
|
usb_leave_LowPowerMode();
|
||||||
_SetCNTR(IMR_MSK);
|
_SetCNTR(IMR_MSK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue