LIbreria de soporte para la STM32F103C8T6 "Blue Pill" by Antuliu's Team
Dependents: STM32-103C8_Plantilla_USB
Diff: SysClockConf.cpp
- Revision:
- 11:e0edd7ea602a
- Parent:
- 8:2582ee8cc84c
- Child:
- 12:727468adfd1d
diff -r a8ae65117a29 -r e0edd7ea602a SysClockConf.cpp --- a/SysClockConf.cpp Sat May 27 09:54:20 2017 +0000 +++ b/SysClockConf.cpp Sat May 27 16:25:10 2017 +0000 @@ -29,12 +29,13 @@ #include "SysClockConf.h" #include "mbed.h" -extern volatile uint32_t tim_it_counter; -volatile uint32_t tim_init; +extern volatile uint32_t tim_it_counter; +volatile uint32_t tim_init; void HSE_SystemClock_Config(void) { - RCC_OscInitTypeDef RCC_OscInitStruct; - RCC_ClkInitTypeDef RCC_ClkInitStruct; + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + RCC_PeriphCLKInitTypeDef PeriphClkInit; RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; RCC_OscInitStruct.HSEState = RCC_HSE_ON; @@ -43,24 +44,21 @@ RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; HAL_RCC_OscConfig(&RCC_OscInitStruct); - RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK - |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2); - RCC_PeriphCLKInitTypeDef PeriphClkInit; PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC|RCC_PERIPHCLK_USB; PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5; HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit); } -bool confSysClock(void) { +void confSysClock(void) { tim_init = tim_it_counter; HAL_RCC_DeInit(); HSE_SystemClock_Config(); SystemCoreClockUpdate(); - return true; }