USBDevice with support for STM32F3
Fork of F042K6_USBDevice by
Diff: USBDevice/USBHAL_STM32L1.cpp
- Revision:
- 66:b129e98ab7a0
- Parent:
- 65:0ba7c5e2b3dc
- Child:
- 67:6099ce7e71c9
diff -r 0ba7c5e2b3dc -r b129e98ab7a0 USBDevice/USBHAL_STM32L1.cpp --- a/USBDevice/USBHAL_STM32L1.cpp Mon Jan 18 10:47:16 2016 +0000 +++ b/USBDevice/USBHAL_STM32L1.cpp Wed Sep 21 20:28:24 2016 +0100 @@ -16,7 +16,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#if defined(TARGET_STM32L1)||defined(TARGET_STM32F1)||defined(TARGET_STM32F0) +#if defined(TARGET_STM32L1)||defined(TARGET_STM32F3)||defined(TARGET_STM32F1)||defined(TARGET_STM32F0) +#include "pinmap.h" #include "USBDevice.h" #if defined(TARGET_STM32F1) @@ -47,7 +48,7 @@ } #elif defined(TARGET_STM32F3) -#define USB_LP_IRQn USB_LP_CAN1_RX0_IRQn +#define USB_LP_IRQn USB_LP_CAN_RX0_IRQn #endif static PCD_HandleTypeDef hpcd_USB_FS; @@ -57,6 +58,11 @@ uint32_t USBHAL::endpointReadcore(uint8_t endpoint, uint8_t *buffer) {return 0;} USBHAL::USBHAL(void) { + #if defined(TARGET_STM32F3) + // Configure USB pins + pin_function(PA_11, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_USB)); + pin_function(PA_12, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF14_USB)); + #endif hpcd_USB_FS.pData = this; hpcd_USB_FS.Instance = USB; hpcd_USB_FS.Init.dev_endpoints = 8;