Update for new version of mbed.
Fork of USBDevice_STM32F103 by
Diff: USBDevice/USBHAL_STM32L1.cpp
- Revision:
- 60:04a69c36260e
- Parent:
- 59:5d5e3685bd60
- Child:
- 61:5f4f01a06669
--- a/USBDevice/USBHAL_STM32L1.cpp Tue Jun 16 18:01:11 2015 +0900 +++ b/USBDevice/USBHAL_STM32L1.cpp Wed Jun 17 15:16:26 2015 +0900 @@ -43,6 +43,7 @@ } void HAL_PCD_MspInit(PCD_HandleTypeDef* hpcd) { + __SYSCFG_CLK_ENABLE(); // for SYSCFG_PMC_USB_PU __USB_CLK_ENABLE(); HAL_NVIC_SetPriority(USB_LP_IRQn, 0, 0); HAL_NVIC_EnableIRQ(USB_LP_IRQn); @@ -54,6 +55,15 @@ HAL_NVIC_DisableIRQ(USB_LP_IRQn); // Peripheral interrupt Deinit } +void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) { + MBED_ASSERT(READ_BIT(RCC->APB2ENR, RCC_APB2ENR_SYSCFGEN)); + if (state == 1) { + __HAL_SYSCFG_USBPULLUP_ENABLE(); + } else { + __HAL_SYSCFG_USBPULLUP_DISABLE(); + } +} + USBHAL::~USBHAL(void) { HAL_PCD_DeInit(&hpcd_USB_FS); } @@ -376,14 +386,6 @@ } } -void HAL_PCDEx_SetConnectionState(PCD_HandleTypeDef *hpcd, uint8_t state) { - if (state == 1) { - __HAL_SYSCFG_USBPULLUP_ENABLE(); - } else { - __HAL_SYSCFG_USBPULLUP_DISABLE(); - } -} - void L152RE_SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct; @@ -408,8 +410,6 @@ RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_1); - - __SYSCFG_CLK_ENABLE(); } uint32_t L152RE_getUSBclock() {