|
Naming conventions STM32库标识符命名规则 0 _. r: f% W5 j The STM32F10x Standard Peripherals Library uses the following naming conventions: & v: F3 }5 ^ c c% q+ P) [$ r) _* \ STM32F10x 标准外设库使用如下的命名规则 2 ?2 `1 d' ^, b, Q) x PPP refers to any peripheral acronym, for example ADC. * ]! f2 A4 X$ e% Q PPP表示外设缩写,比如ADC System and source/header file names are preceded by the prefix ‘stm32f10x_’. 系统文件或者源文件以及头文件名以stm32f10x_作为前缀' N/ i* M! ] B( ~8 a' v, s G 6 s) w3 d [( s( V# @6 a 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. 0 |) o7 h. h/ b& J6 v8 o 常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写3 \4 j4 S# @8 h, _+ J5 q 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. : j4 w5 w% y1 n) V 寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。 0 a! {8 }6 s6 D6 {; O0 A 1 y# |$ O* l H C+ Q' d Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore. 0 T5 Z; \7 t& |9 q- n0 }) O The first letter in each word is in upper case, for example USART_SendData. : {& G5 U" h/ O Only one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name. 外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。7 \5 V0 f9 r- ^ Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init. , o, Y5 H# b; u2 ~1 T# \$ V 用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。. o) i& a! w- Q; e" N1 e ( k# E x. b% j( I ) e( I/ ]+ h: T/ a4 `0 A& s, k& S* k Functions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit. * a1 w7 G' d: i5 U- ~( R9 v4 E% I 用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit., `+ W o# x- E7 B* y- b7 q2 M- r * F9 G% o0 T/ f1 m8 Y# v% Q 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 : O" r: K2 Q3 z Functions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd. 用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.4 K2 w% _9 U* t1 n; r1 z- { ( z3 T0 c1 n. b4 x9 b q7 Y1 o( H0 d* w# E 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.* \' d9 d& D; _4 d+ V% a. h 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. ) A1 ]$ Q$ Y, V: {( Q( ^" K Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig. $ [0 q* U4 u; s% J* A! C4 j, _4 w/ {( j 用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig. ) |7 A: h' ]2 ? Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus. 用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus. 1 n, e, @! d+ a " `+ v9 m% d# T# x. Z! J, Y* P/ v Functions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag. 用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.! P% {8 \6 q* p( W 7 Z3 g* w) M6 H$ K; v , D# `6 S `0 `9 ?2 h1 r Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus. 6 ]& h( y: w# t. o) w6 _$ f 用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus. / ]: V$ D7 i _, i$ k" P# [: ^ Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit. ' f. P- s. E5 ~: i7 l; @; W+ y 用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.9 R2 P) F, A/ L5 E6 ^: ^ 希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分 另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”$ E- G( |, k" w' z. _) R1 u 6 l, b1 {$ s9 i/ j, l 6 c( y7 ^7 \# }4 c; w4 i 外设缩写! q% y, g; X9 s ( Q1 E& U, @5 x5 t0 o* i) ] , A: @: j2 {) p u7 {. x8 q ADC Analog/digital converter . c4 L9 B, t" P% L7 G; L% d) ? E% Z7 E. w" y2 q BKP ! |! ?) `1 ^- l: W% c) k4 f Backup registers / g& e' @3 }* Q4 K6 Z, r1 u) t / s L% c9 p! n& a, P" Y* @) N' r CAN Controller area network $ L. w( H# X+ t i. ^3 }$ @ CEC Consumer Electronics Control ( i- O& E. B3 O! x' { ) w! v+ J, O# J( p+ j/ }7 ]' \ , @# e ^; z1 N- p% p CRC CRC calculation unit / H, j/ A4 `) S3 R7 |, l( ` DAC Digital to analog converter DBGMCU $ @, ^- K( `# q: g9 W0 W9 Z Debug MCU , l7 R6 o; ^: V9 j9 I8 s DMA ' r& n! y7 n! L7 o" U: J DMA controller 8 V2 N( S; I8 \ 8 I; {; g1 b7 T% y } EXTI External interrupt/event controller % D# G+ u$ s2 k6 y) q- r, w# A3 k - H7 h; B/ o! o8 ` FSMC Flexible static memory controller 3 j9 C* x0 \! Y) U FLASH Flash memory 6 ]0 @# p2 P, M. f/ E# v . K- p9 H6 ?. P- g1 @6 T GPIO General purpose I/O 2 |9 d7 ^$ Z. s9 Z% ?6 h I2C Inter-integrated circuit ) P7 ~1 K; k- K p7 @2 z8 y G * d5 E- I% ^% A& Z6 f r I2S ' ^ ]# `: t8 N/ i6 e4 ?- M q6 _. o Inter-integrated sound 4 t1 Q E+ a7 K( P: l5 N( P7 } ' O4 K$ v4 E* O ; T4 ]$ |* J5 b: M; T IWDG 6 J9 r1 q! e# o" U5 L6 V. K( O Independent watchdog # ]/ t& X% O" { Y2 L0 F, b 5 O2 K$ o0 @% J3 y0 \, r" b NVIC Nested vectored interrupt controller 1 L f, a2 p6 ] ?# r5 }; i PWR 4 B. |; D4 |$ j9 @! g7 V! H2 J) y+ S Power controller RCC $ H8 r& A7 U4 J: v! T Reset and clock controller ^: { B, b$ d% s5 {2 N RTC Reset and clock controller 4 E5 b% Z4 ~9 V/ w: a1 y1 v% X0 X T SDIO # K; ~8 p% v7 R% U3 ] SDIO interface 2 E+ t0 C" V; x: u$ w: d0 ^ ! n, v4 t: U8 W) L, |# h SPI ; c( E# s% Y. D Serial peripheral interface 3 Q$ G" V d' Y* Z; }# v SysTick System tick timer TIM Advanced-control, general-purpose or basic timer 9 C) G" I4 {! ]5 a9 @5 g5 b4 \6 D) a 5 j( {3 S8 a" ]0 F5 k USART Universal synchronous asynchronous receiver transmitter 9 h" d9 l$ A3 J, D2 w 1 h, D; u, A/ V& i' B1 s WWDG - {2 P/ O! D2 S" G8 H' x, H Window watchdog : |( T5 e6 F9 o( e |
微信公众号
手机版
一起学习,共同进步
水经验,你可以不看啊。