Francisco Sarabia / Mbed 2 deprecated STM32F103C8T6_Matrizgauss

Dependencies:   mbed

Committer:
franciscos
Date:
Wed Mar 04 00:51:01 2020 +0000
Revision:
0:f16f5fb2d1b9
esime;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
franciscos 0:f16f5fb2d1b9 1 /*
franciscos 0:f16f5fb2d1b9 2 ******************************************************************************
franciscos 0:f16f5fb2d1b9 3 * @file SysClockConf.c
franciscos 0:f16f5fb2d1b9 4 * @version
franciscos 0:f16f5fb2d1b9 5 * @date 05-July-2016
franciscos 0:f16f5fb2d1b9 6 * @brief System Clock configuration for STM32F103C8T6
franciscos 0:f16f5fb2d1b9 7 *****************************************************************************
franciscos 0:f16f5fb2d1b9 8 *
franciscos 0:f16f5fb2d1b9 9 * All rights reserved.
franciscos 0:f16f5fb2d1b9 10
franciscos 0:f16f5fb2d1b9 11 This program is free software: you can redistribute it and/or modify
franciscos 0:f16f5fb2d1b9 12 it under the terms of the GNU General Public License as published by
franciscos 0:f16f5fb2d1b9 13 the Free Software Foundation, either version 3 of the License, or
franciscos 0:f16f5fb2d1b9 14 (at your option) any later version.
franciscos 0:f16f5fb2d1b9 15
franciscos 0:f16f5fb2d1b9 16 This program is distributed in the hope that it will be useful,
franciscos 0:f16f5fb2d1b9 17 but WITHOUT ANY WARRANTY; without even the implied warranty of
franciscos 0:f16f5fb2d1b9 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
franciscos 0:f16f5fb2d1b9 19 GNU General Public License for more details.
franciscos 0:f16f5fb2d1b9 20
franciscos 0:f16f5fb2d1b9 21 You should have received a copy of the GNU General Public License
franciscos 0:f16f5fb2d1b9 22 along with this program. If not, see <http://www.gnu.org/licenses/>.
franciscos 0:f16f5fb2d1b9 23 */
franciscos 0:f16f5fb2d1b9 24
franciscos 0:f16f5fb2d1b9 25 #include "SysClockConf.h"
franciscos 0:f16f5fb2d1b9 26 #include "mbed.h"
franciscos 0:f16f5fb2d1b9 27
franciscos 0:f16f5fb2d1b9 28 void HSE_SystemClock_Config(void) {
franciscos 0:f16f5fb2d1b9 29 RCC_OscInitTypeDef RCC_OscInitStruct;
franciscos 0:f16f5fb2d1b9 30 RCC_ClkInitTypeDef RCC_ClkInitStruct;
franciscos 0:f16f5fb2d1b9 31 RCC_PeriphCLKInitTypeDef PeriphClkInit;
franciscos 0:f16f5fb2d1b9 32
franciscos 0:f16f5fb2d1b9 33 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
franciscos 0:f16f5fb2d1b9 34 RCC_OscInitStruct.HSEState = RCC_HSE_ON;
franciscos 0:f16f5fb2d1b9 35 RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1;
franciscos 0:f16f5fb2d1b9 36 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
franciscos 0:f16f5fb2d1b9 37 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
franciscos 0:f16f5fb2d1b9 38 RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9;
franciscos 0:f16f5fb2d1b9 39 HAL_RCC_OscConfig(&RCC_OscInitStruct);
franciscos 0:f16f5fb2d1b9 40 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
franciscos 0:f16f5fb2d1b9 41 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
franciscos 0:f16f5fb2d1b9 42 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
franciscos 0:f16f5fb2d1b9 43 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2;
franciscos 0:f16f5fb2d1b9 44 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
franciscos 0:f16f5fb2d1b9 45 HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2);
franciscos 0:f16f5fb2d1b9 46 PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC|RCC_PERIPHCLK_USB;
franciscos 0:f16f5fb2d1b9 47 PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
franciscos 0:f16f5fb2d1b9 48 PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5;
franciscos 0:f16f5fb2d1b9 49 HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit);
franciscos 0:f16f5fb2d1b9 50 }
franciscos 0:f16f5fb2d1b9 51
franciscos 0:f16f5fb2d1b9 52 void confSysClock(void) {
franciscos 0:f16f5fb2d1b9 53 HAL_RCC_DeInit();
franciscos 0:f16f5fb2d1b9 54 HSE_SystemClock_Config();
franciscos 0:f16f5fb2d1b9 55 SystemCoreClockUpdate();
franciscos 0:f16f5fb2d1b9 56 }