|
|
@ -130,32 +130,36 @@ void USB_ResetInterface(void)
|
|
|
|
|
|
|
|
|
|
|
|
USB_CLK_Unfreeze();
|
|
|
|
USB_CLK_Unfreeze();
|
|
|
|
|
|
|
|
|
|
|
|
#if defined(USB_DEVICE_ONLY) && (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
|
|
|
|
#if defined(USB_CAN_BE_BOTH)
|
|
|
|
UHWCON |= (1 << UIMOD);
|
|
|
|
|
|
|
|
USB_Init_Device();
|
|
|
|
|
|
|
|
#elif defined(USB_HOST_ONLY)
|
|
|
|
|
|
|
|
UHWCON &= ~(1 << UIMOD);
|
|
|
|
|
|
|
|
USB_Init_Host();
|
|
|
|
|
|
|
|
#elif defined(USB_CAN_BE_BOTH)
|
|
|
|
|
|
|
|
if (UIDModeSelectEnabled)
|
|
|
|
if (UIDModeSelectEnabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
UHWCON |= (1 << UIDE);
|
|
|
|
UHWCON |= (1 << UIDE);
|
|
|
|
USB_INT_Enable(USB_INT_IDTI);
|
|
|
|
USB_INT_Enable(USB_INT_IDTI);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
if (USB_CurrentMode == USB_MODE_DEVICE)
|
|
|
|
if (USB_CurrentMode == USB_MODE_DEVICE)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
#if defined(USB_CAN_BE_DEVICE)
|
|
|
|
|
|
|
|
#if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
|
|
|
|
UHWCON |= (1 << UIMOD);
|
|
|
|
UHWCON |= (1 << UIMOD);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
USB_Init_Device();
|
|
|
|
USB_Init_Device();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
#if defined(USB_CAN_BE_HOST)
|
|
|
|
UHWCON &= ~(1 << UIMOD);
|
|
|
|
UHWCON &= ~(1 << UIMOD);
|
|
|
|
USB_Init_Host();
|
|
|
|
USB_Init_Host();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if (defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR))
|
|
|
|
USB_OTGPAD_On();
|
|
|
|
USB_OTGPAD_On();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
USB_Attach();
|
|
|
|
USB_Attach();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|