Programa Gauss Jordan.

Dependencies:   mbed

Committer:
JavierMarcelo98
Date:
Fri Oct 25 14:20:28 2019 +0000
Revision:
15:9199611a074f
Parent:
14:596a61f27f36
Programa Gauss Jordan.

Who changed what in which revision?

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