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

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions
$ l, }# g  h- ^STM32库标识符命名规则
+ K* f: C7 p) q  Z8 a0 _. r: f% W5 j

! I# B6 R0 R( S* FThe STM32F10x Standard Peripherals Library uses the following naming conventions: & v: F3 }5 ^  c  c% q+ P) [$ r) _* \
STM32F10x 标准外设库使用如下的命名规则
, P* z6 W" A* j! _8 |1 }/ E6 s
+ A' n. v' f& O) @( Y4 K. ~
2 ?2 `1 d' ^, b, Q) x
PPP refers to any peripheral acronym, for example ADC. * ]! f2 A4 X$ e% Q
PPP表示外设缩写,比如ADC
5 R$ F2 J: D- d5 L: q# oSystem and source/header file names are preceded by the prefix ‘stm32f10x_’.
) e( {9 @' S( U) }4 c系统文件或者源文件以及头文件名以stm32f10x_作为前缀' N/ i* M! ]  B( ~8 a' v, s  G

3 d8 _, f6 k9 h, E; r
6 s) w3 d  [( s( V# @6 a
Constants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
$ U7 H+ S0 p3 RAll constants are written in upper case. 0 |) o7 h. h/ b& J6 v8 o
常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写3 \4 j4 S# @8 h, _+ J5 q
Registers are considered as constants. Their names are in upper case.
& F: M3 g. O  F1 x1 f- z! {In most cases, the same acronyms as in the STM32F10x reference manual document are used. : j4 w5 w% y1 n) V
寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。
+ j& ]: u( o. J0 a! {8 }6 s6 D6 {; O0 A
1 y# |$ O* l  H  C+ Q' d
Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore. 0 T5 Z; \7 t& |9 q- n0 }) O
The first letter in each word is in upper case, for example USART_SendData. : {& G5 U" h/ O
Only one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name.
) L0 W3 S& ^8 D  K) ^, U外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。7 \5 V0 f9 r- ^

+ {# H& p7 K* y

% }5 P& }; {1 n9 _Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init. , o, Y5 H# b; u2 ~1 T# \$ V
用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。. o) i& a! w- Q; e" N1 e
( k# E  x. b% j( I
) e( I/ ]+ h: T/ a4 `0 A& s, k& S* k
Functions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit. * a1 w7 G' d: i5 U- ~( R9 v4 E% I
用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit., `+ W  o# x- E7 B* y- b7 q2 M- r

& y$ ^+ o* g  i( r7 D
* F9 G% o0 T/ f1 m8 Y# v% Q
Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit.
4 _4 c5 |  d! o% y用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit
& ?2 `% ^, I! ]) i9 A' K: O" r: K2 Q3 z

9 ^$ g# W: G* l6 _( F0 u* X6 lFunctions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd.
  x8 v2 _- y1 _# M& ~用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.4 K2 w% _9 U* t1 n; r1 z- {

! ~  I! c) J+ r# u) y5 C
( z3 T0 c1 n. b4 x9 b  q7 Y1 o( H0 d* w# E
Functions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig.
: W" m$ d: N. M8 v用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.* \' d9 d& D; _4 d+ V% a. h

  X2 s: x& s% ~1 p; u5 K

, \, }6 t1 u% X$ i6 k! I) u& Z6 _Functions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig.
0 J5 H* h2 a& U- z: e用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.
' H/ l! k! ^/ v
. o* ^2 n1 T1 |# C/ k+ K% J% {: p
) A1 ]$ Q$ Y, V: {( Q( ^" K
Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig. $ [0 q* U4 u; s% J* A! C4 j, _4 w/ {( j
用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.
3 F& ~- `  t) ~! K, l) |7 A: h' ]2 ?

3 |- q( w6 s! \6 V" u) F$ L/ UFunctions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus.
4 c+ l' m; `# f' o  a* G7 s( t用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.
) p' u; i2 ~( N3 f0 k1 n, e, @! d+ a
" `+ v9 m% d# T# x. Z! J, Y* P/ v
Functions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag.
# k) h! |5 P6 k% Y1 X" K8 c3 l用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.! P% {8 \6 q* p( W
7 Z3 g* w) M6 H$ K; v
, D# `6 S  `0 `9 ?2 h1 r
Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus. 6 ]& h( y: w# t. o) w6 _$ f
用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.
- z" }6 P! |. D/ W1 a# `
( @6 q7 ~3 L* J0 ~3 F
/ ]: V$ D7 i  _, i$ k" P# [: ^
Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit. ' f. P- s. E5 ~: i7 l; @; W+ y
用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.9 R2 P) F, A/ L5 E6 ^: ^

- m5 J9 S# w  w- r

! G3 N, a2 j- g. O: j希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分
2 \9 e1 O% _1 I) J/ ?% n- R另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”$ E- G( |, k" w' z. _) R1 u
6 l, b1 {$ s9 i/ j, l
6 c( y7 ^7 \# }4 c; w4 i
外设缩写! q% y, g; X9 s
( Q1 E& U, @5 x5 t0 o* i) ]
, A: @: j2 {) p  u7 {. x8 q
ADC
( [. S' z! J$ R' J4 {  Analog/digital converter . c4 L9 B, t" P% L7 G; L% d) ?
  E% Z7 E. w" y2 q

5 M* Y6 H2 P2 F' f/ `BKP ! |! ?) `1 ^- l: W% c) k4 f
  Backup registers / g& e' @3 }* Q4 K6 Z, r1 u) t

7 N* t5 u5 {" G+ n1 Q3 {
/ s  L% c9 p! n& a, P" Y* @) N' r
CAN
3 c$ m; H3 ?- }1 `& q& [  Controller area network $ L. w( H# X+ t  i. ^3 }$ @

2 K) h4 `3 }" Y

3 w" y4 T! x& rCEC
* u7 Q  T9 d! G  Consumer Electronics Control ( i- O& E. B3 O! x' {
) w! v+ J, O# J( p+ j/ }7 ]' \
, @# e  ^; z1 N- p% p
CRC
. n* r2 u2 a( A) ?# \' [  G2 c  CRC calculation unit / H, j/ A4 `) S3 R7 |, l( `

- a% |# Z" V9 `0 [% I

  K8 i9 K' a$ B  w1 vDAC
, z/ o* V- x' I4 o9 ]' P9 f" o  Digital to analog converter
8 o& J& y7 E( J2 f7 a  ~
! [) g. `( L) d" v) y

6 }  H- }. R( O; v6 zDBGMCU $ @, ^- K( `# q: g9 W0 W9 Z
  Debug MCU
) V/ Y! W# ^" P, M! F* U, l7 R6 o; ^: V9 j9 I8 s

, i# b$ D$ i: b0 N, S- v2 V! S' s( ADMA ' r& n! y7 n! L7 o" U: J
  DMA controller
# m+ f* d$ i9 b- T+ ~; o) F8 V2 N( S; I8 \
8 I; {; g1 b7 T% y  }
EXTI
8 x' Y2 i- |$ I+ }$ Y  External interrupt/event controller
" F' f/ ]2 x1 d7 r3 v% D# G+ u$ s2 k6 y) q- r, w# A3 k
- H7 h; B/ o! o8 `
FSMC
  U. |; @( S) w. z: A* E  Flexible static memory controller 3 j9 C* x0 \! Y) U

( y4 U4 U4 e3 n5 ?: V4 M# ?! Z

+ t8 g& A$ Q) i; _  ]- iFLASH
$ T' d' j! h( Y1 lFlash memory
/ j$ a8 l! O# J2 Q# J6 ]0 @# p2 P, M. f/ E# v
. K- p9 H6 ?. P- g1 @6 T
GPIO
2 F: J" W% {  T% \4 v$ ?  General purpose I/O
+ S& {0 x( x' ?) }( k& p2 |9 d7 ^$ Z. s9 Z% ?6 h

7 N$ b: ^* B" t' x& [/ r9 r6 s$ hI2C
, a$ X" q" C" |4 z  Inter-integrated circuit ) P7 ~1 K; k- K  p7 @2 z8 y  G

4 I& O0 r# }2 K, W; p. }
* d5 E- I% ^% A& Z6 f  r
I2S ' ^  ]# `: t8 N/ i6 e4 ?- M  q6 _. o
  Inter-integrated sound 4 t1 Q  E+ a7 K( P: l5 N( P7 }
' O4 K$ v4 E* O
; T4 ]$ |* J5 b: M; T
IWDG 6 J9 r1 q! e# o" U5 L6 V. K( O
  Independent watchdog
* H4 F$ ^+ }3 J$ i2 E  a( V( O. ?# ]/ t& X% O" {  Y2 L0 F, b
5 O2 K$ o0 @% J3 y0 \, r" b
NVIC
+ u9 V- s4 `5 j3 _  Nested vectored interrupt controller
$ _3 _' t  O6 u) q* z( p# y1 L  f, a2 p6 ]  ?# r5 }; i

$ z; c0 m3 U8 v% r8 O9 yPWR 4 B. |; D4 |$ j9 @! g7 V! H2 J) y+ S
  Power controller
' ]5 N, s5 |) t' j% Y
7 t1 L. K0 P& A3 b

- I/ g1 X" V: i$ j, dRCC $ H8 r& A7 U4 J: v! T
  Reset and clock controller
, [9 m1 n! ^: ^
, |, l5 y3 J# I- Z( H3 R
  ^: {  B, b$ d% s5 {2 N
RTC
8 k" j0 P( t. s& @  Reset and clock controller 4 E5 b% Z4 ~9 V/ w: a1 y1 v% X0 X  T

: L" Q. y& T5 q& e! t

: W+ o  h5 Y& u' USDIO # K; ~8 p% v7 R% U3 ]
SDIO interface
4 g3 k! q+ F  a, J9 Y+ H0 I( d' `2 E+ t0 C" V; x: u$ w: d0 ^
! n, v4 t: U8 W) L, |# h
SPI ; c( E# s% Y. D
Serial peripheral interface
  L# U' o/ c: P, X& M' R% {% j3 Q$ G" V  d' Y* Z; }# v

7 I0 w5 P. U' B3 f1 mSysTick
- U  k7 q4 c9 ^  N$ JSystem tick timer
+ n7 n& J& A( x! P% W: k& d
: X7 z) G; C+ P$ D

5 c* W+ _% N  V5 o# {; _" i5 v2 R& BTIM
0 N6 z0 `; r' F! B, Y7 M' }0 H0 GAdvanced-control, general-purpose or basic timer 9 C) G" I4 {! ]5 a9 @5 g5 b4 \6 D) a

, c! A/ M% @" B
5 j( {3 S8 a" ]0 F5 k
USART
8 ?- p4 y, r, b( E$ B$ AUniversal synchronous asynchronous receiver transmitter
  t5 k" p1 H# q9 h" d9 l$ A3 J, D2 w
1 h, D; u, A/ V& i' B1 s
WWDG - {2 P/ O! D2 S" G8 H' x, H
Window watchdog : |( T5 e6 F9 o( e
收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:369 S" |: V+ R' q# ~/ Q0 X
这个支持下,楼主发帖好多啊

& R- E& x" K8 Z$ ?9 `,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42
5 F) P. U  n* q: Y4 U我是来学习的。

( U/ H0 E# H% z6 ^$ M. K0 M4 P一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:539 |, l; V: @+ c% d
目测是水经验的。。。。

- P& W. V2 t8 l, z6 I# P水经验,你可以不看啊。
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:365 Q' }4 d, A+ w% J! |/ G; N) z
不觉明历
: c" J( u3 y) @( S
,这都是最基本的。
12下一页

所属标签

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