#define RCC_SYSCLKSource_HSI ((u32)0x00000000)
/* AHB clock source */
#define RCC_SYSCLK_Div1 ((u32)0x00000000) // AHB 时钟 = 系统时钟 ;
#define RCC_SYSCLK_Div2 ((u32)0x00000080) // AHB 时钟 = 系统时钟/2 ;
#define RCC_SYSCLK_Div4 ((u32)0x00000090) // AHB 时钟 = 系统时钟/4 ;
#define RCC_HCLK_Div4 ((u32)0x00000500) // APBx 时钟 = HCLK/4 ;
/*******************************************************************************
* Function Name : RCC_Configuration
* Description : Configures the different system clocks.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void RCC_Configuration(void)
{
RCC_HSICmd(ENABLE);//使能内部高速晶振 ;
RCC_SYSCLKConfig(RCC_SYSCLKSource_HSI);//选择内部高速时钟作为系统时钟SYSCLOCK=8MHZ
RCC_HCLKConfig(RCC_SYSCLK_Div1);//选择HCLK时钟源为系统时钟SYYSCLOCK
RCC_PCLK1Config(RCC_HCLK_Div4);//APB1时钟为2M
RCC_PCLK2Config(RCC_HCLK_Div4);//APB2时钟为2M
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB , ENABLE);//使能APB2外设GPIOB时钟
}
/*******************************************************************************
* Function Name : RCC_HSICmd
* Description : Enables or disables the Internal High Speed oscillator (HSI).
* HSI can not be stopped if it is used directly or through the
* PLL as system clock.
* Input : - NewState: new state of the HSI.
* This parameter can be: ENABLE or DISABLE.
* Output : None
* Return : None
* 功能 : 使能或者失能内部高速晶振(HSI)
*******************************************************************************/
void RCC_HSI