历史上的今天
返回首页

历史上的今天

今天是:2025年02月04日(星期二)

2021年02月04日 | stm32f10x_gpio.h源文件供自己参考

2021-02-04 来源:eefocus

/**


  • @file stm32f10x_gpio.h

  • @author MCD Application Team

  • @version V3.5.0

  • @date 11-March-2011

  • @brief This file contains all the functions prototypes for the GPIO

  •      firmware library.
    • 1


  • @attention


  • THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS

  • WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE

  • TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY

  • DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING

  • FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE

  • CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.


  • © COPYRIGHT 2011 STMicroelectronics


*/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F10x_GPIO_H
#define __STM32F10x_GPIO_H

#ifdef __cplusplus
extern “C” {
#endif

/* Includes ------------------------------------------------------------------*/
#include “stm32f10x.h”

/** @addtogroup STM32F10x_StdPeriph_Driver

  • @{
    */

/** @addtogroup GPIO

  • @{
    */

/** @defgroup GPIO_Exported_Types

  • @{
    */

#define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) ||
((PERIPH) == GPIOB) ||
((PERIPH) == GPIOC) ||
((PERIPH) == GPIOD) ||
((PERIPH) == GPIOE) ||
((PERIPH) == GPIOF) ||
((PERIPH) == GPIOG))

/**

  • @brief Output Maximum frequency selection
    */

typedef enum
{
GPIO_Speed_10MHz = 1,
GPIO_Speed_2MHz,
GPIO_Speed_50MHz
}GPIOSpeed_TypeDef;
#define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_Speed_10MHz) || ((SPEED) == GPIO_Speed_2MHz) ||
((SPEED) == GPIO_Speed_50MHz))

/**

  • @brief Configuration Mode enumeration
    */

typedef enum
{ GPIO_Mode_AIN = 0x0,
GPIO_Mode_IN_FLOATING = 0x04,
GPIO_Mode_IPD = 0x28,
GPIO_Mode_IPU = 0x48,
GPIO_Mode_Out_OD = 0x14,
GPIO_Mode_Out_PP = 0x10,
GPIO_Mode_AF_OD = 0x1C,
GPIO_Mode_AF_PP = 0x18
}GPIOMode_TypeDef;

#define IS_GPIO_MODE(MODE) (((MODE) == GPIO_Mode_AIN) || ((MODE) == GPIO_Mode_IN_FLOATING) ||
((MODE) == GPIO_Mode_IPD) || ((MODE) == GPIO_Mode_IPU) ||
((MODE) == GPIO_Mode_Out_OD) || ((MODE) == GPIO_Mode_Out_PP) ||
((MODE) == GPIO_Mode_AF_OD) || ((MODE) == GPIO_Mode_AF_PP))

/**

  • @brief GPIO Init structure definition
    */

typedef struct
{
uint16_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
This parameter can be any value of @ref GPIO_pins_define */

GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
This parameter can be a value of @ref GPIOSpeed_TypeDef */

GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
This parameter can be a value of @ref GPIOMode_TypeDef */
}GPIO_InitTypeDef;

/**

  • @brief Bit_SET and Bit_RESET enumeration
    */

typedef enum
{ Bit_RESET = 0,
Bit_SET
}BitAction;

#define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))

/**

  • @}
    */

/** @defgroup GPIO_Exported_Constants

  • @{
    */

/** @defgroup GPIO_pins_define

  • @{
    */

#define GPIO_Pin_0 ((uint16_t)0x0001) /*!< Pin 0 selected /
#define GPIO_Pin_1 ((uint16_t)0x0002) /!< Pin 1 selected /
#define GPIO_Pin_2 ((uint16_t)0x0004) /!< Pin 2 selected /
#define GPIO_Pin_3 ((uint16_t)0x0008) /!< Pin 3 selected /
#define GPIO_Pin_4 ((uint16_t)0x0010) /!< Pin 4 selected /
#define GPIO_Pin_5 ((uint16_t)0x0020) /!< Pin 5 selected /
#define GPIO_Pin_6 ((uint16_t)0x0040) /!< Pin 6 selected /
#define GPIO_Pin_7 ((uint16_t)0x0080) /!< Pin 7 selected /
#define GPIO_Pin_8 ((uint16_t)0x0100) /!< Pin 8 selected /
#define GPIO_Pin_9 ((uint16_t)0x0200) /!< Pin 9 selected /
#define GPIO_Pin_10 ((uint16_t)0x0400) /!< Pin 10 selected /
#define GPIO_Pin_11 ((uint16_t)0x0800) /!< Pin 11 selected /
#define GPIO_Pin_12 ((uint16_t)0x1000) /!< Pin 12 selected /
#define GPIO_Pin_13 ((uint16_t)0x2000) /!< Pin 13 selected /
#define GPIO_Pin_14 ((uint16_t)0x4000) /!< Pin 14 selected /
#define GPIO_Pin_15 ((uint16_t)0x8000) /!< Pin 15 selected /
#define GPIO_Pin_All ((uint16_t)0xFFFF) /!< All pins selected */

#define IS_GPIO_PIN(PIN) ((((PIN) & (uint16_t)0x00) == 0x00) && ((PIN) != (uint16_t)0x00))

#define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) ||
((PIN) == GPIO_Pin_1) ||
((PIN) == GPIO_Pin_2) ||
((PIN) == GPIO_Pin_3) ||
((PIN) == GPIO_Pin_4) ||
((PIN) == GPIO_Pin_5) ||
((PIN) == GPIO_Pin_6) ||
((PIN) == GPIO_Pin_7) ||
((PIN) == GPIO_Pin_8) ||
((PIN) == GPIO_Pin_9) ||
((PIN) == GPIO_Pin_10) ||
((PIN) == GPIO_Pin_11) ||
((PIN) == GPIO_Pin_12) ||
((PIN) == GPIO_Pin_13) ||
((PIN) == GPIO_Pin_14) ||
((PIN) == GPIO_Pin_15))

/**

  • @}
    */

/** @defgroup GPIO_Remap_define

  • @{
    */

#define GPIO_Remap_SPI1 ((uint32_t)0x00000001) /*!< SPI1 Alternate Function mapping /
#define GPIO_Remap_I2C1 ((uint32_t)0x00000002) /!< I2C1 Alternate Function mapping /
#define GPIO_Remap_USART1 ((uint32_t)0x00000004) /!< USART1 Alternate Function mapping /
#define GPIO_Remap_USART2 ((uint32_t)0x00000008) /!< USART2 Alternate Function mapping /
#define GPIO_PartialRemap_USART3 ((uint32_t)0x00140010) /!< USART3 Partial Alternate Function mapping /
#define GPIO_FullRemap_USART3 ((uint32_t)0x00140030) /!< USART3 Full Alternate Function mapping /
#define GPIO_PartialRemap_TIM1 ((uint32_t)0x00160040) /!< TIM1 Partial Alternate Function mapping /
#define GPIO_FullRemap_TIM1 ((uint32_t)0x001600C0) /!< TIM1 Full Alternate Function mapping /
#define GPIO_PartialRemap1_TIM2 ((uint32_t)0x00180100) /!< TIM2 Partial1 Alternate Function mapping /
#define GPIO_PartialRemap2_TIM2 ((uint32_t)0x00180200) /!< TIM2 Partial2 Alternate Function mapping /
#define GPIO_FullRemap_TIM2 ((uint32_t)0x00180300) /!< TIM2 Full Alternate Function mapping /
#define GPIO_PartialRemap_TIM3 ((uint32_t)0x001A0800) /!< TIM3 Partial Alternate Function mapping /
#define GPIO_FullRemap_TIM3 ((uint32_t)0x001A0C00) /!< TIM3 Full Alternate Function mapping /
#define GPIO_Remap_TIM4 ((uint32_t)0x00001000) /!< TIM4 Alternate Function mapping /
#define GPIO_Remap1_CAN1 ((uint32_t)0x001D4000) /!< CAN1 Alternate Function mapping /
#define GPIO_Remap2_CAN1 ((uint32_t)0x001D6000) /!< CAN1 Alternate Function mapping /
#define GPIO_Remap_PD01 ((uint32_t)0x00008000) /!< PD01 Alternate Function mapping /
#define GPIO_Remap_TIM5CH4_LSI ((uint32_t)0x00200001) /!< LSI connected to TIM5 Channel4 input capture for calibration /
#define GPIO_Remap_ADC1_ETRGINJ ((uint32_t)0x00200002) /!< ADC1 External Trigger Injected Conversion remapping /
#define GPIO_Remap_ADC1_ETRGREG ((uint32_t)0x00200004) /!< ADC1 External Trigger Regular Conversion remapping /
#define GPIO_Remap_ADC2_ETRGINJ ((uint32_t)0x00200008) /!< ADC2 External Trigger Injected Conversion remapping /
#define GPIO_Remap_ADC2_ETRGREG ((uint32_t)0x00200010) /!< ADC2 External Trigger Regular Conversion remapping /
#define GPIO_Remap_ETH ((uint32_t)0x00200020) /!< Ethernet remapping (only for Connectivity line devices) /
#define GPIO_Remap_CAN2 ((uint32_t)0x00200040) /!< CAN2 remapping (only for Connectivity line devices) /
#define GPIO_Remap_SWJ_NoJTRST ((uint32_t)0x00300100) /!< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST /
#define GPIO_Remap_SWJ_JTAGDisable ((uint32_t)0x00300200) /!< JTAG-DP Disabled and SW-DP Enabled /
#define GPIO_Remap_SWJ_Disable ((uint32_t)0x00300400) /!< Full SWJ Disabled (JTAG-DP + SW-DP) /
#define GPIO_Remap_SPI3 ((uint32_t)0x00201100) /!< SPI3/I2S3 Alternate Function mapping (only for Connectivity line devices) /
#define GPIO_Remap_TIM2ITR1_PTP_SOF ((uint32_t)0x00202000) /!< Ethernet PTP output or USB OTG SOF (Start of Frame) connected
to TIM2 Internal Trigger 1 for calibration
(only for Connectivity line devices) /
#define GPIO_Remap_PTP_PPS ((uint32_t)0x00204000) /!< Ethernet MAC PPS_PTS output on PB05 (only for Connectivity line devices) */

#define GPIO_Remap_TIM15 ((uint32_t)0x80000001) /*!< TIM15 Alternate Function mapping (only for Value line devices) /
#define GPIO_Remap_TIM16 ((uint32_t)0x80000002) /!< TIM16 Alternate Function mapping (only for Value line devices) /
#define GPIO_Remap_TIM17 ((uint32_t)0x80000004) /!< TIM17 Alternate Function mapping (only for Value line devices) /
#define GPIO_Remap_CEC ((uint32_t)0x80000008) /!< CEC Alternate Function mapping (only for Value line devices) /
#define GPIO_Remap_TIM1_DMA ((uint32_t)0x80000010) /!< TIM1 DMA requests mapping (only for Value line devices) */

#define GPIO_Remap_TIM9 ((uint32_t)0x80000020) /*!< TIM9 Alternate Function mapping (only for XL-density devices) /
#define GPIO_Remap_TIM10 ((uint32_t)0x80000040) /!< TIM10 Alternate Function mapping (only for XL-density devices) /
#define GPIO_Remap_TIM11 ((uint32_t)0x80000080) /!< TIM11 Alternate Function mapping (only for XL-density devices) /
#define GPIO_Remap_TIM13 ((uint32_t)0x80000100) /!< TIM13 Alternate Function mapping (only for High density Value line and XL-density devices) /
#define GPIO_Remap_TIM14 ((uint32_t)0x80000200) /!< TIM14 Alternate Function mapping (only for High density Value line and XL-density devices) /
#define GPIO_Remap_FSMC_NADV ((uint32_t)0x80000400) /!< FSMC_NADV Alternate Function mapping (only for High density Value line and XL-density devices) */

#define GPIO_Remap_TIM67_DAC_DMA ((uint32_t)0x80000800) /*!< TIM6/TIM7 and DAC DMA requests remapping (only for High density Value line devices) /
#define GPIO_Remap_TIM12 ((uint32_t)0x80001000) /!< TIM12 Alternate Function mapping (only for High density Value line devices) /
#define GPIO_Remap_MISC ((uint32_t)0x80002000) /!< Miscellaneous Remap (DMA2 Channel5 Position and DAC Trigger remapping,
only for High density Value line devices) */

#define IS_GPIO_REMAP(REMAP) (((REMAP) == GPIO_Remap_SPI1) || ((REMAP) == GPIO_Remap_I2C1) ||
((REMAP) == GPIO_Remap_USART1) || ((REMAP) == GPIO_Remap_USART2) ||
((REMAP) == GPIO_PartialRemap_USART3) || ((REMAP) == GPIO_FullRemap_USART3) ||
((REMAP) == GPIO_PartialRemap_TIM1) || ((REMAP) == GPIO_FullRemap_TIM1) ||
((REMAP) == GPIO_PartialRemap1_TIM2) || ((REMAP) == GPIO_PartialRemap2_TIM2) ||
((REMAP) == GPIO_FullRemap_TIM2) || ((REMAP) == GPIO_PartialRemap_TIM3) ||
((REMAP) == GPIO_FullRemap_TIM3) || ((REMAP) == GPIO_Remap_TIM4) ||
((REMAP) == GPIO_Remap1_CAN1) || ((REMAP) == GPIO_Remap2_CAN1) ||
((REMAP) == GPIO_Remap_PD01) || ((REMAP) == GPIO_Remap_TIM5CH4_LSI) ||
((REMAP) == GPIO_Remap_ADC1_ETRGINJ) ||((REMAP) == GPIO_Remap_ADC1_ETRGREG) ||
((REMAP) == GPIO_Remap_ADC2_ETRGINJ) ||((REMAP) == GPIO_Remap_ADC2_ETRGREG) ||
((REMAP) == GPIO_Remap_ETH) ||((REMAP) == GPIO_Remap_CAN2) ||
((REMAP) == GPIO_Remap_SWJ_NoJTRST) || ((REMAP) == GPIO_Remap_SWJ_JTAGDisable) ||
((REMAP) == GPIO_Remap_SWJ_Disable)|| ((REMAP) == GPIO_Remap_SPI3) ||
((REMAP) == GPIO_Remap_TIM2ITR1_PTP_SOF) || ((REMAP) == GPIO_Remap_PTP_PPS) ||
((REMAP) == GPIO_Remap_TIM15) || ((REMAP) == GPIO_Remap_TIM16) ||
((REMAP) == GPIO_Remap_TIM17) || ((REMAP) == GPIO_Remap_CEC) ||
((REMAP) == GPIO_Remap_TIM1_DMA) || ((REMAP) == GPIO_Remap_TIM9) ||
((REMAP) == GPIO_Remap_TIM10) || ((REMAP) == GPIO_Remap_TIM11) ||
((REMAP) == GPIO_Remap_TIM13) || ((REMAP) == GPIO_Remap_TIM14) ||
((REMAP) == GPIO_Remap_FSMC_NADV) || ((REMAP) == GPIO_Remap_TIM67_DAC_DMA) ||
((REMAP) == GPIO_Remap_TIM12) || ((REMAP) == GPIO_Remap_MISC))

推荐阅读

史海拾趣

Blue Sky Research公司的发展小趣事

为了进一步提升竞争力,Blue Sky Research开始寻求产业链整合的机会。公司与上下游企业建立紧密的合作关系,共同推动激光技术产业的发展。通过整合产业链资源,Blue Sky Research实现了从原材料采购到产品销售的全流程控制,提高了生产效率和产品质量。同时,公司还积极参与行业标准的制定和推广,推动整个行业的健康发展。

ABLIC公司的发展小趣事

在“2018慕尼黑上海电子展”上,ABLIC展示了其即将推出的紫外传感器。这一产品的推出,彰显了ABLIC在传感器领域的创新能力。紫外传感器在环境监测、安全防护等领域具有广泛应用前景。ABLIC凭借其在半导体技术方面的深厚积累,成功研发出具有高性能和稳定性的紫外传感器,为市场带来了新的选择。

Habia Cable公司的发展小趣事

在“2018慕尼黑上海电子展”上,ABLIC展示了其即将推出的紫外传感器。这一产品的推出,彰显了ABLIC在传感器领域的创新能力。紫外传感器在环境监测、安全防护等领域具有广泛应用前景。ABLIC凭借其在半导体技术方面的深厚积累,成功研发出具有高性能和稳定性的紫外传感器,为市场带来了新的选择。

AURORA公司的发展小趣事

在自动驾驶技术快速发展的同时,AURORA公司也积极寻找商业化突破口。公司创始人认为,自动驾驶卡车商业化是一个具有巨大潜力的市场。因此,AURORA优先瞄准了自动驾驶卡车商业化领域,与FedEx、Paccar、Schneider、Werner和Xpress等多家平台公司建立了试点合作关系。通过在实际场景中测试和验证自动驾驶技术,AURORA不断积累经验和数据,为未来的商业化落地奠定了坚实基础。

这五个故事展示了AURORA公司在电子行业中的发展历程和取得的成就。从初创时期的挑战与机遇到技术实力的不断提升,再到与汽车制造商的深度合作、垂直产业链的整合与布局以及自动驾驶卡车商业化的探索,AURORA公司凭借其卓越的技术实力和前瞻性的战略眼光,在电子行业中逐渐崭露头角。未来,我们有理由相信AURORA将继续在自动驾驶领域取得更多突破和创新。

Federal Custom Cable公司的发展小趣事

在电缆产品性能和质量得到提升的同时,Federal Custom Cable也积极开拓新的市场领域。他们深入了解不同行业对电缆的需求特点,针对不同行业推出了一系列定制化的电缆产品。这些产品广泛应用于通信、医疗、航空等领域,并赢得了客户的一致好评。同时,Federal Custom Cable还加强了品牌建设和市场推广力度,提高了品牌知名度和美誉度。

amcc [applied micro circuits corp]公司的发展小趣事

Federal Custom Cable非常重视客户服务工作。他们建立了完善的客户服务体系,为客户提供从产品咨询、选型、定制到售后服务的全方位支持。同时,Federal Custom Cable还积极与合作伙伴建立长期稳定的合作关系,共同推动电缆行业的发展。这种以客户需求为导向、以合作伙伴关系为基础的经营模式,为Federal Custom Cable的持续发展提供了有力保障。

问答坊 | AI 解惑

诚意找人编写PADS /AD电路设计的图书

我们现有关于PADS /Altium Designer 电路设计的图书选题,诚找有写书意向的作者合作。要求作者有一些实战经验和写作资源,有一定的业余时间、能够保证写作进度。有意者请直接发信 联系方式:haohong99@163.com、478057587(QQ)。欢迎有实践开发 ...…

查看全部问答>

关于TPS54550电源芯片

我使用tps54550电源芯片产生 3.3V电压。芯片PH端输出的波形正确,可是经过滤波后,输出电压很低只有0.005V。我按照datasheet使用6.8uH和100uF电容做滤波。各位大侠帮帮忙吧...…

查看全部问答>

请问管理员,我怎么回复不了帖子?

我今天怎么回复不了我自己的帖子,我的问题解决了本来想说明下情况,是如何解决的,然后结贴,结果我一回复就说我\"回复太快!如果你是恶意刷楼,将会受到严厉惩罚!\"我没有刷楼啊,到了下午再试试还是不行,这个怎么回事,网站有问题了?也不知道我这个 ...…

查看全部问答>

单片机串口控制TFT(1.3-15寸TFT通用解决方案)

公司提供4.3-10.4寸系列真彩液晶终端,单片机,PLC,ARM串口直接控制,采用M600通用液晶显示驱动。       TFT驱动模组M600,这款模块的优势非常大,驱动模组提供的是RS232串口方式,通过协议来控制屏的显示,内置128M flash ...…

查看全部问答>

求教液晶屏色彩问题!

Wince启动后,色彩不对,偏色严重。但是在用Windows Media Player播放视频文件的时候,画面清晰的很。不过WMP的界面仍然偏色。请教各位可遇到这种情况,是哪方面原因造成的。…

查看全部问答>

阻容电源问题

做了一个阻容电源,发现在会有变压器的那种兹兹的声音,而且电源摸上去还有点热,高手分析下原因…

查看全部问答>

开关电源变压器选择需要计算出哪些参数

本帖最后由 dontium 于 2015-1-23 13:32 编辑 同事花了半个月,就做了一款开关电源,还说技术保密。说实话做开关电源有技术难度吗? …

查看全部问答>

关于使用M16内部8M晶振的问题

最近弄了一个串口通信,使用的是M16单片机,但是死活设置熔断丝,却只能使用M16内部的1M时钟,才能串口通信正常(波特率寄存器设置没错)。设置外部时钟和内部的2M,4M,8M,都不能使串口通信正常,不知道怎么回事。下面是我设置内部8M的熔断丝的图片 ...…

查看全部问答>

求VHDL解码的SPDIF或者是AES/EBU的音频信号源码

求VHDL解码的SPDIF或者是AES/EBU的音频信号源码…

查看全部问答>