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.
Dependents: IsuProject_LPC1768 Gemini_Soloist_LPC1768 OSCtoCVConverter
ClockControl.cpp
00001 #include "ClockControl.h" 00002 00003 void setPLL0Frequency(unsigned char clkSrc, unsigned short cfg_m, unsigned char cfg_n) 00004 { 00005 LPC_SC->CLKSRCSEL = clkSrc; 00006 LPC_SC->PLL0CFG = (((unsigned int)cfg_n-1) << 16) | cfg_m-1; 00007 LPC_SC->PLL0CON = 0x01; 00008 LPC_SC->PLL0FEED = 0xAA; 00009 LPC_SC->PLL0FEED = 0x55; 00010 while (!(LPC_SC->PLL0STAT & (1<<26))); 00011 00012 LPC_SC->PLL0CON = 0x03; 00013 LPC_SC->PLL0FEED = 0xAA; 00014 LPC_SC->PLL0FEED = 0x55; 00015 } 00016 00017 void setPLL1Frequency(unsigned char clkSrc, unsigned short cfg_m, unsigned char cfg_n) 00018 { 00019 LPC_SC->CLKSRCSEL = clkSrc; 00020 LPC_SC->PLL1CFG = (((unsigned int)cfg_n-1) << 16) | cfg_m-1; 00021 LPC_SC->PLL1CON = 0x01; 00022 LPC_SC->PLL1FEED = 0xAA; 00023 LPC_SC->PLL1FEED = 0x55; 00024 while (!(LPC_SC->PLL1STAT & (1<<26))); 00025 00026 LPC_SC->PLL1CON = 0x03; 00027 LPC_SC->PLL1FEED = 0xAA; 00028 LPC_SC->PLL1FEED = 0x55; 00029 } 00030 00031 unsigned int setSystemFrequency(unsigned char clkDivider, unsigned char clkSrc, unsigned short cfg_m, unsigned char cfg_n) 00032 { 00033 setPLL0Frequency(clkSrc, cfg_m, cfg_n); 00034 LPC_SC->CCLKCFG = clkDivider - 1; 00035 SystemCoreClockUpdate(); 00036 return SystemCoreClock; 00037 }
Generated on Tue Jul 19 2022 01:25:52 by
1.7.2