Danillo Mangue Baja

Dependents:   STM32_StrainGauge

Revision:
5:9fbbea76d6f6
Parent:
4:306609fe9dc8
Child:
8:2582ee8cc84c
--- a/SysClockConf.cpp	Tue Jul 05 21:02:59 2016 +0000
+++ b/SysClockConf.cpp	Tue Aug 02 19:37:40 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,4 @@
 }
 
 
+