Fork of https://developer.mbed.org/users/bscott/code/STM32_USBDevice/

Fork of STM32_USBDevice by Bradley Scott

Revision:
70:b17ecdbfb0ce
Parent:
68:f8305faf7917
Child:
76:eef92651f52f
diff -r 4fabf74d68fc -r b17ecdbfb0ce USBDevice/USBHAL_STM32L1.cpp
--- a/USBDevice/USBHAL_STM32L1.cpp	Tue Dec 13 13:32:10 2016 +0000
+++ b/USBDevice/USBHAL_STM32L1.cpp	Wed Dec 21 11:27:46 2016 +0000
@@ -48,7 +48,8 @@
 }
 
 #elif defined(TARGET_STM32F3)
-#define USB_LP_IRQn USB_LP_CAN_RX0_IRQn
+// use remapped USB interrupts, so that CAN peripheral can also be used if needed
+//#define USB_LP_IRQn USB_LP_CAN_RX0_IRQn
 #endif
 
 static PCD_HandleTypeDef hpcd_USB_FS;
@@ -72,6 +73,10 @@
     hpcd_USB_FS.Init.Sof_enable = DISABLE;
     hpcd_USB_FS.Init.low_power_enable = DISABLE;
     hpcd_USB_FS.Init.battery_charging_enable = DISABLE;
+#if defined(TARGET_STM32F3)
+    __HAL_RCC_SYSCFG_CLK_ENABLE();
+    __HAL_REMAPINTERRUPT_USB_ENABLE();
+#endif
     NVIC_SetVector(USB_LP_IRQn, (uint32_t)&_usbisr);
     HAL_PCD_Init(&hpcd_USB_FS);
     HAL_PCD_Start(&hpcd_USB_FS);