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

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions " q2 O( A7 {8 \- K, D/ ?
STM32库标识符命名规则8 r+ N% E0 {' j! M; R; x- D) o

' ?2 a5 r0 F9 Z/ {; _
' M, ]" ~) M3 e. g0 }0 P, s
The STM32F10x Standard Peripherals Library uses the following naming conventions:
% ]- u0 j9 R9 |2 WSTM32F10x 标准外设库使用如下的命名规则
: a9 k" t0 b( b, w: `6 i# U. }
0 c! p, Q( ^6 l& J, X4 g0 ]: T, f2 |

- z/ f" ]8 M' M( Q- I8 f$ }PPP refers to any peripheral acronym, for example ADC. - y6 i+ k% K; a
PPP表示外设缩写,比如ADC7 V$ J, {# z- e4 z% e3 N
System and source/header file names are preceded by the prefix ‘stm32f10x_’.
& @9 c+ I+ b! V系统文件或者源文件以及头文件名以stm32f10x_作为前缀
2 U7 s* k9 {4 e7 ?# \9 J* W& O: i+ B- W) D" z( {+ @7 J1 a

4 {: h3 U; U' I1 Y2 v4 ?Constants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
( M+ m6 Y& Q! a7 b3 x- r; ZAll constants are written in upper case. 9 g  n; V- l" S; D
常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写
# P3 O, u6 X  i4 h1 SRegisters are considered as constants. Their names are in upper case.
2 B" i1 b6 |# G+ iIn most cases, the same acronyms as in the STM32F10x reference manual document are used.
* C% l& @% U; _# Y! b寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。
/ r! ]6 Z0 A! Z6 V. d8 h: C# C0 q: y1 m9 D' @% c3 A4 N

0 {% F9 O3 J( S) P1 N& MNames of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore.
; k  r- i2 w$ @* n6 R5 m: iThe first letter in each word is in upper case, for example USART_SendData.
2 g& ]5 u/ f5 n/ V% QOnly one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name.
: k, H, {- {9 j, v* ~. o外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。- O$ \# y8 g9 y

5 S7 R! m* x& o

; |5 E; Y4 x, f/ A0 S5 k1 y% WFunctions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init.
8 w1 }8 \) e. s. a5 H  B' T用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。
3 J2 ~% F( N% c( C, A0 i
6 I- Y  f) _4 K$ w1 `

, d# U% s  r  S  T. UFunctions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.   V' {7 R/ u7 t% @. w
用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.0 I$ Z) U; b: P6 B: c1 z9 l
. x/ m9 L# Z' S
" Y; x  \: D+ ]9 G) r% O9 `0 \
Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit.
$ A4 a$ ?* Q( l6 {3 X用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit0 @9 Z; I5 W3 l4 Y
' M) q, a, `3 l5 f9 W

2 s9 c5 v: f6 x* }  _0 mFunctions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd. / `+ z1 \, V2 E! y! u+ y! A. N
用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.
/ I+ h3 k$ c4 ?, m2 X
1 U' u6 l" L" s% {3 H9 u) r

& r9 R) a/ g6 k* `4 qFunctions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig. ; W$ e- v' v# m
用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.6 A- L/ K8 r6 n1 J7 g

; q9 ~2 i/ |. `

; r' J5 [% C( x6 r: x' m: I2 HFunctions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig.
* e) \  w: W2 C8 J. K用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.. R4 ~' F/ ?! {# Q

; ?: A9 \& P1 t" j; l, B4 d" p
8 ^( l( @6 G. V) N4 s- S9 [6 Y
Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig. ) h2 O% {& ]% F% v
用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.
9 F! Q+ g4 i) y  F; {4 v5 k  b% Z- l# U  T5 M" I

2 T: T! R; [5 ~* RFunctions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus.
& E8 u) Y! C% w, w2 A: }: ]$ V% r用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.4 n- D3 {4 d7 J& s0 j
7 c! h# G: H% S1 @4 ^8 u, u2 R  K

% r* H- M  @) d9 [' }6 ?4 wFunctions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag.
+ v4 U/ ?* z& y! k/ q% s% ~用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.
0 _9 x. @* ^9 Q" g9 r
. W3 V* U# x# Y) |

% F" C6 U* k2 J5 j% u- X, T% eFunctions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus.
2 N: l# @! }+ M' |! `用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.
( j. n1 ?2 [: q% Q5 g1 n' x+ D5 a1 g' J$ y0 Q
" }9 M$ S3 a, |. {* d" S
Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit.
& E* j# a* d6 z+ x用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.9 K6 T, V3 H  C/ ?& i3 R2 f5 e5 \

) l& Z' V7 m( ^6 ]) g6 F
5 f( w9 Y1 `. v  H6 c) R3 ^% d
希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分
* z& u* K' m4 c: k另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”
" s3 f! k2 [& P0 `3 E' z: \! t0 x; U; x( z0 i

5 l, a1 P7 K( `! |1 k! B! l8 S外设缩写
* ]. f; O3 z+ `. K
. y$ M9 P3 M; m/ j% G' A

& u0 @; W- D# uADC : Z2 R' E3 i# H% o3 r
  Analog/digital converter / R, f& |( a  ?- \( ~2 `

* E) N" y, ]6 h% P) @
1 ?& k  \. H, l" G; }2 N
BKP
+ r. e/ `* _! q& D" [8 J( _( h  Backup registers 7 r9 M) ?  e7 s3 M. T6 `$ V. o
- a5 S7 z6 Y; k
2 V! |, i9 ^# p# X
CAN 3 v" `+ D- I6 s
  Controller area network ' D8 ]( p: D" _; U
% \) A  s# Q) ?$ M
( A# V" L! U# x, r* U
CEC : _  K6 ]) j3 @# `' j, y/ q8 r
  Consumer Electronics Control 1 [1 h: q( V3 q; M

. ]$ L" ?$ G" t; O& C3 g5 |

" H% h% w2 Y  b: C" BCRC ! b+ {; G6 [- u  y: l1 z
  CRC calculation unit
( j: x4 h) r. x' ]
: f. D9 t( Y/ ?* S
7 L# W$ M( d" E1 K
DAC $ _9 ?" j8 E6 O* `. L; E
  Digital to analog converter 7 s, o% i  ~1 u( e& K8 J
4 O5 R! ~: e9 ~' y% \; m& g/ \

7 \. R- f/ H1 B3 ?+ ZDBGMCU
8 e% a8 _! m/ f" W! ^1 d  Debug MCU 2 k) s) h3 t/ v: k9 O
! \( x1 y" i  c! X" Z
/ f9 L" ~: u* X! D
DMA
- t8 M/ w- c* V" J  DMA controller
* q3 u" [3 E& n7 g; F0 b+ {5 |8 a) F% `$ s8 C* K' g; A

1 Q5 \! _' X9 V$ w! A3 UEXTI
# O8 w( P8 ~" n6 m  y  External interrupt/event controller
. o3 a( z- n9 M& N! N0 d4 Y
/ f0 l6 q0 \1 `$ g  J" y
& u8 ]  U4 A7 }& z/ h3 N8 U- K
FSMC
* ?  U4 v0 G$ I1 v  Flexible static memory controller
9 P' U% g1 ?. q) t
$ {% R- m- ^1 M. t8 e8 V

6 X- q+ N5 F8 t$ G) PFLASH
/ e  j3 A# @# i2 a; OFlash memory ) L6 _3 ]0 R5 s# o

9 W$ C6 T: ?! @8 E

% g" l1 m% j  eGPIO , q0 t. i+ r: V% V) u
  General purpose I/O ! M6 Q1 C& q' u1 G2 g4 C
, R. ^2 o! T5 z! X+ e8 o

- ]% g( P4 `5 _5 ]I2C 4 P4 B/ {9 u9 x. ~$ A
  Inter-integrated circuit
' j' i! d( c, x9 X
, x0 R( z1 V& ^# S0 F

2 _& s9 ~8 B' O) \I2S $ g$ \) i# S2 g
  Inter-integrated sound 8 f% {( n3 x" J; R% `

7 N: r' D- k# g2 Z* {' o) f2 d% `

7 x6 @* J8 ?( E' m8 F. UIWDG
/ e8 S  D# b, q% b  Independent watchdog
9 Z7 ?# K5 x; Y0 W9 B; g7 U; Q- }. r3 G, a

8 Q, X/ l7 c8 G( uNVIC 2 Q4 e; n8 A  ~$ @
  Nested vectored interrupt controller # E2 ?8 l  W: t& ^5 j
0 d2 f; N  v/ J9 M

0 W/ `5 J3 ~! {/ gPWR 8 g0 V) @9 P# G4 y( x
  Power controller 7 P+ u$ l9 j: H0 T1 H  ~( m6 J, P' V

; k6 v8 H: O, Q  {3 b

. s' U# k: D1 U5 [5 r( URCC - C" l; [! N" ^" J( u+ U' S  _9 }$ T
  Reset and clock controller
% n4 P5 t* ^& g/ N4 b% W( g; M
6 V: ~1 }4 p: N1 e

  g, E! g* B) W- i8 Z, W2 O( g) `RTC
/ A7 W+ J* u" u( g* l- y* d' C  Reset and clock controller - g' m% @9 x0 x' K3 l

  P) y4 z. V3 }5 E. Q  u

% @4 G! m9 Y4 F4 u) S) pSDIO - A, a; v, q# C; z* f, @+ \
SDIO interface
5 L; G& g7 @  g+ m" S3 @! p
# V. B, r: a& r
8 I8 {) i- D" s
SPI
' F3 Y. e6 C: {% U! u0 WSerial peripheral interface 2 }/ ~6 |; i/ {( Z

) x% I" G2 ?- }1 o: ^% t  t( `8 p+ ^
  g5 g) i- d4 _- z7 @9 n- S! E
SysTick
8 z# ^, B# {" Q/ A7 rSystem tick timer ; X- r# h0 ]3 h' E# s& [! U; p# o$ D

  n, H; l0 i, O0 V  A) f

2 Y# q4 o; T) QTIM 3 a& z# i7 x  {0 s+ n: e. N: p' `- P
Advanced-control, general-purpose or basic timer ( J7 G6 e+ b3 `/ S3 A2 Z/ @
& t0 k2 ?5 ?! u8 B7 [; s" Q

8 u/ B% i1 e% q9 g* hUSART
- G' i0 V7 \% P/ E$ u& F- ?Universal synchronous asynchronous receiver transmitter
4 L# X. O1 U- u9 x( }+ P& R+ ?- n+ T& u

" w  T6 W# x/ j6 SWWDG
" A5 D8 V. s' D# o% e& R3 xWindow watchdog
: m: n: R0 f0 r  |6 ?+ K6 K
赞 收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:36
1 c- j$ _! s7 b0 h8 u& A2 u" g5 P这个支持下,楼主发帖好多啊
9 f8 I+ H8 h9 |; h# S  u
,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42' I4 ~3 V( G) L
我是来学习的。
2 h: G  n0 q6 x( @
一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:53
6 V" `5 k# f' K8 _, Z8 N% k目测是水经验的。。。。

; N  `! ]* D: W* c  B2 q$ `' N水经验,你可以不看啊。
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:368 ?9 p* q1 Q. a* t0 C
不觉明历
/ D' N; R, b: \! R; }
,这都是最基本的。
12下一页
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版