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

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions 4 j- j# u8 f( M! h" P. |1 A
STM32库标识符命名规则5 ?# B! e4 E$ e: A7 g! ^% s% e

; d6 c5 f- J+ v

  [/ I  ^4 _# h! ]9 qThe STM32F10x Standard Peripherals Library uses the following naming conventions:
$ X, w/ i' ~8 v* {, oSTM32F10x 标准外设库使用如下的命名规则1 X: `4 _! {8 @

1 g" f! |" x3 g/ s* T# d

: y1 j. G# }9 M& V" aPPP refers to any peripheral acronym, for example ADC. $ r6 V0 @% v( y2 M
PPP表示外设缩写,比如ADC) Z# g* D7 W) p  m' P4 U
System and source/header file names are preceded by the prefix ‘stm32f10x_’. 1 N3 @1 {: g4 e1 |9 \+ D* \
系统文件或者源文件以及头文件名以stm32f10x_作为前缀
' O2 V3 r- j/ D1 ]: x6 q3 Z) t
3 m% d: n5 r) t1 e6 t
6 Z1 z6 G3 n' x2 P# 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. . R8 o" j  X* ^
All constants are written in upper case. & Z% f2 n" O- ]) r7 j$ v+ R
常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写; j: c4 y% `/ \$ b
Registers are considered as constants. Their names are in upper case.
8 r. g7 J. y% tIn most cases, the same acronyms as in the STM32F10x reference manual document are used.   V, [2 s$ o& X3 ]' `, K" u$ [
寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。
! e: [( J" ?' H2 C5 f6 v- z! b

$ M/ b" g, C" j) d8 @Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore. # l: J" Z' X+ X& w1 }# m
The first letter in each word is in upper case, for example USART_SendData.
  V0 {/ q* V2 f3 Q  d0 h% H# `6 W2 h; xOnly one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name. 0 x6 i  U1 A% x% A4 N: _5 Q
外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。* G+ Q$ M% {2 C0 v' i
3 w+ C$ H/ b5 C  u
' T: x8 B/ v. R1 w: E
Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init.
5 X) f* v- n! o- ]) H- Z. g用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。
: E5 V$ N1 ]# `3 }8 t( e4 v' ~0 V" e

2 ^) b7 G: r, K! ?6 V* HFunctions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.
+ r5 Y2 |; }! }! ]& @/ U) E( S用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.- @0 t' i9 g3 F: n$ `

: f+ @+ }7 z8 V2 [( }" j

" ~3 W% F( ^  ~Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit.
8 Y0 Y/ T- x0 F- ?& h用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit
1 @2 S% b4 A) I
6 S2 O% a" }* u( n4 W' ~5 p: w

$ T( E( A9 I! [( h+ r% N: U5 WFunctions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd. + n0 N, W8 X' T$ ?& E, ^0 c9 [
用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.* c6 O. X0 k! ^! S
4 r* z* m4 M+ @' h9 d  ]
3 B# v) o" `- A9 l
Functions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig.
) Q2 ]: x& X& x6 ~3 Z; m/ w用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.! k/ V, f4 c* \
) ]( e1 O2 A& X' Q: L# |) E& m
! H/ s7 Z$ z# u/ k3 `4 u
Functions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig.
( k, z# {& K8 Z, u用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.
/ X" W9 Y8 ]9 f9 Y4 M) ~/ E  N# z: O

  S7 C; m0 z+ hFunctions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig.
/ c+ G6 j) G, ~用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.
3 w" C" E) r" \/ z9 S6 _& q) v' b9 q2 L+ T

$ y! s3 N$ E* ]* `- ^Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus. / }/ L' E4 M( ]3 ^  J7 N
用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.' e+ t+ L+ J5 g
. ?0 {0 Z5 Y) h$ u1 z# V1 J; x
+ z' N# b1 ~2 q; l3 D( F4 M4 S
Functions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag.
- D+ T- y( u# E用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.) m8 M& L6 a: s( e: w0 |8 l( T; d
' M  _! m# Q* U5 }

  D" v* _/ V/ F- C3 P% \Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus.
) n/ x$ ]9 ~) H$ v4 b& x- _: _用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.8 }/ t  t* z& `- O7 P
3 g5 {! T- v& u* {, I* H, h5 E* {

5 o! }* E# r! X; bFunctions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit.
; }6 V1 X5 N' ~) _0 R3 o( f用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit." y0 F) ]' J) P% Q0 c$ j  g0 s- \
1 |4 H+ P& x% l% |
4 j5 z" ?' Q7 G" d7 u
希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分: g% A* `9 a% N  U$ J, ?
另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”- b1 F5 B4 K, h2 ^7 f
/ g+ U; T+ {1 ], W$ o( p( P
6 X! g# x( E7 u9 s6 Y2 Q
外设缩写  J+ ?% N% A, h& @

- E- X' @4 ?% S1 E  [$ u% Z; q& p1 J
. p( T5 _' Y' y$ Q9 c# O" ~
ADC
1 H- B4 O' v, L4 H* Q0 v  Analog/digital converter 3 i+ O) [' v4 X+ j9 v4 b
9 f/ K- p+ o  I% W( Y
+ _5 k- `6 \. ^5 r* R
BKP
" \- e& p( A; t  Backup registers " a: a/ E" H- V" o) Y8 T
9 z  ~5 _* {( u" ?1 X4 h3 Q0 i0 H

3 _6 M7 c) P; S8 _+ W5 J9 cCAN
; ?2 m) g" O+ }  Controller area network
7 I' D( g/ `- h# L: g8 }
+ p7 E& s" k& R" h2 p$ ^

0 l# \' r0 a+ r. w0 rCEC " l# _6 C- T/ w9 S9 q* D0 M
  Consumer Electronics Control
( ^+ z% G% I6 ~' A5 i; Z# m1 a# S) A! [' ]/ v5 j6 W2 [& \3 W) g
6 z4 u7 X9 _" v: U4 b, f; {
CRC / p+ b$ z: _0 l' n+ T1 e
  CRC calculation unit : o4 O$ e; i/ P% P, ?

; w& u; z, j: s, G! \  ~7 ^
0 S( @, I; c8 v. r  q; z' h
DAC
8 E2 k; o  N$ p3 Y  Digital to analog converter
* M5 V8 w5 z# s! ^) u4 A" i, ~& o, T! L1 L/ x6 _
2 v7 ?  Q6 _  s/ x  V& R* y8 D
DBGMCU ; n3 U8 ~0 W5 k  ^- E8 ]
  Debug MCU
2 ~! g+ b3 h& S" g( `* N+ D; C% c1 L' k" m) R6 N6 Y1 q

6 R' v1 ]0 t. |" M+ HDMA # O! |/ ]# P; [- p( u* e" @5 T$ X
  DMA controller # _0 {, Y" D, c# {  e
: F+ K' k: p; q' C/ ^4 c

3 C5 G1 I) N7 d' QEXTI / M0 {- f/ `4 N4 ^; _- D6 t' h
  External interrupt/event controller . F8 V9 X( e' \2 t
; c4 h. X1 t5 ^5 D. P' H% c) M# I/ a

; n* r3 @# k: [9 uFSMC   h8 L7 U- e( V0 x( a3 J
  Flexible static memory controller
) ~0 k0 F0 g9 I
; U) ~: {, D% R; Y7 x

( f% }& F' p+ B  i( T7 z% N7 uFLASH ' l+ Z2 j' P5 n: g2 z
Flash memory
- {, E$ L/ H" l2 m) Q) q' O( ~3 y1 F4 s. J) [1 B# J
& j/ g( M, n% d5 q
GPIO + {8 b# a, H; J
  General purpose I/O
4 s# q6 c+ g! s5 t$ u" T& R7 I5 Z  z" J4 J

0 f/ ~* H1 b5 `' m: a$ FI2C
( V9 @( M1 k. k1 k, `  Inter-integrated circuit
; [4 W, X  V/ V. B" c8 J, d" ]4 m- l/ ]" U

6 O0 Y. d% {5 |/ |I2S
8 v6 o1 O8 C, H+ B) d2 q  Inter-integrated sound
. r9 ?$ o3 W+ `4 h  i  }- m; M7 o/ m9 C/ S
$ m: D8 V# u# \# x. ?1 D
IWDG + i: y1 s! C! w/ [
  Independent watchdog ' u8 s; |! r2 Y: H

- a5 E3 l! F0 h  S% y

8 P+ J8 k- E2 q' A# XNVIC
+ S. P4 a- [$ _. @- T, ?  Nested vectored interrupt controller $ R" }' M# ?1 m; ^& N

/ c6 j* e0 A( s4 K

3 t' f" l7 L" K2 I+ W' ]. Y4 hPWR
. @* w8 M- V! r  Power controller
% I8 r$ [5 v2 ^+ @0 j
1 d7 V; e; p- G2 f- z

9 J+ x; ~  {" F4 sRCC * l0 X5 M  {: u3 C/ ^
  Reset and clock controller
% d2 p" C/ W% B) _" o* e# c
  T5 }5 B7 B& J+ i/ v
& E) V7 Q! n& `
RTC
, X# N$ i7 c& U' |  Reset and clock controller 7 o% c- S4 ]* z1 M
) e& Y* l& @" l) T

, C3 d/ G* I) t8 USDIO ! z) d- j! _/ C1 W0 U
SDIO interface
0 K+ ^' Z* n: H& N! X2 j1 ?: H1 l' B6 n+ K% z: y) q2 z9 Q

4 X: F" L: E9 X4 f+ LSPI
. g6 R& B  ?9 J! VSerial peripheral interface 7 t0 c) m' V4 O6 @" C

: g# g$ W$ e" g: Y0 j. J3 c
) L' v( I- y6 o" _. {; n  Y
SysTick : N8 f8 P/ U3 p
System tick timer
' i! p; w6 n" u
2 |7 e9 F/ N6 p+ P* W5 Y3 {3 U  O/ J

* q7 c! T  V! `* T' V, Z, OTIM 6 w+ U2 ~, l3 }0 V" k
Advanced-control, general-purpose or basic timer
' X* K, @* `$ ]
  ?) x  c* H- r; n. f$ C

# u1 t9 x9 e$ \5 oUSART * P: W/ v7 e3 d' }
Universal synchronous asynchronous receiver transmitter
' e4 W  ?, I$ L- {+ k$ k4 o
* y2 A9 V  t6 H- s
2 y$ I: X) ^$ }0 G8 Q3 |- Q0 Z1 o
WWDG
% ]  x' Q- u& BWindow watchdog
) i* T* {; \9 l! @) K, j
赞 收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:365 \7 T  d. M( g, I# m
这个支持下,楼主发帖好多啊

5 U, `8 C  K0 w! u7 u  x; n/ F6 @,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42/ c9 T+ J. y3 S( i5 U3 w9 j
我是来学习的。
- Y& }% N# U) o9 x9 p' m; o
一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:53
  W% g! T) H7 l( P目测是水经验的。。。。
7 H! \$ o1 N$ A7 V
水经验,你可以不看啊。
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
4 f& T# n5 A& o, q* C3 ^不觉明历

: K4 k4 G9 M9 J5 ],这都是最基本的。
12下一页
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版