mbed support for the Maple Mini boards.
Dependents: MapleMini_USBSerial MapleMiniPeripherals MapleMini_Hello DHT11_USBSerial ... more
Diff: SysClockConf.cpp
- Revision:
- 1:7b9d53d8e473
- Parent:
- 0:0ced269d2669
- Child:
- 3:f0b2ddbf8ba6
diff -r 0ced269d2669 -r 7b9d53d8e473 SysClockConf.cpp --- a/SysClockConf.cpp Sun Jul 17 08:44:20 2016 +0000 +++ b/SysClockConf.cpp Tue Aug 02 20:04:31 2016 +0000 @@ -29,7 +29,7 @@ #include "SysClockConf.h" #include "mbed.h" -bool HSE_SystemClock_Config(int freq) { +bool HSE_SystemClock_Config(void) { RCC_OscInitTypeDef RCC_OscInitStruct; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; @@ -37,16 +37,7 @@ RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; - switch(freq) { - case 36: - RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; - break; - case 48: - RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL6; - break; - default: - RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; - } + RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) { return false; @@ -67,26 +58,17 @@ RCC_PeriphCLKInitTypeDef PeriphClkInit; PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC|RCC_PERIPHCLK_USB; - switch(freq) { - case 36: - PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; - break; - case 48: - PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV4; - break; - default: - PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; - } - PeriphClkInit.UsbClockSelection = RCC_USBPLLCLK_DIV1; + PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; + PeriphClkInit.UsbClockSelection = RCC_USBPLLCLK_DIV1_5; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { return false; } return true; } -bool confSysClock(int freq) { +bool confSysClock(void) { HAL_RCC_DeInit(); - if (!HSE_SystemClock_Config(freq)) { + if (!HSE_SystemClock_Config()) { return false; } SystemCoreClockUpdate(); @@ -94,3 +76,5 @@ } + +