TA的每日心情 | 怒 2023-7-25 22:49 |
---|
签到天数: 385 天 连续签到: 1 天 [LV.9]以坛为家II
|
Naming conventions
STM32库标识符命名规则
The STM32F10x Standard Peripherals Library uses the following naming conventions:
STM32F10x 标准外设库使用如下的命名规则
PPP refers to any peripheral acronym, for example ADC.
PPP表示外设缩写,比如ADC
System and source/header file names are preceded by the prefix ‘stm32f10x_’.
系统文件或者源文件以及头文件名以stm32f10x_作为前缀
Constants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
All constants are written in upper case.
常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写
Registers are considered as constants. Their names are in upper case.
In most cases, the same acronyms as in the STM32F10x reference manual document are used.
寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。
Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore.
The first letter in each word is in upper case, for example USART_SendData.
Only one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name.
外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。
Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init.
用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。
Functions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.
用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.
Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit.
用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit
Functions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd.
用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.
Functions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig.
用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.
Functions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig.
用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.
Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig.
用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.
Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus.
用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.
Functions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag.
用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.
Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus.
用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.
Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit.
用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.
希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分
另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”
外设缩写
ADC
Analog/digital converter
BKP
Backup registers
CAN
Controller area network
CEC
Consumer Electronics Control
CRC
CRC calculation unit
DAC
Digital to analog converter
DBGMCU
Debug MCU
DMA
DMA controller
EXTI
External interrupt/event controller
FSMC
Flexible static memory controller
FLASH
Flash memory
GPIO
General purpose I/O
I2C
Inter-integrated circuit
I2S
Inter-integrated sound
IWDG
Independent watchdog
NVIC
Nested vectored interrupt controller
PWR
Power controller
RCC
Reset and clock controller
RTC
Reset and clock controller
SDIO
SDIO interface
SPI
Serial peripheral interface
SysTick
System tick timer
TIM
Advanced-control, general-purpose or basic timer
USART
Universal synchronous asynchronous receiver transmitter
WWDG
Window watchdog
|
评分
-
查看全部评分
|