|
Naming conventions STM32库标识符命名规则% S. S+ B9 n: x2 ^ ' z& @- y+ o$ L7 u* ` The STM32F10x Standard Peripherals Library uses the following naming conventions: ! U8 ]' n( f, U STM32F10x 标准外设库使用如下的命名规则2 {) \9 |4 K/ t- e; s0 _ 7 L8 r# N$ m4 c! `( `6 k PPP refers to any peripheral acronym, for example ADC. PPP表示外设缩写,比如ADC* d- C$ I* j$ b- v" W8 H: r, E System and source/header file names are preceded by the prefix ‘stm32f10x_’. ! c. n0 Q) w: Z' a3 e' v* a 系统文件或者源文件以及头文件名以stm32f10x_作为前缀( n) k. h+ B5 R) d/ c7 C! U % h! F6 V# G" Y$ P( l$ T: B" X 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. ! b: l3 d- T [! ]4 B' E1 E1 }. f3 O 常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写0 b& n0 }/ R3 P" T9 C2 | Registers are considered as constants. Their names are in upper case. % B3 g. M9 E' a A! Q1 K In most cases, the same acronyms as in the STM32F10x reference manual document are used. 4 E4 y/ |) A" e 寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。 - M* N. N0 K, F2 D2 H# g Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore. 0 H# W$ F S! ~! T5 I! a0 Y. Y* o The first letter in each word is in upper case, for example USART_SendData. % |- h/ _+ B# y$ w Only one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name. 外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。 ( j, R; t# {9 @4 b# f2 Q - ~+ C2 r: H* R2 l" g7 |, u3 H4 n 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外设。/ R5 C( Q) i- c$ i4 s 1 c5 i8 |+ P* y O. P3 j 5 v+ J8 ^9 Z7 C9 s 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. $ r! v$ n' ^. o" F7 G5 C Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit. 6 s8 z7 z# H6 |- S 用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit 9 X+ S! ?+ v9 L8 Y. n) y Functions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd. 4 L' u5 l9 y2 W: }. | 用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd., v: m0 U3 y! E+ [: Q0 k# H # u. t9 s+ L3 C Functions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig. ) o& D' K, V! y, }# ? 用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.# g# i# [2 S* ^3 v, ^; z' r8 M }- R( o4 ]. \8 R' q# o1 u 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. 3 T5 G% L# @' k k Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig. 用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.3 Z! J! R$ \7 j' \. _! { . V* m A7 m1 b9 F1 D* H8 b Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus. 用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus. ! o; O; F( U# i0 t) U& o5 i * ~: L6 y, p8 B2 k/ H Functions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag. 1 P9 E* o: S* q6 Y 用于清除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.- O2 l) N: a9 b 3 i5 s7 U" q& i/ I Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit. 用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.& Y% q' B9 j. o# g( j, w1 z ; A1 A! [& u# |* [" r( w4 W* }* x3 T 希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分 另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”2 G" k3 V8 M* W& \; P ! b K( a; E) V; } # ^5 R$ y4 r4 p' L5 h' h 外设缩写8 D, k6 O |( Y: {, A" B: T 4 a8 W8 I! I5 m% U ADC Analog/digital converter % H$ g1 y' z% O1 G T1 W : B$ d! |0 o4 ? E/ ?: o BKP / L6 |' i: {, V) { Backup registers % o/ A* { Y4 O7 D; ~7 w / M2 Y9 S9 C+ `9 b- ^ 7 d7 N" I/ C- Q$ @ ]+ @5 N CAN 1 j y+ t: }) `: H5 ] Controller area network ) e [8 D9 x w CEC `; h0 l7 K Z5 h Consumer Electronics Control ) x5 f1 T( ^! ~& f! q* H CRC , }( I- h2 i) P% G+ P' T8 d7 |5 p9 \ CRC calculation unit : F6 ^" o/ o! \ 9 h+ S2 n7 R. a/ y7 p DAC Digital to analog converter DBGMCU - M- j6 [3 [8 i3 r! L Debug MCU 4 P1 }8 ~& I6 H; \1 V4 r* Q% P DMA DMA controller 9 R9 k4 Z& j: i) h! b& ^ EXTI External interrupt/event controller 7 L9 \$ h0 C5 L# d6 a4 B& L FSMC - _1 s% G+ p0 M Flexible static memory controller & Z4 m& s7 F4 T, ~' W7 t % n0 H- t( [) v8 l" S. @% a FLASH Flash memory 5 s# I% Y0 P- w0 B; X 4 _4 U j/ K) T% [6 y# L% L GPIO L' ]2 m, d4 \ General purpose I/O : y0 a2 _3 j$ `8 z / D7 H* w5 I6 k: m8 K& ]4 E5 x3 A I2C 9 N" _. ~: v" Z& a- X Inter-integrated circuit / W1 U5 m; @$ } ~- |( ] I2S Inter-integrated sound 6 |2 I+ e2 l( K6 N$ _: b & L. ^! J! b# ~: C; K/ q IWDG 9 q( f& C+ a2 t/ v4 `, o Independent watchdog + l' t3 r& N6 k" b6 l 4 Q& k2 j. ~9 I5 H! G% h# ]! a( M; T NVIC $ F2 K: ^( l+ O+ D Nested vectored interrupt controller R! T% y. Z: \( Z6 V, x; ]4 y( w 6 Q+ c) K$ Q: e8 Y% s% @% O3 V* S+ n PWR S9 E8 j; e5 I) x2 u& ` Power controller ! P0 ?. h* O+ c * m# a& J6 D1 {7 z; z$ k $ V5 G1 @3 T2 { RCC - d6 C3 S8 Z' d Reset and clock controller & z* r7 a8 Q5 J RTC 9 j2 V, s5 d: b$ X Reset and clock controller 7 s$ S1 H8 o1 ~, j . ^4 }/ ?# l8 f0 j& x! T1 n ) x; b# s, ]0 H+ Z% ^7 E; u; ` SDIO 2 ^2 `& U2 T! E" ~ SDIO interface - S9 i: t7 r5 w' A+ P. R) H " [3 F$ h, U6 D! V/ T / r" w8 y. a! ?% I0 U P4 y( i) { SPI Serial peripheral interface 1 E. ]2 W) o4 O+ o/ T- n SysTick System tick timer ( o: e( D/ V3 v 7 \, v3 U4 H4 b6 O$ M' a TIM 8 `+ Y" |2 \( |! s" u. w Advanced-control, general-purpose or basic timer r6 G" Z" e' y% ?% o% T) a 7 ]# t$ @. B* c1 N2 T& g# e USART Universal synchronous asynchronous receiver transmitter 5 Y* V: O8 i; K% e3 g 6 a* C8 }5 k# Z& H WWDG ; P; _3 ~ {3 O3 M) _; w Window watchdog 6 `3 R* ^+ \) k* t: q8 s, T; C |
微信公众号
手机版
一起学习,共同进步
水经验,你可以不看啊。