Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-MapleMini by
SysClockConf.cpp
00001 /* 00002 ****************************************************************************** 00003 * @file SysClockConf.c 00004 * @author Zoltan Hudak 00005 * @version 00006 * @date 05-July-2016 00007 * @brief System Clock configuration for Maple Mini 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2016 Zoltan Hudak <hudakz@inbox.com> 00012 * 00013 * All rights reserved. 00014 00015 This program is free software: you can redistribute it and/or modify 00016 it under the terms of the GNU General Public License as published by 00017 the Free Software Foundation, either version 3 of the License, or 00018 (at your option) any later version. 00019 00020 This program is distributed in the hope that it will be useful, 00021 but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 GNU General Public License for more details. 00024 00025 You should have received a copy of the GNU General Public License 00026 along with this program. If not, see <http://www.gnu.org/licenses/>. 00027 */ 00028 00029 #include "SysClockConf.h" 00030 #include "mbed.h" 00031 00032 #include "SysClockConf.h" 00033 #include "mbed.h" 00034 00035 void HSE_SystemClock_Config(void) { 00036 RCC_OscInitTypeDef RCC_OscInitStruct; 00037 RCC_ClkInitTypeDef RCC_ClkInitStruct; 00038 RCC_PeriphCLKInitTypeDef PeriphClkInit; 00039 00040 RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; 00041 RCC_OscInitStruct.HSEState = RCC_HSE_ON; 00042 RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV1; 00043 RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; 00044 RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; 00045 RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL9; 00046 HAL_RCC_OscConfig(&RCC_OscInitStruct); 00047 RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; 00048 RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; 00049 RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 00050 RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; 00051 RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; 00052 HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2); 00053 PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC|RCC_PERIPHCLK_USB; 00054 PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6; 00055 PeriphClkInit.UsbClockSelection = RCC_USBCLKSOURCE_PLL_DIV1_5; 00056 HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit); 00057 } 00058 00059 void confSysClock(void) { 00060 HAL_RCC_DeInit(); 00061 HSE_SystemClock_Config(); 00062 SystemCoreClockUpdate(); 00063 } 00064 00065 00066 00067 00068
Generated on Sun Jul 24 2022 03:33:10 by
1.7.2
