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

STM32库标识符命名规则

[复制链接]
党国特派员 发布时间:2015-1-28 10:06
Naming conventions 6 P2 N2 ]1 F: P0 S6 `
STM32库标识符命名规则
; z6 \- u" `4 d: Y$ |" b
% ~/ D1 W+ s$ K) Q5 l
" E, {! P2 k5 G' i
The STM32F10x Standard Peripherals Library uses the following naming conventions: , U, Z) l9 Z7 r: `2 ~
STM32F10x 标准外设库使用如下的命名规则9 c: q( d' W9 l/ |9 a5 K5 [# o

* l/ R. X! F. p1 a/ f7 K) Y

5 k" f# ^; o' @, L  \. G. qPPP refers to any peripheral acronym, for example ADC. % m. e7 \& {6 t( Z: t5 Q6 i; u
PPP表示外设缩写,比如ADC) t' E, l, q, i# M3 x2 ?9 F
System and source/header file names are preceded by the prefix ‘stm32f10x_’.
5 \& ?$ v: F; t: @, I9 B- E; Z( Z系统文件或者源文件以及头文件名以stm32f10x_作为前缀: z1 }4 e4 v' m* w

4 l' k6 O* A% G& {

& {$ v/ Q$ c6 {/ P6 F5 CConstants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
- b( \) K# c1 l9 vAll constants are written in upper case. $ t3 I* J! I; M( R( Y" k1 z* |
常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写
3 c  V9 J/ i% ?/ r' bRegisters are considered as constants. Their names are in upper case. , K5 ~, Q9 Z& i$ S
In most cases, the same acronyms as in the STM32F10x reference manual document are used. 2 k2 h+ K5 ], \5 d6 Q7 d0 _; }5 V
寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。0 X1 p; \% W0 m( g- U

4 {" B) J6 C3 x5 ?+ e' n& {
$ k# I" K2 I5 o" m
Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore.
, }  o/ ]5 G) O7 VThe first letter in each word is in upper case, for example USART_SendData.
2 l, Z# [! q# x) \& h* m6 \5 x5 tOnly one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name. + m: c$ F$ S9 A8 L8 n. \1 h
外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。' R/ j9 v% m  |5 }, M

3 B: _6 O) }( E$ n
" s4 L1 n, v" A7 K2 q
Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init.
, @2 a9 n6 f5 ^' z用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。' [4 w; k9 {7 X4 m' k

) [! P2 ^. o; m# P/ }
- W9 k! n" A. V
Functions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.
" \! i, Q% s+ V8 Q9 U用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.. W& ~; S8 e% E8 y1 J
* f. q9 c! F/ c8 n- v: z

: L- {( K7 L3 lFunctions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit. 5 ~+ n! M  ~7 F: Q
用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit4 T' T" t1 O; k
2 Q5 ]& Z2 \7 z% d9 n
' Z+ W! w6 X2 n! F2 {
Functions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd. # K" t/ O" S4 o, X2 U; O5 q* [! u
用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.
& y9 E5 c2 t& ]- w% z7 `$ g. |4 a
& ^6 P: ?* v! u# B" h

5 H4 z: u7 R, c9 k  d8 t6 d- n, ]$ mFunctions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig. % f& n4 W4 b# L8 @! ?+ h0 S
用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.
# c% i; O2 f5 p* P  D# S3 [: t6 K+ O& C3 m7 @
: G3 m9 S5 Q  M, _% B7 l- {
Functions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig.
* M/ R& d& N$ Z" F9 b! x用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.% j, i( H, O8 l7 s: t. B
2 e: r# b0 S9 M7 R- z
# W# x: {! Y+ ^6 h- j2 n. A
Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig. ( J1 h8 k" h6 _0 {7 Z9 w
用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.
) C/ S! C+ ?4 y6 J6 o
& }2 @% R/ x$ D6 s/ z
0 _' J$ p2 J3 H
Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus. ( b- S% R/ I  h, c2 T) s
用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.
  k# m, I, n- [8 ]* B3 y; q5 ~+ q% D- T( e7 J3 g2 X( j

5 [3 m) _3 O4 y% p, xFunctions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag. % e  U* `! `5 _1 I. O$ Z1 U! v
用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.9 c. B% l& J8 u

& A5 k; p/ }$ n* ]/ {7 f
9 H! s; Q4 L6 P* d
Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus. ! t3 M  p) j* ~& Q7 A6 I/ p
用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.
* P1 D/ \/ E$ F) p% C0 ^9 }+ d0 Q: r' x3 y( ^" j9 R

: q( l* d. D. o7 ]* ^0 b, l$ r" uFunctions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit.
0 w. F  \/ x# V+ ~用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.
. |) a; |0 m7 b: M
' ^) o7 I* @' v4 Y( w, c9 b  a

7 ]8 C2 U3 `* e2 U% g% W- W希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分
8 c! e0 j8 C( |. `另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”
% f2 \! a3 C; s
/ C1 D# P  m. R$ z$ V  t5 w

" P9 }$ m/ w7 ]3 i. j$ _) x9 _外设缩写# t& e, Z! _8 w2 g3 o3 F  a
3 b) s$ {% s' j7 K; W. y6 `6 J: D

, k) l4 p( K( d6 F" y# |: y7 x( yADC
  f2 ?% w5 J& o0 _  Q  Analog/digital converter 2 N5 o7 o" \( z4 Y: A* Q/ B) e; u
( P$ @7 k& R9 }, R/ I! s

8 Z, G5 l3 o+ a2 ~  p3 r1 `BKP
: W+ T0 r" j! H- j  Backup registers
9 R$ w7 g6 n9 ^2 Q4 U, q' c4 E/ \4 G1 T- Z% s( ~! i6 R
, q9 r* W) C* q% m
CAN : }3 y) V& b1 l3 f  Y$ A& C
  Controller area network
& H& }; H0 d6 D0 C; k$ |
1 {, f5 R: L. B- ~0 t7 A1 Y
( g9 ?! k+ q8 j5 y, L, r# N- m# y
CEC
2 {# j$ P: g6 e3 ~. B  Consumer Electronics Control - A0 J# c1 G. f6 ]) Z0 a# Q# ?
* _- R) F. K" {5 ~3 f

; D: J# q1 f% ]CRC , @. @: q4 m/ E9 f' R7 D
  CRC calculation unit ) ?4 V: b* r' L! Q1 W

) U6 z0 K7 M6 O3 w( Q' Y

3 ^% A0 m; j' x( b+ wDAC & _2 V2 h. T- _4 b
  Digital to analog converter ! e/ d9 Q$ x$ T
7 j0 e, y; p& Q6 W) N- v$ S

! H2 o" o1 E' s* sDBGMCU
7 [7 }' {+ U: s" b6 X) Z" ?4 P  Debug MCU
( L+ P" Z  @3 r) L/ a# p
% q( V' A9 p1 s) F
# H5 k2 F9 H9 [2 b. T
DMA 6 Y9 l- h( C& P$ Z, ?/ a9 X8 N; T
  DMA controller , U" S# C8 F+ j

/ I' r7 o* ^( r' F

3 H: w* x, I4 j% DEXTI 0 x& h) m/ q; d5 ~
  External interrupt/event controller
6 {" X  {" i# o. ]6 S
" `. ^8 n8 c$ A6 ~0 n

& W' o( s  ?6 }* L9 Y( Z8 yFSMC 3 _; R' _0 g; M8 n; Y0 y1 Q
  Flexible static memory controller % d) c( H# j/ ]1 i- ]  M5 X

+ B& q& w% P* j: g
2 d: a2 T7 u$ s  C
FLASH
4 q: Y9 r3 U( J9 rFlash memory
4 r0 O6 B) p% V+ ?8 _# z9 Y4 U9 V: }
+ s* I6 q' t, [; C; D
GPIO
! @: z; m' V- K8 ~5 P  General purpose I/O 9 K+ {5 M( ^- f; x  X
3 I9 R3 n9 [' [  B7 _
5 Z- O! [, h% O8 X: l- c% u
I2C
/ ~+ {- a, ~$ G  Inter-integrated circuit
; }  s" F' w3 n3 b
) E9 B) G. U6 N' N4 N$ f

5 }7 k3 y- S" U/ B6 K6 aI2S
; ]9 T3 x6 U, J  c) h0 \  Inter-integrated sound
9 d+ M  w6 S" l$ }8 @
. |7 E1 E/ z1 z6 \8 b& M! b4 c
0 b7 M3 c% @- m! V% h5 ]# c
IWDG * E- Z* o+ a+ y+ L4 B3 E, J
  Independent watchdog 1 P" r/ |0 u0 w' |

) Y2 b) o. E. k& w9 `6 B% M

9 S! m* u* I/ e) W& ~/ [2 FNVIC * ?6 E& a8 s& j9 e
  Nested vectored interrupt controller
# m# x9 T7 ]0 H; k% C0 q! e% j
1 P, @6 d8 U, i6 e$ ?
5 u; K" i2 ]2 [8 Q- E8 t
PWR
' D# l" L! Q! p1 t$ `* u% P* h  Power controller 0 U/ m) R9 c/ K' V

0 I# P1 i" K! {5 J
. X) C7 y, l7 y+ Z5 v
RCC
3 i4 z1 c( r+ V; |/ Q1 i( m5 y5 M  Reset and clock controller
5 [8 {# F4 M, U# R: v
5 Z/ I( e; U, r7 X% ?& Y
1 |' Q. a# f6 P* D, D9 e8 H
RTC 8 |* q1 Y- G$ u" O2 K$ j
  Reset and clock controller ; k3 B" T2 B" N9 @

/ o# R* L/ \4 V( }) I& r+ f3 ~

! I; r2 v3 [; e  i7 Z0 E3 QSDIO 5 i2 W. I! E  k, _2 I% o2 \/ }- E
SDIO interface
& v( I+ S5 k- c  V0 |! s
( C% W$ z3 a' @6 v5 h+ u# u6 X

4 g3 O* k' M) d7 u8 Z" J' iSPI ' A& x$ S$ e. f, v, V) M9 N8 c
Serial peripheral interface % s, s2 {) A  _  I

8 ^2 W9 z6 }. k9 x4 Q/ \9 U
: a' C! W" F: R8 P5 v
SysTick
" t- v3 ?5 ?% W8 j) M4 P+ ySystem tick timer " Z) s8 j  N" [8 B. y

3 \6 I& K( C, p0 C! I4 R
! b* f; M: A$ E9 X" u- Q# C7 g
TIM 3 \6 x) i. b* {7 i( K
Advanced-control, general-purpose or basic timer
( ^2 o8 y; C! }  E1 R' y7 F& K7 C( i% f# ~, c. P

4 e5 w) p2 Z7 x$ xUSART : N0 i. C' @9 R/ H
Universal synchronous asynchronous receiver transmitter
. Q6 m# @- Q- j) n- C' F
, F6 U9 q( x  s" _

% y, ~! f, @: GWWDG
& d  N) q2 B0 C: nWindow watchdog
4 B6 H4 i9 ?1 c$ P; Y# `
收藏 评论21 发布时间:2015-1-28 10:06

举报

21个回答
党国特派员 回答时间:2015-1-29 09:40:23
天天晓宇 发表于 2015-1-28 12:36
3 V. w+ [1 R, t# S& H这个支持下,楼主发帖好多啊

) s8 H; A3 F4 z6 A4 M. I,为论坛做贡献!
党国特派员 回答时间:2015-1-29 09:41:11
wangweili1978 发表于 2015-1-28 19:42
3 n- A6 b2 u) f: f1 C* h# p我是来学习的。
1 ]3 q0 P" E/ J- h0 F  A% o+ I6 u
一起学习,共同进步
党国特派员 回答时间:2015-1-29 09:34:57
QianFan 发表于 2015-1-28 20:53
! G! p2 q+ ^' s- k6 D8 u& D目测是水经验的。。。。
! p& j% h3 ]- S/ z2 E5 a
水经验,你可以不看啊。
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
' I$ l$ _' E2 `9 }+ t; o/ t4 M不觉明历

! m+ t/ T" T: h$ E+ o/ z,这都是最基本的。
12下一页

所属标签

相似分享

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