查看: 2843|回复: 1

STM32库标识符命名规则

[复制链接]
  • TA的每日心情

    2023-7-25 22:49
  • 签到天数: 385 天

    连续签到: 1 天

    [LV.9]以坛为家II

    发表于 2015-8-13 12:49:56 | 显示全部楼层 |阅读模式
    分享到:
    Naming conventions
    STM32库标识符命名规则


    The STM32F10x Standard Peripherals Library uses the following naming conventions:
    STM32F10x 标准外设库使用如下的命名规则


    PPP refers to any peripheral acronym, for example ADC.
    PPP表示外设缩写,比如ADC
    System and source/header file names are preceded by the prefix ‘stm32f10x_’.
    系统文件或者源文件以及头文件名以stm32f10x_作为前缀


    Constants used in one file are defined within this file. A constant used in more than one file is defined in a header file.
    All constants are written in upper case.
    常量:只在一个文件中使用的常量在该文件中定义,在多于一个文件中使用的常量在头文件中定义。所用常量名使用大写
    Registers are considered as constants. Their names are in upper case.
    In most cases, the same acronyms as in the STM32F10x reference manual document are used.
    寄存器被考虑成常量。名字采用大写。绝大多数情况下,采用与STM32F10x参考手册中相同的缩写作为其名字。


    Names of peripheral’s functions are preceded by the corresponding peripheral acronym in upper case followed by an underscore.
    The first letter in each word is in upper case, for example USART_SendData.
    Only one underscore is allowed in a function name to separate the peripheral acronym from the rest of the function name.
    外设函数名采用相应的大写的外设缩写作为前缀,之后紧跟一个下划线(表示分割),每个词的首字母大写,函数名只允许只用一个下划线以分割函数外设缩写与函数名的其他部分。


    Functions used to initialize the PPP peripheral according to parameters specified in PPP_InitTypeDef are named PPP_Init, for example TIM_Init.
    用于初始化PPP外设的函数命名为PPP_Init,PPP_Init函数根据在结构体PPP_InitTypeDef中指定的参数初始化PPP外设。


    Functions used to reset the PPP peripheral registers to their default values are named PPP_DeInit, for example TIM_DeInit.
    用于将外设PPP复位为其默认值的函数命名为PPP_DeInit,例如TIM_DeInit.


    Functions used to fill the PPP_InitTypeDef structure with the reset values of each member are named PPP_StructInit, for example USART_StructInit.
    用于将PPP外设初始化结构体InitTypeDef填充为系统复位默认值的函数命名为PPP_StructInit,例如USART_StructInit


    Functions used to enable or disable the specified PPP peripheral are named PPP_Cmd, for example USART_Cmd.
    用于禁止或者使能PPP外设的函数命名为PPP_Cmd,例如USART_Cmd.


    Functions used to enable or disable an interrupt source of the specified PPP peripheral are named PPP_ITConfig, for example RCC_ITConfig.
    用于禁止或者使能PPP外设中断源的函数命名为PPP_ITConfig,例如RCC_ITConfig.


    Functions used to enable or disable the DMA interface of the specified PPP peripheral are named PPP_DMAConfig, for example TIM_DMAConfig.
    用于禁止或者使能PPP外设DMA接口的函数命名为PPP_DMAConfig,例如TIM_DMAConfig.


    Functions used to configure a peripheral function always end with the string ‘Config’, for example GPIO_PinRemapConfig.
    用于配置外设功能的函数总是以字符串“Config”结束,例如GPIO_PinRemapConfig.


    Functions used to check whether the specified PPP flag is set or reset are named PPP_GetFlagStatus, for example I2C_GetFlagStatus.
    用于检查外设是否置位或者复位的函数命名为PPP_GetFlagStatus,例如I2CGetFlagStatus.


    Functions used to clear a PPP flag are named PPP_ClearFlag, for example I2C_ClearFlag.
    用于清除PPP外设标志位的函数命名为PPP_ClearFlag,例如I2C_ClearFlag.


    Functions used to check whether the specified PPP interrupt has occurred or not are named PPP_GetITStatus, for example I2C_GetITStatus.
    用于检查PPP外设中断是否发生的函数命名为PPP_GetITStatus,例如I2C_GetITStatus.


    Functions used to clear a PPP interrupt pending bit are named PPP_ClearITPendingBit, for example I2C_ClearITPendingBit.
    用于清除PPP外设待处理中断位的函数命名为PPP_ClearITPendingBit,例如I2C_ClearITPendingbit.


    希望对初学者阅读库有帮助,翻译自STM32标准外设库3.5说明部分
    另一方面,建议大家自己认真阅读这些英文,提高自己阅读手册的能力。阅读手册是你绕不过的“砍”


    外设缩写


    ADC
      Analog/digital converter


    BKP
      Backup registers


    CAN
      Controller area network


    CEC
      Consumer Electronics Control


    CRC
      CRC calculation unit


    DAC
      Digital to analog converter


    DBGMCU
      Debug MCU


    DMA
      DMA controller


    EXTI
      External interrupt/event controller


    FSMC
      Flexible static memory controller


    FLASH
    Flash memory


    GPIO
      General purpose I/O


    I2C
      Inter-integrated circuit


    I2S
      Inter-integrated sound


    IWDG
      Independent watchdog


    NVIC
      Nested vectored interrupt controller


    PWR
      Power controller


    RCC
      Reset and clock controller


    RTC
      Reset and clock controller


    SDIO
    SDIO interface


    SPI
    Serial peripheral interface


    SysTick
    System tick timer


    TIM
    Advanced-control, general-purpose or basic timer


    USART
    Universal synchronous asynchronous receiver transmitter


    WWDG
    Window watchdog

    评分

    参与人数 1与非币 +5 收起 理由
    loveeeboard + 5 三周年铜板双倍!

    查看全部评分

    回复

    使用道具 举报

  • TA的每日心情
    慵懒
    2018-3-28 17:24
  • 签到天数: 276 天

    连续签到: 1 天

    [LV.8]以坛为家I

    发表于 2015-8-13 12:59:50 | 显示全部楼层
    这很水啊                                
    回复 支持 反对

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /4 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-11-25 10:58 , Processed in 0.130396 second(s), 18 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.