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

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions
9 \+ c0 h: Z. K2 z6 K9 `STM32库标识符命名规则% S. S+ B9 n: x2 ^
' z& @- y+ o$ L7 u* `

5 {0 b7 f: [, LThe STM32F10x Standard Peripherals Library uses the following naming conventions: ! U8 ]' n( f, U
STM32F10x 标准外设库使用如下的命名规则2 {) \9 |4 K/ t- e; s0 _

+ U+ T) L) x+ R& Z! n9 Y# L
7 L8 r# N$ m4 c! `( `6 k
PPP refers to any peripheral acronym, for example ADC.
  M2 z: w) ^0 m5 ?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

, o/ o3 z! t4 f
% 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.
6 t1 B% A% I) j' H4 K& h* dAll 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参考手册中相同的缩写作为其名字。
* M2 [2 s, y- G/ b- M* N. N0 K, F2 D2 H# g

4 z8 l& ~% `  j8 w  y# R! V) ONames 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.
' M1 Q* u+ [3 P) ?# D4 b5 r4 t外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。
' `) A7 b$ [  E! t" ?( 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.
+ P/ i, t7 @9 ]3 Z用于初始化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.
- |0 _9 s0 ^; X/ W% @用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.
6 n* U6 E$ W" O
. Q- V+ p5 c9 [6 r; @3 P
$ 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
6 U0 {" {/ j3 e( R. Y- ?9 m9 X+ S! ?+ v9 L8 Y. n) y

0 q7 K9 E6 @, ^5 OFunctions 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

1 v  _: P! T; H- ]- t$ gFunctions 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

. p) W& t! }8 i. s3 y* Z* y
  }- 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.
6 [1 v6 \6 [, y5 {9 e" ?用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.
, ?( n1 j; Z2 X/ c
# S' e! E3 ]5 h1 E: ~; H
3 T5 G% L# @' k  k
Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig.
0 Q1 @6 W5 K) V- ^1 w用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.3 Z! J! R$ \7 j' \. _! {
. V* m  A7 m1 b9 F1 D* H8 b

$ x$ V6 e# b2 r; |" ]4 LFunctions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus.
  L0 X# l$ Y5 M$ i; V用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.
! I" u; |" \3 X! 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.
' z* T3 f. p( l1 h  e8 M. A9 I
5 H' n& M3 H% ^/ W9 V) D) r" H

* p3 ?6 k  X, a0 k' ?Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus.
9 f$ c2 o- |2 b# I3 w! S用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.- O2 l) N: a9 b

% N% ]( f4 E- ]+ i! ^& L; _
3 i5 s7 U" q& i/ I
Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit.
4 F; K5 f9 {& o8 y1 H/ o6 V用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.& Y% q' B9 j. o# g( j, w1 z

, m5 Z& l3 V; e) ~7 Y
; A1 A! [& u# |* [" r( w4 W* }* x3 T
希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分
% A1 ^) O" t: U' C' e' Y& X另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”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

- i* u" N* W, U4 Q, b  w
4 a8 W8 I! I5 m% U
ADC
, r. f+ [' ~( N, F# \! {  Analog/digital converter % H$ g1 y' z% O1 G  T1 W
: B$ d! |0 o4 ?  E/ ?: o

8 |, L. V" ]: c9 [3 v! uBKP / 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

, V! d6 m$ N( z# O1 E

' q. e. p: e1 lCEC   `; h0 l7 K  Z5 h
  Consumer Electronics Control ) x5 f1 T( ^! ~& f! q* H

5 k) Y; r7 E. y/ k( |0 Q

  s' N. T& G$ X3 l1 ?CRC , }( I- h2 i) P% G+ P' T8 d7 |5 p9 \
  CRC calculation unit : F6 ^" o/ o! \

% a- w" q! b1 e1 X% ?) v
9 h+ S2 n7 R. a/ y7 p
DAC
7 N* @1 D- B9 i  Digital to analog converter
% J& }3 l( Y- O1 ]! h+ b# M7 Z
. b+ X5 |4 T5 d9 S) y& G+ K- `$ c

! K! N" Q- h& M% ?DBGMCU - M- j6 [3 [8 i3 r! L
  Debug MCU
- `% f% |: t; E4 P1 }8 ~& I6 H; \1 V4 r* Q% P

2 T  Q  {5 w$ l* xDMA
0 _( X$ E. u" i6 d2 u' r! M  DMA controller
. k. @* Q. ?0 E
. ]1 O" F# }7 G4 Z0 U+ ~
9 R9 k4 Z& j: i) h! b& ^
EXTI
2 d, F( L+ X) l  External interrupt/event controller 7 L9 \$ h0 C5 L# d6 a4 B& L

& v$ O. O: F; C1 P% Z3 x

, r1 v' u, d7 B* n+ R$ Z+ I9 d* jFSMC - _1 s% G+ p0 M
  Flexible static memory controller & Z4 m& s7 F4 T, ~' W7 t
% n0 H- t( [) v8 l" S. @% a

& b' I$ n) L5 }& K1 L! o* k. S7 fFLASH
) D: b- C: @. z0 [. f- M6 k7 {) VFlash memory 5 s# I% Y0 P- w0 B; X
4 _4 U  j/ K) T% [6 y# L% L

! M/ N$ {/ [) Q5 h6 _GPIO   L' ]2 m, d4 \
  General purpose I/O
# u( M+ u% v! h: 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; @$ }  ~- |( ]

3 v1 g( N0 d" R& R: f$ \, U

7 B( I: G; D% N5 rI2S
' `# h9 e$ r5 `; R' f1 ^1 w1 Q  Inter-integrated sound 6 |2 I+ e2 l( K6 N$ _: b
& L. ^! J! b# ~: C; K/ q

  V$ j3 ^3 v1 x0 s3 {+ \4 \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

5 F7 B- O: R7 ^5 Z% tNVIC $ F2 K: ^( l+ O+ D
  Nested vectored interrupt controller   R! T% y. Z: \( Z6 V, x; ]4 y( w

! `, d" ?4 u  F, Y
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
* m9 B7 E) v4 {. H2 q' Z. s; T& e
$ C$ K9 Y5 v) p, I+ F
& 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
0 Q3 r: e# g" z7 T9 o% u6 j9 Z& kSerial peripheral interface
3 W& i; y# E8 E5 f7 j5 T( W1 E. ]2 W) o4 O+ o/ T- n

; Q4 X2 F( O7 A, a/ `$ ^: F: aSysTick
/ T& d% O/ m$ n/ x% U8 }System tick timer
6 J' `7 H' C0 x) z8 `1 b( 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

8 p, E$ M+ ~+ uUSART
) d9 T& ]1 Q" QUniversal synchronous asynchronous receiver transmitter 5 Y* V: O8 i; K% e3 g

1 H! P, d* d. ]2 l# k& z( C4 u& M
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
收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:364 e3 I$ D6 Y5 s
这个支持下,楼主发帖好多啊
; |" L% H. x7 g0 E( R( E
,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42+ t8 L* O  I* G0 O3 @4 p/ e
我是来学习的。

* s  Y3 C7 w+ F8 I/ y一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:53
  [( [1 U0 N2 D目测是水经验的。。。。
+ b3 @5 b1 l% b8 E
水经验,你可以不看啊。
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) B) C# ^- P4 o8 r
不觉明历

5 \9 H, `* G  s, X,这都是最基本的。
12下一页

所属标签

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