STM32F303X单片机USB例程详细解析2
来源:互联网 发布:美工课教案 编辑:程序博客网 时间:2024/05/19 21:16
接上一篇文章。继续void Set_System(void)的分析。
1.2 RCC_APB2PeriphClockCmd()
位于USB_Example\Libraries\STM32F30x_StdPeriph_Driver\src\stm32f30x_rcc.c文件中。其主要功能也是使能或禁止外设时钟,不过是APB2总线上的。
/**
* @brief Enables or disables the High Speed APB (APB2) peripheral clock.
* @note After reset, the peripheral clock (used for registers read/write access)
* is disabled and the application software has to enable this clock before
* using it.
* @param RCC_APB2Periph: specifies the APB2 peripheral to gates its clock.
* This parameter can be any combination of the following values:
* @arg RCC_APB2Periph_SYSCFG
* @arg RCC_APB2Periph_SPI1
* @arg RCC_APB2Periph_USART1
* @arg RCC_APB2Periph_TIM15
* @arg RCC_APB2Periph_TIM16
* @arg RCC_APB2Periph_TIM17
* @arg RCC_APB2Periph_TIM1
* @arg RCC_APB2Periph_TIM8
* @param NewState: new state of the specified peripheral clock.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph));
assert_param(IS_FUNCTIONAL_STATE(NewState));
* @brief Enables or disables the High Speed APB (APB2) peripheral clock.
* @note After reset, the peripheral clock (used for registers read/write access)
* is disabled and the application software has to enable this clock before
* using it.
* @param RCC_APB2Periph: specifies the APB2 peripheral to gates its clock.
* This parameter can be any combination of the following values:
* @arg RCC_APB2Periph_SYSCFG
* @arg RCC_APB2Periph_SPI1
* @arg RCC_APB2Periph_USART1
* @arg RCC_APB2Periph_TIM15
* @arg RCC_APB2Periph_TIM16
* @arg RCC_APB2Periph_TIM17
* @arg RCC_APB2Periph_TIM1
* @arg RCC_APB2Periph_TIM8
* @param NewState: new state of the specified peripheral clock.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void RCC_APB2PeriphClockCmd(uint32_t 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;
}
}
{
RCC->APB2ENR |= RCC_APB2Periph;
}
else
{
RCC->APB2ENR &= ~RCC_APB2Periph;
}
}
RCC、APB3ENR的说明见前一篇文章,在此不再赘述。
“1. Set_System()”中调用RCC_APB2PeriphClockCmd()时传入的第一个参数RCC_APB2Periph_SYSCFG在USB_Example\Libraries\STM32F30x_StdPeriph_Driver\inc\stm32f30x_rcc.h中定义:
#define RCC_APB2Periph_SYSCFG ((uint32_t)0x00000001)
对应手册P120中"Bit 0 SYSCFGEN: SYSCFG clock enable"。
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE); --------> 1.2 所实现功能如其注释所述,使能系统配置控制器时钟。
0 0
- STM32F303X单片机USB例程详细解析2
- STM32F303X单片机USB例程详细解析1
- STM32F303X单片机USB例程详细解析3
- STM32F303X单片机USB例程详细解析4
- 基于单片机的modbus例程详细
- 单片机 IIC 总线协议 和 详细例程
- 详细解析STM32单片机
- USB控制传输过程 详细解析
- 单片机中断例程
- directshow之filters 例程BALL的详细解析
- KSDK USB 例程分析
- C51单片机-串行口2-蓝牙模块-应用例程
- 单片机的数字时钟例程
- 单片机驱动直流电机的例程
- 基于单片机的信号发生器例程
- 单片机的无线数据传输例程
- OMNet++ Tic Toc例程的解析2
- usb单片机程序
- 秒杀多线程第四篇 一个经典的多线程同步问题
- MyBatis学习六:缓存
- Intel Edison 移植boa
- Maven那点事儿(Eclipse版)
- 最近迷惑的地方
- STM32F303X单片机USB例程详细解析2
- 剑指offer系列之五十:构建乘积数组
- 关于CRC校验进行完整性检查实现
- SVN:使用命令行模式访问SVN服务器
- 积跬步,聚小流------关闭iphone浏览器自动识别数字为电话号码
- 详细解析mtk android5.1(mt6580/mt8321)的display system
- 关于servlet开发时,web.xml的配置问题。
- 秒杀多线程第五篇 经典线程同步 关键段CS
- Android性能中容易忽视的优化点有哪些?