RCC_APB2PeriphClockCmd; RCC_APB1PeriphClockCmd(
来源:互联网 发布:酒店网络营销策划 编辑:程序博客网 时间:2024/05/17 22:14
/******************************************************************************** Function Name : RCC_APB2PeriphClockCmd* Description : Enables or disables the High Speed APB (APB2) peripheral clock.* Input : - RCC_APB2Periph: specifies the APB2 peripheral to gates its* clock.* This parameter can be any combination of the following values:* - RCC_APB2Periph_AFIO, RCC_APB2Periph_GPIOA, RCC_APB2Periph_GPIOB,* RCC_APB2Periph_GPIOC, RCC_APB2Periph_GPIOD, RCC_APB2Periph_GPIOE,* RCC_APB2Periph_GPIOF, RCC_APB2Periph_GPIOG, RCC_APB2Periph_ADC1,* RCC_APB2Periph_ADC2, RCC_APB2Periph_TIM1, RCC_APB2Periph_SPI1,* RCC_APB2Periph_TIM8, RCC_APB2Periph_USART1, RCC_APB2Periph_ADC3,* RCC_APB2Periph_ALL* - NewState: new state of the specified peripheral clock.* This parameter can be: ENABLE or DISABLE.* Output : None* Return : None*******************************************************************************/void RCC_APB2PeriphClockCmd(u32 RCC_APB2Periph, FunctionalState NewState){ /* Check the parameters */ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB2ENR |= RCC_APB2Periph; } else { RCC->APB2ENR &= ~RCC_APB2Periph; }}/******************************************************************************** Function Name : RCC_APB1PeriphClockCmd* Description : Enables or disables the Low Speed APB (APB1) peripheral clock.* Input : - RCC_APB1Periph: specifies the APB1 peripheral to gates its* clock.* This parameter can be any combination of the following values:* - RCC_APB1Periph_TIM2, RCC_APB1Periph_TIM3, RCC_APB1Periph_TIM4,* RCC_APB1Periph_TIM5, RCC_APB1Periph_TIM6, RCC_APB1Periph_TIM7,* RCC_APB1Periph_WWDG, RCC_APB1Periph_SPI2, RCC_APB1Periph_SPI3,* RCC_APB1Periph_USART2, RCC_APB1Periph_USART3, RCC_APB1Periph_USART4, * RCC_APB1Periph_USART5, RCC_APB1Periph_I2C1, RCC_APB1Periph_I2C2,* RCC_APB1Periph_USB, RCC_APB1Periph_CAN, RCC_APB1Periph_BKP,* RCC_APB1Periph_PWR, RCC_APB1Periph_DAC, RCC_APB1Periph_ALL* - NewState: new state of the specified peripheral clock.* This parameter can be: ENABLE or DISABLE.* Output : None* Return : None*******************************************************************************/void RCC_APB1PeriphClockCmd(u32 RCC_APB1Periph, FunctionalState NewState){ /* Check the parameters */ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB1ENR |= RCC_APB1Periph; } else { RCC->APB1ENR &= ~RCC_APB1Periph; }}