USB Device library for the STM32F103 with USB Device Firmware Upgrade (DFU) runtime support.
Dependents: STM32F103C8T6_WebUSBDFU STM32F103C8T6_USBDFU STM32F103C8T6_USBDFU dfu_usb_stm32f103
Fork of USBDevice_STM32F103 by
Diff: USBDevice/USBHAL_STM32L1.cpp
- Revision:
- 63:05e2f2e4dc3e
- Parent:
- 62:23cb405e1ee5
- Child:
- 64:c3d0530b6d82
diff -r 23cb405e1ee5 -r 05e2f2e4dc3e USBDevice/USBHAL_STM32L1.cpp --- a/USBDevice/USBHAL_STM32L1.cpp Sun Jun 21 11:53:49 2015 +0900 +++ b/USBDevice/USBHAL_STM32L1.cpp Mon Jun 22 09:42:03 2015 +0900 @@ -35,6 +35,19 @@ __HAL_SYSCFG_USBPULLUP_DISABLE(); } } + +#elif defined(TARGET_STM32L0)||defined(TARGET_STM32F0) +#define USB_LP_IRQn USB_IRQn +void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) { + if (state == 1) { + SET_BIT(USB->BCDR, USB_BCDR_DPPU); // DP Pull-up + } else { + CLEAR_BIT(USB->BCDR, USB_BCDR_DPPU); + } +} + +#elif defined(TARGET_STM32F3) +#define USB_LP_IRQn USB_LP_CAN1_RX0_IRQn #endif static PCD_HandleTypeDef hpcd_USB_FS; @@ -365,7 +378,7 @@ } void USBHAL::SOFCallback() { - SOF(hpcd_USB_FS.Instance->FNR & 0x7fff); + SOF(hpcd_USB_FS.Instance->FNR & USB_FNR_FN); } void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd) {