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