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

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions - o+ L0 y9 E6 `, i. C+ U/ u
STM32库标识符命名规则. p4 C. z& P. t# S$ S) \

; h7 T- m1 c7 E  |" `. m8 t! W

% I2 {! |( I. `# J. X* n6 }The STM32F10x Standard Peripherals Library uses the following naming conventions:
% O+ P2 b$ _! E# Q7 ~2 `8 y. oSTM32F10x 标准外设库使用如下的命名规则
/ G" |) d6 q6 {- N: p( ~  e9 |1 R6 F2 b- x) R
, M5 V9 L4 F5 R6 \) n/ _+ s
PPP refers to any peripheral acronym, for example ADC. 0 H7 k( o5 V5 _8 ?5 o! X$ T% D" X
PPP表示外设缩写,比如ADC
6 ?7 j: [, J% e# \System and source/header file names are preceded by the prefix ‘stm32f10x_’. 0 h" ^, E3 l, _& h" v
系统文件或者源文件以及头文件名以stm32f10x_作为前缀
# c7 W" ^6 z) X- e8 A# c, L. b# o  }6 l' w4 j- V; n+ Y
! |! E9 z9 ^2 _/ r' [" d5 r
Constants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
5 k+ r2 S; s$ p2 t9 _All constants are written in upper case. - A# V  T- u  j5 h
常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写/ x  _4 m: V: W2 h5 G8 w' @2 Z( Z9 \
Registers are considered as constants. Their names are in upper case.
$ d' H# E1 Y' O- z* ^In most cases, the same acronyms as in the STM32F10x reference manual document are used.
2 W* a6 h& s: P3 |: E2 R& ^9 _/ P寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。0 `' R/ W3 o, k9 Z0 P: D5 e

" ]. b/ ?( K+ ^
* p: b* g, w& B+ O$ |$ T6 C3 Z
Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore. % m( J* M& g" e
The first letter in each word is in upper case, for example USART_SendData. + x# M& b( G& m- I" m- L% H/ x
Only one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name. 0 ?) g4 O3 x1 i6 e6 i4 @
外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。% j/ S4 H" s' W/ Y

8 f0 q2 G: ]3 Q" W& H; U
9 q8 o. h3 A1 I9 V# i  z
Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init. / [5 w. @* ?, k0 J1 L# f+ _
用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。
, e. v4 v1 c! C8 M" Y7 f
" ^" Y# g# ?& c8 ]  {

2 C4 Y, c/ _' ~3 I% |; ?* J5 T  H$ JFunctions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.
) c! J* p- r- ]5 W! J用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.% q7 K6 Q3 g6 X) O( O
' o& {" q4 i# r8 x. S2 a5 L! J# I
  W4 w+ \- {- Y; u0 G0 B0 s
Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit. % J4 c4 F. n4 B0 u' B
用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit
  G7 i6 \/ u$ y) q$ u' \
; ]! B0 ]) D. H8 d. _

; [% [! J/ \, Y8 d5 BFunctions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd.
$ G: P" T2 `5 z, ]8 D# a用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.
* c2 {8 C8 e4 @8 j* G) \1 b. V& ?" C9 f$ q7 Q

1 H) h+ D- B9 H* UFunctions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig. " G3 O7 a* v2 A  F
用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.
+ ^& j0 ?" n" G2 O0 s. M9 v7 T: [5 x2 C3 f7 F3 s* o4 v' a
& C& d$ ?1 p% S* b& s) W# B* W
Functions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig.
9 Q; o1 d- H/ S用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.% B5 e1 |0 @( o! `/ V5 X  z2 U# _

& p# g' I9 k. p8 [2 j7 H
$ ^/ {, v, i) U# ]% }$ g
Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig.
& S1 \5 G7 Y5 W用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.
6 s( ~: v8 \9 i' E! A
  [9 l' d1 e6 H
: E& U4 }% T3 W6 ^8 m+ }
Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus.
1 _  U* K/ Z( ~; T5 o用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.9 _- m4 J1 W" J$ {  i7 G( @: \6 ^
: L* w7 U3 s$ o8 J% e3 f. `1 y' a

8 P5 g% I, W: T/ g* VFunctions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag. 7 O% F7 D$ p5 T5 N8 `! _! X
用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.+ B( F4 `& c+ Y/ I% Y
# Y7 ?3 J; Z, G: m2 W1 I

3 s  @3 O# H& k/ x! ZFunctions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus. " j- M9 u" q% I
用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.
. }7 z) g- x( U- ?  x
$ r  t; t8 g- m! V& ^( _; h5 \

! D( K5 X, Z( F, [+ _" S6 d; nFunctions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit.
* k2 j! Z0 V; x. p' L0 C$ A用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.# g7 {- k! D; l5 h) }8 d
( l$ N3 U4 e( K9 H+ v- P
  u" |2 {2 P3 z6 h/ }: y% z
希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分
0 q. A' R$ v2 q/ I6 ^+ ?& d另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”
# W% q0 B7 G; W. p7 [5 K) P) R! A
' u0 Q; _/ l% X" x, `$ @1 a% ]

$ N) x5 |" q8 f. v外设缩写9 Y( [# g1 R, e3 q
+ \  S( t2 l; @* {

) g* }7 P0 e  ~ADC
) h7 P: r- r3 l# u% b  Analog/digital converter
$ T1 E# G7 G, g
) q" r) x1 B$ e4 T! o

/ |& r7 o1 [# G6 N. q' D/ A% oBKP 7 X0 Q% U; n$ A* e9 B$ W  F5 m
  Backup registers 4 a) a8 M7 j' d- G3 u0 c+ J7 F

) r! Y6 @! G- `' y2 c

- q9 X4 b. D, g" i& s: p7 @2 MCAN
8 @0 A6 t5 d  \1 s  Controller area network
' E- D% k8 G3 c% \5 ~1 z9 j9 N4 b( T' r7 r3 n

1 Y# a/ c( O4 O9 CCEC
, d7 q8 X  }3 B/ f+ e- n  Consumer Electronics Control 9 ?/ r' X# `8 J4 Y

1 _/ ]& B# g% I/ w2 S/ W$ l

( @; k% o9 X% pCRC 4 J' @1 ~. {- W  Q) _2 s7 d
  CRC calculation unit 7 R; N  t% }& W' S$ `5 {

% T1 J+ K, w, N' @" Q1 G3 R% R
- n5 @4 P9 s* I. D5 k/ J+ K" Q. t
DAC 0 ]" q$ s3 H0 q7 M7 ~
  Digital to analog converter $ B$ N" |- a1 G$ ^: ~

) @4 u* b9 @, ~9 l

: K9 j% H- h& m0 R4 }. n2 h7 CDBGMCU
* q6 L  c" O3 N2 G( q  ?* d, ^, L$ F$ c  Debug MCU
7 W" [9 z2 s6 C  \1 [$ J0 |
0 Q0 L% _% l4 r8 {- l6 O* {
: D$ t9 _3 w% J! ?
DMA ; \1 c2 b) _1 k
  DMA controller
1 }% [; z4 R& g( Q) b- W* Q9 I2 B6 J0 M

+ F) `3 V" O8 tEXTI
4 |$ T! ?; N. V4 C$ Y) N  External interrupt/event controller # T: O+ N; |  [) w8 B$ t; C
9 B- p7 h6 \. J! e; l0 y! e

# Z0 T* Z1 a; Q0 HFSMC " {6 Z* E# M5 H) L
  Flexible static memory controller 8 s0 N; O+ {( |- _
" W( P7 I5 J9 j! a/ a' `. i- g# |

" o" a( g; A5 V2 W. gFLASH
' h5 i/ M* _+ A# SFlash memory
5 P, @( L$ W3 I0 H6 T. K
% c6 ]2 r& @) s8 ?0 r
2 k9 P. ?( B0 _3 [6 e$ s
GPIO : }9 C4 l: z( A* A5 `
  General purpose I/O
+ V+ l3 b3 p$ U' {; p1 c1 ^. \. z. C' S
* D1 J0 f, Q# F" |+ G9 f/ n& s. E
I2C
5 H) G2 V" t9 z5 f; {  Inter-integrated circuit
9 R6 |% K5 _5 H) D5 N# ~; B2 d: a
3 j8 d; M5 u( T5 ]' Q# H/ j- J2 q
8 N: H- X+ c/ k% Z
I2S % b" a  p2 J% d) y" |$ ~
  Inter-integrated sound 7 q9 }3 b! S( W+ x4 h. p
+ W5 u) ^, l4 |7 ?* O

3 S1 d8 U, y( ^. Y$ `/ i' cIWDG
3 G- v6 P) b# Q, ^  i  Independent watchdog & {: z8 |: U$ F0 z$ j$ A

3 m. T2 q3 z9 `

, t7 _# Y; g9 D' Y) _8 e$ dNVIC 2 }- K% O! d, ?4 T$ R9 l1 E8 G
  Nested vectored interrupt controller " f/ F0 ^/ w* Y% W

' N1 T6 O& z4 X- P; H

1 P! y4 g1 l: N; G& Y" h# o: o; ]PWR 3 t' S2 E* a* `$ |6 F4 K! m
  Power controller
3 E! z* A% y  [0 X' J" w' W& e8 W3 S2 v; A  Z" P4 |- F1 ?1 H4 f: ^
8 E+ v0 x# g5 W+ r2 g4 x0 {$ H
RCC ) h+ o0 T( {/ y# N$ m& Y0 R4 l
  Reset and clock controller # E; i0 I3 T, r! r' P2 z  `

# B& X! D  c+ A% m( x
1 m2 E  b: v. D
RTC " `7 P6 M( Q* h5 i* v  C
  Reset and clock controller
( w5 C: w0 Z$ _3 f: h4 W# s' I7 }! S# g2 r

: g$ @4 \5 {  ^* }7 }SDIO
7 V$ V3 e2 g9 @# k; s, a8 B4 s  H9 gSDIO interface / |4 Y* d3 u* F' a7 N5 V$ j+ p* v
" t2 R0 Q4 Z; b0 y

8 O. e3 I8 e4 ?, kSPI
5 e- w$ E4 t" B/ Q* DSerial peripheral interface
0 L* b+ z8 k% u: }  W5 Q) ]4 K* u2 H$ s& S  J
% u7 G$ d/ ]& u
SysTick * a( G/ Q5 k* [5 r- ^- X
System tick timer * E$ Z9 }* G* w) ?1 |% \7 O& ?

/ G1 U% A; ]3 B- [
5 ~, f9 [1 @0 E& }, |
TIM
( L" b& d- R6 E' S# PAdvanced-control, general-purpose or basic timer
. h/ [8 g% l" N  D
% o9 f: L2 B- K

- S  F6 r0 e1 m% LUSART , e* x* R: I, j& y1 M
Universal synchronous asynchronous receiver transmitter
/ _4 l. v* ~& v: `$ U+ K, W* R( ~! U$ x- a

& G5 B8 C8 q# S! I2 P) `* q2 nWWDG
0 k9 P# r. u1 _) C' i4 zWindow watchdog $ \5 {( m- @5 u( E2 I" V, o$ \
收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:365 a6 l  `! Y& G7 o2 ^
这个支持下,楼主发帖好多啊
6 X+ U: M/ o" S/ Y8 m
,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42
% v; ?- q4 H, ~: e$ F我是来学习的。
5 o; b/ j7 W8 ^4 v) H' a0 n: U2 X" k
一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:53
+ j- e( j$ J! L; Z  i+ o/ S目测是水经验的。。。。
$ f' j- Z0 @" |! h
水经验,你可以不看啊。
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
6 j) R/ f2 d1 l  r4 X0 A" l' @不觉明历

+ u+ C/ Z8 X3 i. \" @) J7 v9 f,这都是最基本的。
12下一页

所属标签

相似分享

关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新和工艺
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版