void USB_Init(void)
{
	USBPortNum = (uint8_t)USB_PORT_SELECTED;
	USB_IsInitialized = true;
	HAL_USBInit();
	USB_ResetInterface();
}
Exemplo n.º 2
0
void USB_Init(void)
{
#if defined(USB_MULTI_PORTS)
	uint8_t i;
	USB_Memory_Init(USBRAM_BUFFER_SIZE);
	for(i = 0;i<MAX_USB_CORE;i++)
	{
		HAL_USBInit(i);
		USB_ResetInterface(i);
	}
#else
	USBPortNum = (uint8_t)USB_PORT_SELECTED;
	HAL_USBInit(USBPortNum);
	#if defined(USB_CAN_BE_HOST) 
	USB_Memory_Init(USBRAM_BUFFER_SIZE);
	#endif
	USB_ResetInterface(USBPortNum);
#endif
	USB_IsInitialized = true;
}
void USB_Init(uint8_t corenum, uint8_t mode)
{
#if defined(USB_CAN_BE_HOST)	
	if (mode == USB_MODE_Host && Mem_IsInitialized == false)
	{
	USB_Memory_Init(USBRAM_BUFFER_SIZE);
		Mem_IsInitialized = true;
	}
#endif
	USB_CurrentMode[corenum] = mode;
	HAL_USBInit(corenum);
	USB_ResetInterface(corenum, mode);
	USB_IsInitialized = true;
}