Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of USBDevice_STM32F103 by
Revision 60:04a69c36260e, committed 2015-06-17
- Comitter:
- va009039
- Date:
- Wed Jun 17 15:16:26 2015 +0900
- Parent:
- 59:5d5e3685bd60
- Child:
- 61:5f4f01a06669
- Commit message:
- control USB pull-up.
Changed in this revision
| USBDevice/USBHAL_STM32L1.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- 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() {
