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

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions 9 S, i$ _0 @5 ~
STM32库标识符命名规则
1 K/ L: m6 a2 g1 [0 p1 u
( j- N9 \# T1 J7 f/ s5 Q. \0 I. d
  f- b2 I+ a' D) m4 Z
The STM32F10x Standard Peripherals Library uses the following naming conventions: 2 H  \/ H7 q5 t
STM32F10x 标准外设库使用如下的命名规则
6 W; B- X2 m1 `: L5 d& j9 v! G8 G& C0 T1 r2 G% z2 X1 O
+ ]- B5 r: t, W( E& q
PPP refers to any peripheral acronym, for example ADC.
4 F" z4 X7 A) G7 FPPP表示外设缩写,比如ADC% Q$ L$ Y. w& ~- \7 J
System and source/header file names are preceded by the prefix ‘stm32f10x_’. " G  c0 ]4 M! U# p
系统文件或者源文件以及头文件名以stm32f10x_作为前缀
- j9 s. ?& Q/ Y8 `8 o5 `4 O! r9 p0 B7 _5 Y& G9 m6 O( R7 k3 s& M# L

) V* ~5 V8 Y$ ^Constants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
1 L1 c. S; h; {+ m& TAll constants are written in upper case.
0 D/ ~( Y1 G6 ?4 J: a- n常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写
1 m7 r7 L) R) m, r2 T1 b5 iRegisters are considered as constants. Their names are in upper case. : y0 v9 L6 h) Z; ^9 r2 D! I
In most cases, the same acronyms as in the STM32F10x reference manual document are used.
7 Z, i! w/ A; R6 e1 T4 x/ C8 R1 }寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。9 @" B* p; \; t2 ]  l
3 V7 y7 V. O: v" |9 T* t9 w3 W3 D' R
/ G3 ]5 ^7 S% @# ~
Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore.
) K& u$ G$ b, S# s8 @7 D, \% mThe first letter in each word is in upper case, for example USART_SendData.
3 Z+ z. H+ g9 B$ ~' m! ROnly one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name.
. o" z% ]4 K6 ]* ^3 `外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。  q2 I, g0 `1 C" O4 E( j1 D

1 Y4 i# I7 G% R4 ?

1 N" P  n  d3 G: p: W1 L6 X1 B/ oFunctions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init. ' z  G$ A' s3 w
用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。
1 S2 n" }( s( ]8 e/ V1 ?% I- b/ E4 t% Y8 x1 V+ `$ x8 x1 \
4 x' X  W; V6 Y$ R9 K! Y; x
Functions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.
; f5 {: j; Q7 q- B9 P/ x1 A用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.. p# n) _( j5 d. C# R- d2 A/ X
1 I( ?7 b9 b; B' D; _3 |0 Z

; t* g" b6 X. F) y$ l% cFunctions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit.
# O9 R4 l7 K$ U$ _; i用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit& F- ^" y; _4 t9 H: m4 ]

% N$ N2 s; y  w
* b: b! U8 B8 e7 y" P1 G* J" U, |
Functions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd. " a7 Z1 H$ ]9 z3 B& `
用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.
2 j& u: i7 ~) M: p6 O- C* H1 e# ^1 T/ T2 U6 P
2 O; \' N3 k) q, v5 |
Functions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig. - B4 v( Q4 q) [! V% R% }5 U2 w
用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.
1 u: o6 V) k& q" ~) ?' I; B5 I% T0 X3 l1 h9 H
  Y# Z& q% c" l6 \
Functions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig. + c7 M- `' O  u6 A3 `7 L
用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.5 t2 O! G7 Z6 C2 k! q: H2 D

- {7 s7 Z+ f8 }+ F8 ?
* M8 @( v6 v3 S* `
Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig. 4 l- \5 d2 ?4 o
用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.
- ^7 W. t/ N, Z" n5 y
) ~3 V$ Z6 B2 l; O! V( m
6 L( V# c; T* \; C1 u
Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus.
& y- W2 g" F: i6 s$ t用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.; p& L, L/ I( u" h

/ S3 M6 Q2 T* Y" Q4 g+ b( k0 g! A

' v* q: Q! K6 ~Functions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag.
$ M; P7 O# P% X' l# E8 C用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.. m- q1 D2 M' v4 Q; u4 |( v5 Y

: C- m; u- i7 X* o
0 f* ~) M& c* ^; H) J5 M
Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus. 8 d: N9 M1 m+ e3 e- ], O" ^
用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.. c( v( M" e9 n
7 U1 w0 o; q* L; _
/ g- \. I) t; a
Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit.
5 T% @' P. q- f& m  h用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.
! Z7 {  L- [8 F' ?+ K7 z1 k
7 Y& s/ {/ n* ]/ s6 c
& [0 ]3 |) v! V
希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分# B3 H+ b  u. [
另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”
  b  C: u( {. ~8 E! J6 Q# f$ S: }+ R7 Z* f3 a& E3 W

+ a+ ?, Y3 K- f0 T8 a外设缩写
* l, ]- D* G5 h' k% }1 {, w8 j* |" ^0 I% E! c* |' ]
" a0 N* t8 q5 |5 A1 |
ADC 9 R6 ~% H9 g3 s0 d# Z2 Q% o8 [' _
  Analog/digital converter
$ v2 Z( N7 E: _& F$ G0 l1 ?: s% j( l% a% j7 ?/ ?

2 \$ c' s" g$ x8 mBKP " G+ e3 O$ }, C2 o% ?) f; r
  Backup registers
- n! y: a5 i) M+ g3 F, F4 a0 b6 x1 j# u

  n! `9 A3 [' f9 s6 A4 t8 hCAN
- R. r' r/ ?$ b% J/ X& X6 |  Controller area network : f- P+ b- B0 t  c4 U$ W" C/ w
9 h; ]' j; K5 B& ]* G( w# o

4 b9 O' c( F0 q2 X( h. H3 ACEC ! ~# a6 I7 H7 r& V8 e" D
  Consumer Electronics Control
/ K( c* n, \$ W0 h% e
- z' w% b* I& H" E
& q! I/ @% t3 F9 k+ u8 _, ]" M; C- ^
CRC . C; ^0 `. g: t
  CRC calculation unit
5 S  W" r* a5 M) N
7 |  V7 p+ A" `
5 P3 P4 B& C. ^/ s) r) i8 V
DAC 4 q9 d* d1 D6 }0 G
  Digital to analog converter
" H" A2 s- x, ]; u# N- }$ ]4 }. W" C. T* I3 f( ]$ e
1 f; L& v- Q/ ]" }$ f9 o# d" U
DBGMCU
# G" U% ?9 U1 x  {* i! p. s  Debug MCU
& c% [; ^- Z! E9 T9 `/ b: b5 b3 w4 j5 `* v. m
' X) D9 t6 o1 y3 t
DMA
2 A5 i  I) L: p8 d# Y' i  DMA controller
6 _8 c0 Y! d1 e: x1 U) F9 e3 R& u5 @  g

5 m+ v7 i" ^$ A3 V7 j0 G1 REXTI
, g, @& p' b( U) o, P) v  \) R% h  External interrupt/event controller ( F# b. g  _& t3 ?

# C) n( l, t3 ^, H, U2 z6 p

/ W0 ~' Y2 s* M4 C& O9 p+ A1 L! Z, QFSMC
. A) G, j5 x6 I4 \8 K, K$ I7 d  Flexible static memory controller 9 _( ]3 p9 A8 D7 j
2 Z+ k7 Q8 k( ~% y; w
; B& ?, ^( w1 \  a! a: N$ y
FLASH 9 z) ?3 }4 G% C# m1 J# n/ c/ ?8 p
Flash memory ! P9 \3 G$ ~7 j. F; \# b' |

1 ~7 B8 r8 F: M1 l" H: H& X. o
/ t: I; M* |, f( Y9 p3 w
GPIO
4 {( K- d7 H1 t/ s/ m  General purpose I/O ' U( ~4 x9 d1 C5 M, {2 g3 x
- v% J$ q0 i2 D2 a
; t: A1 Q: a) N0 s9 _! {
I2C
$ b" j$ j1 b. h, K4 [  v3 q6 w  Inter-integrated circuit ( n  x* b7 t1 s6 u, r- a5 i8 ~

7 o! h6 Y) N/ C2 H. g+ z) r5 H

+ \4 w# N  y( l, {3 b- r3 EI2S
+ O6 W" I) Y. D% X; ~$ t" ?( |  Inter-integrated sound
3 d2 \. p* X$ F% @1 ~+ Q+ B* o) w0 \/ m: e

; J' C" ~1 n5 B" t1 _IWDG
' f6 y; M& e2 l5 ]+ Z  Independent watchdog
8 i8 u& B8 ?8 {! Z1 V/ w4 h0 u0 f7 H  Q8 b
4 ^9 y8 u* o3 D
NVIC
0 g& L7 r9 U- l# n  Nested vectored interrupt controller 1 H6 w' l$ }+ V0 f
" X7 e8 w  K8 K, Y
/ @6 D9 m0 o, O8 L+ E0 E* C. c
PWR 8 J3 P+ a% N% p: p- ]3 B% ~. O
  Power controller
% H2 _& z: P  J0 }2 I
2 D+ ]7 ^+ O( W

; ^; S& _6 `# Z- p$ a" sRCC ( A* e& |8 ^3 o- p9 x, J/ W
  Reset and clock controller
7 d) l: A! x+ h, \; T5 {0 o* Y; _: ?. d2 `: z

  m& b; s  |0 y4 d! `8 P5 R4 dRTC
5 p1 z% u3 M, a# L  C7 T: ]" l$ C+ ~  Reset and clock controller 8 E" H- U' V  |) n* R
. B2 N5 L; ]) s! }5 |: h
; [2 t. p) t3 O, [" B3 W& u! F6 f
SDIO * K7 |, g& e. G* b+ }" m
SDIO interface
# |( Y: L; k' t+ `  e: a6 {& w. Q1 L) X7 R
* y1 Q. ^& U4 Q$ G* U
SPI ; K, }2 U4 b6 ^1 B
Serial peripheral interface
7 X+ w" g( ]% W) y% n8 t! y( u9 v$ e5 [4 J, d/ {

/ Q0 ^( \3 f( o/ L3 b7 H8 b! USysTick
: w$ C. x5 n3 W, j* i! jSystem tick timer
; @5 ^- B* g0 W- k6 p% @9 H% E
, \% _' M( c# M! \

& H1 A# N. {; Y' h+ ZTIM 4 I2 ?" y7 w! x/ [
Advanced-control, general-purpose or basic timer
) s4 S  M' {" u1 L% n8 ^# L+ e- U& ]2 s5 n" [! b8 {8 o, S7 `$ X
; X& v7 p3 f7 u
USART
8 Q  y; z2 }) j7 E# MUniversal synchronous asynchronous receiver transmitter
! f/ h  I  s8 z5 }9 a( w
# [% f/ R, L; W& z

; }" ^& M' J3 RWWDG : w' G% _! l: R+ P+ o7 |
Window watchdog
$ K+ d# ~, _! N! s8 h2 C1 U% S
收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:36* w+ |1 k9 k) l9 y3 R
这个支持下,楼主发帖好多啊
% u7 \- y4 U, [& u
,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42
# B$ X' d- M, v, B我是来学习的。

) Q0 B) M$ ^& u一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:53
. F  @0 @0 W; h7 d$ R9 S目测是水经验的。。。。
% L! u4 p: j3 {3 Q
水经验,你可以不看啊。
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:361 H* M" R" t- }1 v# H
不觉明历
- w2 W* z2 }, q) a# U+ ]
,这都是最基本的。
12下一页

所属标签

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