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