你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions 6 u. A$ f, I- q) G; m1 U
STM32库标识符命名规则
* z7 Q. V6 y0 j0 j: W# G
3 }9 Y+ @, `# ?$ L: r( v

9 t$ d* }% O% aThe STM32F10x Standard Peripherals Library uses the following naming conventions: / E( h5 y/ |' D
STM32F10x 标准外设库使用如下的命名规则# o* \6 p, r" Q) ?5 D% a

% ?8 q2 ?( g1 |+ X7 T7 s7 f

: w7 y$ f5 ]# ]1 bPPP refers to any peripheral acronym, for example ADC. 1 y) n5 S3 U# |
PPP表示外设缩写,比如ADC! d! y: ?6 {5 R
System and source/header file names are preceded by the prefix ‘stm32f10x_’. & w7 N9 v1 A+ W/ Q2 o, f' Y
系统文件或者源文件以及头文件名以stm32f10x_作为前缀" L' I2 R' g" H1 ?) ~+ h& [

& t3 z3 x/ ^" L, u& W, ^3 S) Q

$ j& N" F$ f$ ]4 y5 h: _, PConstants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
5 [1 M. L5 L, BAll constants are written in upper case. 3 X: k. n3 P" f' s/ y% k; J6 e. q* {
常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写
. Y0 t& e. ^) ~1 CRegisters are considered as constants. Their names are in upper case.
$ |- U% p  n. J8 wIn most cases, the same acronyms as in the STM32F10x reference manual document are used.
" P8 v; q6 {( y1 I. C% _9 B寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。. G9 {! h% _' V% Y
/ p& }, }; B9 {' H% a& Z( H
+ E$ f1 e) ^/ \& ]0 ~3 X* I
Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore.
, ^7 d( M3 h$ Q3 s5 p3 eThe first letter in each word is in upper case, for example USART_SendData. 3 X( y: W6 n+ \, y( a9 b
Only one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name.
) j' W3 i7 {7 Y7 \外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。
4 Y/ b& J& h' }3 b) W
! j4 h: S; j- M5 |
0 A' Z. w  u+ m% q6 e# T  T0 c
Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init. ! B$ t2 F* v+ W) I) n/ O0 J* `, Q
用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。
, K; m, H" M7 b2 K4 \
  }1 v% x3 p" o( l; |2 G

( U. B$ b# J$ B- e6 H+ M1 \Functions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.
+ Z2 S9 M( x- O0 j0 C/ Q用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.
$ y6 {5 @: T" m  Y9 u& S. Z- P
1 N5 V# ^  n, [
Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit. ! @0 `$ t6 n) B5 y
用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit( S8 ?( k9 ]5 B
5 m7 _+ _  t3 G9 {3 s

, u* X3 h. m, V7 v) f7 J0 [4 PFunctions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd.
% o/ y0 d7 W1 h$ g! ]& d% t* ^用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.. M, s0 Z& h) n# t8 e. F

, Q6 a9 q% B/ |! W- _
$ C2 e, V# p, |; c' A
Functions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig. 8 q/ u: B4 ?" g( ~% [* u3 _
用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.0 {6 \* o, g9 }5 ~0 X0 C1 u; `
/ s% K; S! `8 M+ V2 M+ Z. I

  C3 p; s+ |% Q6 Y# M/ ]( @  X7 dFunctions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig. & W4 q' G& z, I3 r! p
用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.0 G4 T7 h( \1 O$ N6 d/ B" a

+ y- k4 s, N; u! y- b0 V& g* f

* _1 q% F+ ~3 |5 B- SFunctions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig.
# ]* P; f) k, G/ I" z2 o用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.0 t% t! k9 W# o2 \( I, }4 ?
+ U2 l* y* b$ U8 G
# f" {; ]& q; I/ H0 D
Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus.
' e& I, b$ Y' o用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.
- q' I. ~  h" s  q( c; @* J% }- {9 ~! r/ A
3 T9 @6 F. w3 W$ b* q( q) \7 N5 s
Functions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag.   X2 I$ d8 h# A' g# N
用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.
; j, x: C: I8 \( I6 C
% e  A9 S$ V4 \, y$ I
7 Y0 C, y* ]7 O# O
Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus. 8 b# u+ e% L7 i" A6 n$ ]/ B/ E# D
用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.7 F! }; y7 C$ n6 r- Z# j) @

$ l8 v8 S( H6 r& s$ u, E) @
! L5 G$ D. h; h8 m6 Y2 _1 Q# w* ]" T
Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit. ! m; X% x. q3 M- C5 s  p) y
用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.
* s5 m7 y% X9 M  S0 I+ E* ?& K( n% ]* }* @* t' ?) T' U

9 L' @1 x* r4 L8 r希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分% x: ~/ `8 D# N
另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”- e8 s: q5 X' Z$ S$ E

8 }  d) a2 e7 i7 A2 a, u
- R2 o7 K( U3 ?/ A& c
外设缩写
( N& z+ P% ~% D' Q5 Y  k" U) Y8 ^$ X0 w9 C. Q7 B

0 D: v4 X! u5 v. V- y* Q/ rADC . S9 m1 A0 n* n( X! S& G0 r  C3 a: \9 |
  Analog/digital converter : E% S8 v# X2 S, _' q% {" w
: _7 y. B3 D! @7 i5 \! O
4 y6 [+ P6 A. |; U4 r& k' M
BKP
6 K  @6 [5 c4 N" j  Backup registers
3 n% Q; O1 M* h5 v: R" r8 X# Q4 z# d3 V; g0 G  f

- M1 N1 E+ E7 i1 QCAN
" T6 {+ c  p: x! L% ?# W3 R. @  Controller area network . y; B0 E" m: u: k9 ]

! W, r, a! X( ]
! Z( L& S/ m4 d
CEC
$ q& C2 t! \6 p" B" Y" G  Consumer Electronics Control
# C/ k  y, y2 E. V9 Z, [7 @! r0 I$ R! y7 I9 i0 P8 U: ~5 J4 U

2 q; T9 Z& j" ~. h* YCRC " `8 w, I, G$ a7 J
  CRC calculation unit 8 x8 ^4 E8 x: a4 I. q6 P6 t
% O% }+ N8 Q$ D; u2 g# a

# `2 w% b' z% lDAC , S) ?$ v( n( V( S0 F* a5 S
  Digital to analog converter
. K& W  L) z/ R! m6 z% }9 g( Y
! n5 V0 P* R( [: x$ c' w9 Q* L% Q+ r

7 O6 c, u7 q5 ]0 ~0 S3 Q" yDBGMCU 3 x; a; d" C) k
  Debug MCU ! K- ^" p( e8 s% a
( T7 j! q) G! j0 Y( N  m0 K7 e

' R# |( `7 Y: K" m  ^# n* wDMA
; O) A, x1 n0 [* z. M7 |# a5 Z  DMA controller
! M, d9 d2 J, q
7 x. P& K9 S4 e/ H0 g

/ y1 d* y; N2 k- }: A9 ~5 GEXTI # t' ]- l0 ~* C- ?1 `
  External interrupt/event controller 9 u8 j3 V& E8 o3 l8 [' x1 a9 e
( V# n! W+ q9 }
5 \/ u% o/ G0 G5 H
FSMC ; ^3 F2 ^* g. S
  Flexible static memory controller : L/ a7 x* j" k5 R

) L% j  o5 F$ t. H4 C
# X( J% A. O$ }& J. L* P
FLASH / F: I* [( g! F$ ]  l
Flash memory
9 `4 t. j/ p$ H) P, w" P0 \1 c& t6 O2 f& y# z# R* |

% c7 a5 R: s$ JGPIO . |$ T4 i( P: E9 m8 y; n5 O
  General purpose I/O
' r& W# S! _5 H8 [- `2 i8 Z
0 _" i( M( o1 d. w$ o! G4 u
: L3 S' k3 s  W. l
I2C
& g4 E$ [- I4 @9 p4 u  J  Inter-integrated circuit
+ K. I' G, y  C4 n+ Q% U6 j& D
% j1 c3 @2 x( j& i, n1 h6 q- P
2 p" ~- K* L. w6 ]9 n+ ^
I2S
( K- f) H9 X! t" L# d  Inter-integrated sound & i$ ?! x! c4 Q5 m$ m" U( Y+ g

1 {( S+ j! \  {8 y
9 `2 X3 d( T9 Q& c+ h2 e
IWDG 5 o1 w, P8 [8 P; F# f6 T
  Independent watchdog ) k8 n- p6 w6 V" J0 Q

! h* H( ^! o: {7 I+ _

# R( {6 @" Y) Z, z6 l# `NVIC
" z, n# l3 Z9 g6 O( H4 z  Nested vectored interrupt controller ' l+ y8 T- Z! N5 U0 Q/ s- z! T
, F, g, l& ]: u$ {" l" |- I$ K
& g+ N/ i3 G, Z, s) o6 u' g( X
PWR
, W4 |; ^3 a5 X, K6 A  Power controller * X7 j# J7 G; a  E
% {  N3 H2 J! S

3 J4 {: W2 [& J  W) ]/ ^RCC
1 L; v0 n  j: A  N( F3 s  Reset and clock controller
% l7 s) [9 x( n8 y
6 t2 C  n! c+ x8 v& o; [

* j2 _  g( s- |2 z* ^; LRTC * M& ^5 Z; m4 e3 j( ?
  Reset and clock controller
. i. r3 O' O9 l, J: K1 h# n  w$ t, k  x) N; y7 T4 V+ N5 a& a

* y% x5 |; L& ?SDIO + A2 P, b7 `( V, Y
SDIO interface
3 _6 z1 Z+ d! ^. b5 Q" I! |/ j/ @: V/ l: q/ o8 n

& V+ N, ]3 ], W1 e& ?- J+ aSPI - N7 K1 s* P. \# [. R
Serial peripheral interface $ p$ a0 ?) w9 C% l0 I

& @& K( `" a! G3 p. G8 ]; ^' z
" c& [1 J* d; T3 ^) ^
SysTick
9 \- O: ~' X$ i8 @, C: XSystem tick timer . e+ s: @4 v/ |: j
) V- e$ h; R' d4 f: H# l

, ]4 X7 p# s& |* z8 f2 oTIM ) Z9 `" K2 A" t
Advanced-control, general-purpose or basic timer
! o8 [* O2 V, h1 p3 v# n
7 n7 [" P8 ?8 m% f4 h% K
* N7 y* L9 x6 H
USART
) o0 Z, E0 U; Q' ~8 ]" F4 TUniversal synchronous asynchronous receiver transmitter ( ]1 k" L: ~2 Y( k

) r; j1 q/ c2 q  ]# h! C
/ b7 a* g; l+ o! r7 J0 t4 G
WWDG 9 V: p" d9 d8 d, }* N8 w
Window watchdog
: ^; S7 @  T4 w3 K* Z) R
收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:36
1 k, K, l; }- ?% `- L/ D& _3 I这个支持下,楼主发帖好多啊

( o+ _) w$ p) ~,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42$ f6 E2 w3 Y4 K3 d
我是来学习的。

! N) y0 I4 u: k; D! b8 M4 Y一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:533 }7 ?4 y% s/ g! f, \- w( Z
目测是水经验的。。。。

& [! ], \/ L7 |% f水经验,你可以不看啊。
moyanming2013 回答时间:2015-1-28 12:24:46
过来支持下
stary666 回答时间:2015-1-28 12:26:25
好东西!!!!!!!!!
天天晓宇 回答时间:2015-1-28 12:36:39
这个支持下,楼主发帖好多啊
时光碎了天 回答时间:2015-1-28 12:37:59
学习了的
cxtarm 回答时间:2015-1-28 12:50:12
子曰小玖 回答时间:2015-1-28 14:56:05
学习了!!!!!!
1407W 回答时间:2015-1-28 16:36:34
不觉明历
AnswerRaul 回答时间:2015-1-28 17:02:26
支持一下
wangweili1978 回答时间:2015-1-28 19:42:27
我是来学习的。
qianfan 回答时间:2015-1-28 20:53:14
目测是水经验的。。。。
党国特派员 回答时间:2015-1-29 09:40:53
1407W 发表于 2015-1-28 16:36
3 I4 _5 V  b4 c2 i$ _不觉明历

/ h3 m+ R  I( J/ O. q, ^,这都是最基本的。
12下一页

所属标签

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
STM32N6 AI生态系统
STM32MCU,MPU高性能GUI
ST ACEPACK电源模块
意法半导体生物传感器
STM32Cube扩展软件包
关注我们
st-img 微信公众号
st-img 手机版