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

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions $ _$ a7 n0 }& S  o( @- p# N
STM32库标识符命名规则
. _9 Q9 b4 _/ Z. W! Q* @7 v& \
" J9 g/ `& h7 i" J7 a: H

: w- `9 f; p* ^3 K1 c4 ~* L) }# |The STM32F10x Standard Peripherals Library uses the following naming conventions:
( G) a2 x3 v* HSTM32F10x 标准外设库使用如下的命名规则; V' z1 x* f% E! e( X& c( ~2 @3 x

  Z8 C6 w! R: k4 Z9 H
7 w3 N+ b' W* V/ w" F. q8 ^8 L" p
PPP refers to any peripheral acronym, for example ADC.
7 B( q) q2 `9 V* X4 q$ D) QPPP表示外设缩写,比如ADC. H, B* k8 |/ B# b8 S
System and source/header file names are preceded by the prefix ‘stm32f10x_’. ( I& _% X$ h$ L' {
系统文件或者源文件以及头文件名以stm32f10x_作为前缀4 T9 t/ ^2 S. X; u  K% W0 m3 B

" G  {1 x8 |  q& A% p: F

$ D: @+ h9 v' sConstants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
/ N* B) b& g. vAll constants are written in upper case.
/ A# U0 F) ^& L7 O% }常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写* Y- X7 c, j8 X0 p/ z4 ~3 i
Registers are considered as constants. Their names are in upper case.
* L* ^- M. k2 C( @/ G- ?; wIn most cases, the same acronyms as in the STM32F10x reference manual document are used. 8 g  `8 T7 c7 s3 S/ A; Q7 L
寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。
' l" |& b# m2 k$ y: ?3 V1 x- F, e- i" m& J0 z
7 N; P1 [  p0 Q! [/ y/ S
Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore.
* I6 c9 z4 Q, t& VThe first letter in each word is in upper case, for example USART_SendData.
) h4 k% H, O9 P1 bOnly one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name.
! A: R. B8 u9 R; S2 w外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。3 I3 w& v0 D# Q- K

9 B5 H1 ~' B4 x  a9 }
) p* O- M$ u: w$ ], T& I
Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init. $ f" d" F: S& k7 k
用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。
. y* g& y: \7 w, B" T; `
2 V2 N  @+ G* K0 F3 A

8 v7 O, s- U3 \0 U! E3 NFunctions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.
3 l+ N( m8 `$ \% e0 D用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.
) }1 n% G! V8 l- z. s: s
  i3 {% O' ?9 U+ y4 K% ]) _3 v8 m
7 o+ E* e& c: {; n# i
Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit. ( |7 g9 O( y$ W
用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit
6 z3 o% w! M+ O+ J8 o# d' Q) I$ y6 O+ h& y/ H2 N' J7 G' b% F* B

- A! b% v6 S0 Z' l' H" iFunctions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd. : a8 ~5 g! U8 l4 R/ F6 C) Y
用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.. X9 k3 k, ~8 C% y# Z
8 l0 @6 C0 ?1 p
" I- D- b+ T/ B4 v6 J6 w! `
Functions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig. . n1 r2 t) J" P% h3 l
用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.
8 q1 A  \' b& [5 K4 ^; r. u! ?* M* P" Y6 d/ Q5 b( O  @

/ P- N2 {) Y4 i( c% ~- D( `% s# {Functions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig.
* D! d" D, }# D  u用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.
" l4 [4 N$ w$ Z+ U( }. |) h
) T- O* s7 Y$ a; {& r5 j7 R

0 G# G% p5 ]; nFunctions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig.
/ ^9 M& D! ]# x; g0 X3 C! D/ r用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.
/ V! H! u8 a- g, G$ E; W5 N/ j+ P
% S6 \3 c  J, l. e: b0 U

! t  j" X9 p' W" h, r1 ?, z7 LFunctions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus. - a- J5 Z: \; ~$ w9 a0 F
用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.0 q2 {; H) d% ~) L* o. l, x. E
0 |$ }! m, n8 L  |. o+ F

0 Y7 u3 q7 S& a1 ~' c5 E) n6 k  t, EFunctions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag. ! y6 I) ]& K  N! P8 h
用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.+ e5 f9 o# v6 @" L

/ [6 E/ d6 G8 K
9 d1 B% D8 }4 T
Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus.
3 M, i# q0 z8 C1 t' j4 ^用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.
! ~, b! X, h* k0 n$ y+ _% \5 k
, C! w; f7 m, Y& _2 |0 \
# V. h% O' G  D5 ?
Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit. & F. V) m5 z5 A' R
用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.4 d# a6 ]  X5 \# y
& m$ Y' X% {* G7 ~, _
3 s; |' V3 S# O% ^6 f
希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分) x9 G2 y& L! U9 l* w
另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”
& n  _# n/ g& g$ [8 m' Y
4 Y$ A3 w3 K  e: _- `5 k# N0 U
) K7 k, K3 D( x! K* ?
外设缩写. j8 v" s0 M) Z
6 g+ S" ^" `% T- }- I; ]9 x( V
& f$ l% \7 X9 J& o5 O
ADC
4 M( d! u; f$ s( m1 U  Analog/digital converter
" A- P7 C* J, o: x, e& l+ G# L8 w; H5 p1 c

6 C* `% T1 E% O7 K' w% L: l, iBKP
) O% w3 f( r! Z4 t( N9 W  Backup registers 0 e7 H6 j0 H# D1 W

* f. [) P5 D* V
$ w% D! N! _/ H+ Z$ L
CAN
9 Z, g5 L3 }- A  P# z0 V- @  Controller area network
' w! X$ ?/ `+ Z* W$ }- k) W- L
$ f) D3 g9 {6 o# c: L' q

3 i0 \2 }0 T. J" z' e7 uCEC ) K8 D! t2 D# P2 ~# G
  Consumer Electronics Control 1 P3 u5 v( ^3 O" c
2 \0 P) ?$ T4 ?4 U' O

- c2 p- s/ w# Y5 G0 ICRC , W$ j7 m% W5 T* I
  CRC calculation unit
' T( P. {- k0 K7 B" A$ T
# S. A& |7 A8 e$ G' L
* O6 e' V$ L: y$ v' y8 v
DAC " |0 |9 ]( D0 q7 B2 F4 _
  Digital to analog converter
5 x) O% P6 J  u" J/ u& m: A- F* n# ^$ J3 p, a

% Q; H# ~% I" y) t- P; ~6 {DBGMCU & k' M  K! o; g9 q( q! q+ n
  Debug MCU
8 R) \- w: R9 h0 g  b3 W# w5 e" A5 c5 x, R
. ]$ }; Z0 j2 f$ u  F6 K& f
DMA : E( y; t8 r5 F8 Y
  DMA controller ' L. d3 A- Z5 m6 Z7 e/ r

% {6 t. ?5 r* z$ }6 g; X
$ G+ E+ v/ v2 @5 b8 V1 F+ I* H
EXTI
" P9 v: Y% y# J$ Z- h0 `  External interrupt/event controller
5 {7 \% g) n" k5 U: H9 s: j
: v: ~- i7 Y( y$ x* O% r2 i

$ g, ]0 |9 y5 t% a* ?FSMC
; J& ^0 f& u/ f  M# y  P7 \) ?  Flexible static memory controller
1 x9 x3 z" v% H5 `. P) q
, q1 R" W$ K# [) `6 ^
8 x7 ~) p3 Q) Z$ t9 W$ G
FLASH 3 s" }( V+ P6 V9 L/ M( P
Flash memory 3 q+ N5 l6 v) M/ s

6 M' X3 ?5 y# y5 Y5 ^) m
# K5 o* _; y7 v! g
GPIO
% T8 J6 g6 m3 v3 N  General purpose I/O
0 s* x% z. a8 c: {8 I! C+ w8 c
( o7 E, l8 V( h9 I. R
6 x  w& x7 j0 z9 C' e/ e
I2C
& c+ T* q: P( L0 Z9 {  Inter-integrated circuit 0 K. B, I1 o1 j  o1 j3 J

0 G+ Q" M) M3 s+ K/ ?" j% d

4 ]7 K6 d5 p* d1 [I2S ) k. W8 L; {9 ]! X0 G
  Inter-integrated sound
! ]8 W/ O  z8 y$ K# K' z( I5 R/ L4 V/ i9 Y

0 k! u7 G9 R6 Q3 M( Q9 dIWDG
5 K" ?% z) V/ g" q# m3 _  Independent watchdog ) O2 `7 M4 x, D

0 n. d* J2 ?" V  w! B

5 e6 C( L' [2 M8 lNVIC ; C2 K, c5 A- Q, T, }
  Nested vectored interrupt controller
6 T2 ?; B+ [9 g  W* _
& Z( r% Y$ f  c$ t3 t9 C% W# w; l6 i
& G& p$ m  N8 @5 |# v
PWR 5 Y2 {6 E" J8 M3 R6 q' B
  Power controller ; N8 v# g" ]# A8 H
2 w2 d7 d% F1 {, J5 Y) C$ S( s; m

* u( _& H2 r! t7 m3 n' ORCC ) M2 T; Q- o2 ^) j
  Reset and clock controller
& m! v* W/ H9 m5 ]. _7 S0 Z
8 V" Q1 F* ?( {4 ~; V1 G2 X
6 I- `, W8 `- N
RTC
4 K- L& ~& V) |" `/ Z9 Q  Reset and clock controller ( l" c$ s; u' T$ w4 L9 K0 N& d
/ T8 k+ V1 a9 G/ x$ O
* P1 ~3 m/ x4 t1 X+ `
SDIO
. f4 M# O( n, m& A; n; YSDIO interface 0 a2 Q. |1 b7 G9 F) |4 J# ^$ A

% T# I* d9 @4 Y/ f& @
4 c* L: N- \; m$ G1 e9 J  D4 g
SPI
' D* E2 {( n. _5 n9 B$ J% MSerial peripheral interface
, K4 G7 Q9 y( X% C* e: S' N% J
: C4 ]& |# Y3 P4 t0 \$ {' o
( q% |% U8 ?$ l1 A2 e% X( z- J
SysTick , {% h5 ]  U4 F8 Y9 x
System tick timer
3 o$ B+ f  e  V' K, b
# U  {/ r1 c( S, H

4 E  W! I+ J1 Q- [% X- dTIM / ^4 c& a9 j" G" q# x5 E
Advanced-control, general-purpose or basic timer ; A+ D0 z$ {" o4 g: G

' ^' g1 V$ h  R% a: J
, t! V/ I5 o& c. D; q
USART
+ H4 Y* n) `& `% A% }Universal synchronous asynchronous receiver transmitter
+ P+ o" c8 a$ z8 e5 Q3 `
. X0 F$ e) Z3 n# K. x2 _; W
( L% I9 F" E) ~) c) P+ C
WWDG 1 w& U" p% ?+ E' I
Window watchdog ; x1 v. i. C9 @* ^
赞 收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:36% s, n" Q' z9 M% P9 b. A
这个支持下,楼主发帖好多啊

) ^4 V, ]& F' B,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42
* L" n) Y' ]7 F  L1 b9 R, d- s" h" `我是来学习的。

6 o" R; Z# @% g. U5 E一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:53
) \9 o8 X) o3 _0 G% M. M+ ~目测是水经验的。。。。

1 k/ x+ R1 E; _2 l3 z% i水经验,你可以不看啊。
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
4 i- S( S+ K  D不觉明历
. O! v# O( H# N0 ~$ |: t) J+ B
,这都是最基本的。
12下一页
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版