/TARGET_K64F/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_KPSDK_CODE/hal/adc/fsl_adc_hal.h substitute line 894 extern } by }

Fork of mbed by mbed official

Committer:
bogdanm
Date:
Mon Dec 09 18:43:03 2013 +0200
Revision:
73:1efda918f0ba
Child:
76:824293ae5e43
Release 73 of the mbed library

Main changes:

- added support for KL46Z and NUCLEO_F103RB
- STM32 USB device support
- various bug fixes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 73:1efda918f0ba 1 /**
bogdanm 73:1efda918f0ba 2 ******************************************************************************
bogdanm 73:1efda918f0ba 3 * @file stm32f10x_gpio.h
bogdanm 73:1efda918f0ba 4 * @author MCD Application Team
bogdanm 73:1efda918f0ba 5 * @version V3.5.0
bogdanm 73:1efda918f0ba 6 * @date 11-March-2011
bogdanm 73:1efda918f0ba 7 * @brief This file contains all the functions prototypes for the GPIO
bogdanm 73:1efda918f0ba 8 * firmware library.
bogdanm 73:1efda918f0ba 9 ******************************************************************************
bogdanm 73:1efda918f0ba 10 * @attention
bogdanm 73:1efda918f0ba 11 *
bogdanm 73:1efda918f0ba 12 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
bogdanm 73:1efda918f0ba 13 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
bogdanm 73:1efda918f0ba 14 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
bogdanm 73:1efda918f0ba 15 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
bogdanm 73:1efda918f0ba 16 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
bogdanm 73:1efda918f0ba 17 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
bogdanm 73:1efda918f0ba 18 *
bogdanm 73:1efda918f0ba 19 * <h2><center>&copy; COPYRIGHT 2011 STMicroelectronics</center></h2>
bogdanm 73:1efda918f0ba 20 ******************************************************************************
bogdanm 73:1efda918f0ba 21 */
bogdanm 73:1efda918f0ba 22
bogdanm 73:1efda918f0ba 23 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 73:1efda918f0ba 24 #ifndef __STM32F10x_GPIO_H
bogdanm 73:1efda918f0ba 25 #define __STM32F10x_GPIO_H
bogdanm 73:1efda918f0ba 26
bogdanm 73:1efda918f0ba 27 #ifdef __cplusplus
bogdanm 73:1efda918f0ba 28 extern "C" {
bogdanm 73:1efda918f0ba 29 #endif
bogdanm 73:1efda918f0ba 30
bogdanm 73:1efda918f0ba 31 /* Includes ------------------------------------------------------------------*/
bogdanm 73:1efda918f0ba 32 #include "stm32f10x.h"
bogdanm 73:1efda918f0ba 33
bogdanm 73:1efda918f0ba 34 /** @addtogroup STM32F10x_StdPeriph_Driver
bogdanm 73:1efda918f0ba 35 * @{
bogdanm 73:1efda918f0ba 36 */
bogdanm 73:1efda918f0ba 37
bogdanm 73:1efda918f0ba 38 /** @addtogroup GPIO
bogdanm 73:1efda918f0ba 39 * @{
bogdanm 73:1efda918f0ba 40 */
bogdanm 73:1efda918f0ba 41
bogdanm 73:1efda918f0ba 42 /** @defgroup GPIO_Exported_Types
bogdanm 73:1efda918f0ba 43 * @{
bogdanm 73:1efda918f0ba 44 */
bogdanm 73:1efda918f0ba 45
bogdanm 73:1efda918f0ba 46 #define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
bogdanm 73:1efda918f0ba 47 ((PERIPH) == GPIOB) || \
bogdanm 73:1efda918f0ba 48 ((PERIPH) == GPIOC) || \
bogdanm 73:1efda918f0ba 49 ((PERIPH) == GPIOD) || \
bogdanm 73:1efda918f0ba 50 ((PERIPH) == GPIOE) || \
bogdanm 73:1efda918f0ba 51 ((PERIPH) == GPIOF) || \
bogdanm 73:1efda918f0ba 52 ((PERIPH) == GPIOG))
bogdanm 73:1efda918f0ba 53
bogdanm 73:1efda918f0ba 54 /**
bogdanm 73:1efda918f0ba 55 * @brief Output Maximum frequency selection
bogdanm 73:1efda918f0ba 56 */
bogdanm 73:1efda918f0ba 57
bogdanm 73:1efda918f0ba 58 typedef enum
bogdanm 73:1efda918f0ba 59 {
bogdanm 73:1efda918f0ba 60 GPIO_Speed_10MHz = 1,
bogdanm 73:1efda918f0ba 61 GPIO_Speed_2MHz,
bogdanm 73:1efda918f0ba 62 GPIO_Speed_50MHz
bogdanm 73:1efda918f0ba 63 }GPIOSpeed_TypeDef;
bogdanm 73:1efda918f0ba 64 #define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_Speed_10MHz) || ((SPEED) == GPIO_Speed_2MHz) || \
bogdanm 73:1efda918f0ba 65 ((SPEED) == GPIO_Speed_50MHz))
bogdanm 73:1efda918f0ba 66
bogdanm 73:1efda918f0ba 67 /**
bogdanm 73:1efda918f0ba 68 * @brief Configuration Mode enumeration
bogdanm 73:1efda918f0ba 69 */
bogdanm 73:1efda918f0ba 70
bogdanm 73:1efda918f0ba 71 typedef enum
bogdanm 73:1efda918f0ba 72 { GPIO_Mode_AIN = 0x0,
bogdanm 73:1efda918f0ba 73 GPIO_Mode_IN_FLOATING = 0x04,
bogdanm 73:1efda918f0ba 74 GPIO_Mode_IPD = 0x28,
bogdanm 73:1efda918f0ba 75 GPIO_Mode_IPU = 0x48,
bogdanm 73:1efda918f0ba 76 GPIO_Mode_Out_OD = 0x14,
bogdanm 73:1efda918f0ba 77 GPIO_Mode_Out_PP = 0x10,
bogdanm 73:1efda918f0ba 78 GPIO_Mode_AF_OD = 0x1C,
bogdanm 73:1efda918f0ba 79 GPIO_Mode_AF_PP = 0x18
bogdanm 73:1efda918f0ba 80 }GPIOMode_TypeDef;
bogdanm 73:1efda918f0ba 81
bogdanm 73:1efda918f0ba 82 #define IS_GPIO_MODE(MODE) (((MODE) == GPIO_Mode_AIN) || ((MODE) == GPIO_Mode_IN_FLOATING) || \
bogdanm 73:1efda918f0ba 83 ((MODE) == GPIO_Mode_IPD) || ((MODE) == GPIO_Mode_IPU) || \
bogdanm 73:1efda918f0ba 84 ((MODE) == GPIO_Mode_Out_OD) || ((MODE) == GPIO_Mode_Out_PP) || \
bogdanm 73:1efda918f0ba 85 ((MODE) == GPIO_Mode_AF_OD) || ((MODE) == GPIO_Mode_AF_PP))
bogdanm 73:1efda918f0ba 86
bogdanm 73:1efda918f0ba 87 /**
bogdanm 73:1efda918f0ba 88 * @brief GPIO Init structure definition
bogdanm 73:1efda918f0ba 89 */
bogdanm 73:1efda918f0ba 90
bogdanm 73:1efda918f0ba 91 typedef struct
bogdanm 73:1efda918f0ba 92 {
bogdanm 73:1efda918f0ba 93 uint16_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
bogdanm 73:1efda918f0ba 94 This parameter can be any value of @ref GPIO_pins_define */
bogdanm 73:1efda918f0ba 95
bogdanm 73:1efda918f0ba 96 GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
bogdanm 73:1efda918f0ba 97 This parameter can be a value of @ref GPIOSpeed_TypeDef */
bogdanm 73:1efda918f0ba 98
bogdanm 73:1efda918f0ba 99 GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
bogdanm 73:1efda918f0ba 100 This parameter can be a value of @ref GPIOMode_TypeDef */
bogdanm 73:1efda918f0ba 101 }GPIO_InitTypeDef;
bogdanm 73:1efda918f0ba 102
bogdanm 73:1efda918f0ba 103
bogdanm 73:1efda918f0ba 104 /**
bogdanm 73:1efda918f0ba 105 * @brief Bit_SET and Bit_RESET enumeration
bogdanm 73:1efda918f0ba 106 */
bogdanm 73:1efda918f0ba 107
bogdanm 73:1efda918f0ba 108 typedef enum
bogdanm 73:1efda918f0ba 109 { Bit_RESET = 0,
bogdanm 73:1efda918f0ba 110 Bit_SET
bogdanm 73:1efda918f0ba 111 }BitAction;
bogdanm 73:1efda918f0ba 112
bogdanm 73:1efda918f0ba 113 #define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))
bogdanm 73:1efda918f0ba 114
bogdanm 73:1efda918f0ba 115 /**
bogdanm 73:1efda918f0ba 116 * @}
bogdanm 73:1efda918f0ba 117 */
bogdanm 73:1efda918f0ba 118
bogdanm 73:1efda918f0ba 119 /** @defgroup GPIO_Exported_Constants
bogdanm 73:1efda918f0ba 120 * @{
bogdanm 73:1efda918f0ba 121 */
bogdanm 73:1efda918f0ba 122
bogdanm 73:1efda918f0ba 123 /** @defgroup GPIO_pins_define
bogdanm 73:1efda918f0ba 124 * @{
bogdanm 73:1efda918f0ba 125 */
bogdanm 73:1efda918f0ba 126
bogdanm 73:1efda918f0ba 127 #define GPIO_Pin_0 ((uint16_t)0x0001) /*!< Pin 0 selected */
bogdanm 73:1efda918f0ba 128 #define GPIO_Pin_1 ((uint16_t)0x0002) /*!< Pin 1 selected */
bogdanm 73:1efda918f0ba 129 #define GPIO_Pin_2 ((uint16_t)0x0004) /*!< Pin 2 selected */
bogdanm 73:1efda918f0ba 130 #define GPIO_Pin_3 ((uint16_t)0x0008) /*!< Pin 3 selected */
bogdanm 73:1efda918f0ba 131 #define GPIO_Pin_4 ((uint16_t)0x0010) /*!< Pin 4 selected */
bogdanm 73:1efda918f0ba 132 #define GPIO_Pin_5 ((uint16_t)0x0020) /*!< Pin 5 selected */
bogdanm 73:1efda918f0ba 133 #define GPIO_Pin_6 ((uint16_t)0x0040) /*!< Pin 6 selected */
bogdanm 73:1efda918f0ba 134 #define GPIO_Pin_7 ((uint16_t)0x0080) /*!< Pin 7 selected */
bogdanm 73:1efda918f0ba 135 #define GPIO_Pin_8 ((uint16_t)0x0100) /*!< Pin 8 selected */
bogdanm 73:1efda918f0ba 136 #define GPIO_Pin_9 ((uint16_t)0x0200) /*!< Pin 9 selected */
bogdanm 73:1efda918f0ba 137 #define GPIO_Pin_10 ((uint16_t)0x0400) /*!< Pin 10 selected */
bogdanm 73:1efda918f0ba 138 #define GPIO_Pin_11 ((uint16_t)0x0800) /*!< Pin 11 selected */
bogdanm 73:1efda918f0ba 139 #define GPIO_Pin_12 ((uint16_t)0x1000) /*!< Pin 12 selected */
bogdanm 73:1efda918f0ba 140 #define GPIO_Pin_13 ((uint16_t)0x2000) /*!< Pin 13 selected */
bogdanm 73:1efda918f0ba 141 #define GPIO_Pin_14 ((uint16_t)0x4000) /*!< Pin 14 selected */
bogdanm 73:1efda918f0ba 142 #define GPIO_Pin_15 ((uint16_t)0x8000) /*!< Pin 15 selected */
bogdanm 73:1efda918f0ba 143 #define GPIO_Pin_All ((uint16_t)0xFFFF) /*!< All pins selected */
bogdanm 73:1efda918f0ba 144
bogdanm 73:1efda918f0ba 145 #define IS_GPIO_PIN(PIN) ((((PIN) & (uint16_t)0x00) == 0x00) && ((PIN) != (uint16_t)0x00))
bogdanm 73:1efda918f0ba 146
bogdanm 73:1efda918f0ba 147 #define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \
bogdanm 73:1efda918f0ba 148 ((PIN) == GPIO_Pin_1) || \
bogdanm 73:1efda918f0ba 149 ((PIN) == GPIO_Pin_2) || \
bogdanm 73:1efda918f0ba 150 ((PIN) == GPIO_Pin_3) || \
bogdanm 73:1efda918f0ba 151 ((PIN) == GPIO_Pin_4) || \
bogdanm 73:1efda918f0ba 152 ((PIN) == GPIO_Pin_5) || \
bogdanm 73:1efda918f0ba 153 ((PIN) == GPIO_Pin_6) || \
bogdanm 73:1efda918f0ba 154 ((PIN) == GPIO_Pin_7) || \
bogdanm 73:1efda918f0ba 155 ((PIN) == GPIO_Pin_8) || \
bogdanm 73:1efda918f0ba 156 ((PIN) == GPIO_Pin_9) || \
bogdanm 73:1efda918f0ba 157 ((PIN) == GPIO_Pin_10) || \
bogdanm 73:1efda918f0ba 158 ((PIN) == GPIO_Pin_11) || \
bogdanm 73:1efda918f0ba 159 ((PIN) == GPIO_Pin_12) || \
bogdanm 73:1efda918f0ba 160 ((PIN) == GPIO_Pin_13) || \
bogdanm 73:1efda918f0ba 161 ((PIN) == GPIO_Pin_14) || \
bogdanm 73:1efda918f0ba 162 ((PIN) == GPIO_Pin_15))
bogdanm 73:1efda918f0ba 163
bogdanm 73:1efda918f0ba 164 /**
bogdanm 73:1efda918f0ba 165 * @}
bogdanm 73:1efda918f0ba 166 */
bogdanm 73:1efda918f0ba 167
bogdanm 73:1efda918f0ba 168 /** @defgroup GPIO_Remap_define
bogdanm 73:1efda918f0ba 169 * @{
bogdanm 73:1efda918f0ba 170 */
bogdanm 73:1efda918f0ba 171
bogdanm 73:1efda918f0ba 172 #define GPIO_Remap_SPI1 ((uint32_t)0x00000001) /*!< SPI1 Alternate Function mapping */
bogdanm 73:1efda918f0ba 173 #define GPIO_Remap_I2C1 ((uint32_t)0x00000002) /*!< I2C1 Alternate Function mapping */
bogdanm 73:1efda918f0ba 174 #define GPIO_Remap_USART1 ((uint32_t)0x00000004) /*!< USART1 Alternate Function mapping */
bogdanm 73:1efda918f0ba 175 #define GPIO_Remap_USART2 ((uint32_t)0x00000008) /*!< USART2 Alternate Function mapping */
bogdanm 73:1efda918f0ba 176 #define GPIO_PartialRemap_USART3 ((uint32_t)0x00140010) /*!< USART3 Partial Alternate Function mapping */
bogdanm 73:1efda918f0ba 177 #define GPIO_FullRemap_USART3 ((uint32_t)0x00140030) /*!< USART3 Full Alternate Function mapping */
bogdanm 73:1efda918f0ba 178 #define GPIO_PartialRemap_TIM1 ((uint32_t)0x00160040) /*!< TIM1 Partial Alternate Function mapping */
bogdanm 73:1efda918f0ba 179 #define GPIO_FullRemap_TIM1 ((uint32_t)0x001600C0) /*!< TIM1 Full Alternate Function mapping */
bogdanm 73:1efda918f0ba 180 #define GPIO_PartialRemap1_TIM2 ((uint32_t)0x00180100) /*!< TIM2 Partial1 Alternate Function mapping */
bogdanm 73:1efda918f0ba 181 #define GPIO_PartialRemap2_TIM2 ((uint32_t)0x00180200) /*!< TIM2 Partial2 Alternate Function mapping */
bogdanm 73:1efda918f0ba 182 #define GPIO_FullRemap_TIM2 ((uint32_t)0x00180300) /*!< TIM2 Full Alternate Function mapping */
bogdanm 73:1efda918f0ba 183 #define GPIO_PartialRemap_TIM3 ((uint32_t)0x001A0800) /*!< TIM3 Partial Alternate Function mapping */
bogdanm 73:1efda918f0ba 184 #define GPIO_FullRemap_TIM3 ((uint32_t)0x001A0C00) /*!< TIM3 Full Alternate Function mapping */
bogdanm 73:1efda918f0ba 185 #define GPIO_Remap_TIM4 ((uint32_t)0x00001000) /*!< TIM4 Alternate Function mapping */
bogdanm 73:1efda918f0ba 186 #define GPIO_Remap1_CAN1 ((uint32_t)0x001D4000) /*!< CAN1 Alternate Function mapping */
bogdanm 73:1efda918f0ba 187 #define GPIO_Remap2_CAN1 ((uint32_t)0x001D6000) /*!< CAN1 Alternate Function mapping */
bogdanm 73:1efda918f0ba 188 #define GPIO_Remap_PD01 ((uint32_t)0x00008000) /*!< PD01 Alternate Function mapping */
bogdanm 73:1efda918f0ba 189 #define GPIO_Remap_TIM5CH4_LSI ((uint32_t)0x00200001) /*!< LSI connected to TIM5 Channel4 input capture for calibration */
bogdanm 73:1efda918f0ba 190 #define GPIO_Remap_ADC1_ETRGINJ ((uint32_t)0x00200002) /*!< ADC1 External Trigger Injected Conversion remapping */
bogdanm 73:1efda918f0ba 191 #define GPIO_Remap_ADC1_ETRGREG ((uint32_t)0x00200004) /*!< ADC1 External Trigger Regular Conversion remapping */
bogdanm 73:1efda918f0ba 192 #define GPIO_Remap_ADC2_ETRGINJ ((uint32_t)0x00200008) /*!< ADC2 External Trigger Injected Conversion remapping */
bogdanm 73:1efda918f0ba 193 #define GPIO_Remap_ADC2_ETRGREG ((uint32_t)0x00200010) /*!< ADC2 External Trigger Regular Conversion remapping */
bogdanm 73:1efda918f0ba 194 #define GPIO_Remap_ETH ((uint32_t)0x00200020) /*!< Ethernet remapping (only for Connectivity line devices) */
bogdanm 73:1efda918f0ba 195 #define GPIO_Remap_CAN2 ((uint32_t)0x00200040) /*!< CAN2 remapping (only for Connectivity line devices) */
bogdanm 73:1efda918f0ba 196 #define GPIO_Remap_SWJ_NoJTRST ((uint32_t)0x00300100) /*!< Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */
bogdanm 73:1efda918f0ba 197 #define GPIO_Remap_SWJ_JTAGDisable ((uint32_t)0x00300200) /*!< JTAG-DP Disabled and SW-DP Enabled */
bogdanm 73:1efda918f0ba 198 #define GPIO_Remap_SWJ_Disable ((uint32_t)0x00300400) /*!< Full SWJ Disabled (JTAG-DP + SW-DP) */
bogdanm 73:1efda918f0ba 199 #define GPIO_Remap_SPI3 ((uint32_t)0x00201100) /*!< SPI3/I2S3 Alternate Function mapping (only for Connectivity line devices) */
bogdanm 73:1efda918f0ba 200 #define GPIO_Remap_TIM2ITR1_PTP_SOF ((uint32_t)0x00202000) /*!< Ethernet PTP output or USB OTG SOF (Start of Frame) connected
bogdanm 73:1efda918f0ba 201 to TIM2 Internal Trigger 1 for calibration
bogdanm 73:1efda918f0ba 202 (only for Connectivity line devices) */
bogdanm 73:1efda918f0ba 203 #define GPIO_Remap_PTP_PPS ((uint32_t)0x00204000) /*!< Ethernet MAC PPS_PTS output on PB05 (only for Connectivity line devices) */
bogdanm 73:1efda918f0ba 204
bogdanm 73:1efda918f0ba 205 #define GPIO_Remap_TIM15 ((uint32_t)0x80000001) /*!< TIM15 Alternate Function mapping (only for Value line devices) */
bogdanm 73:1efda918f0ba 206 #define GPIO_Remap_TIM16 ((uint32_t)0x80000002) /*!< TIM16 Alternate Function mapping (only for Value line devices) */
bogdanm 73:1efda918f0ba 207 #define GPIO_Remap_TIM17 ((uint32_t)0x80000004) /*!< TIM17 Alternate Function mapping (only for Value line devices) */
bogdanm 73:1efda918f0ba 208 #define GPIO_Remap_CEC ((uint32_t)0x80000008) /*!< CEC Alternate Function mapping (only for Value line devices) */
bogdanm 73:1efda918f0ba 209 #define GPIO_Remap_TIM1_DMA ((uint32_t)0x80000010) /*!< TIM1 DMA requests mapping (only for Value line devices) */
bogdanm 73:1efda918f0ba 210
bogdanm 73:1efda918f0ba 211 #define GPIO_Remap_TIM9 ((uint32_t)0x80000020) /*!< TIM9 Alternate Function mapping (only for XL-density devices) */
bogdanm 73:1efda918f0ba 212 #define GPIO_Remap_TIM10 ((uint32_t)0x80000040) /*!< TIM10 Alternate Function mapping (only for XL-density devices) */
bogdanm 73:1efda918f0ba 213 #define GPIO_Remap_TIM11 ((uint32_t)0x80000080) /*!< TIM11 Alternate Function mapping (only for XL-density devices) */
bogdanm 73:1efda918f0ba 214 #define GPIO_Remap_TIM13 ((uint32_t)0x80000100) /*!< TIM13 Alternate Function mapping (only for High density Value line and XL-density devices) */
bogdanm 73:1efda918f0ba 215 #define GPIO_Remap_TIM14 ((uint32_t)0x80000200) /*!< TIM14 Alternate Function mapping (only for High density Value line and XL-density devices) */
bogdanm 73:1efda918f0ba 216 #define GPIO_Remap_FSMC_NADV ((uint32_t)0x80000400) /*!< FSMC_NADV Alternate Function mapping (only for High density Value line and XL-density devices) */
bogdanm 73:1efda918f0ba 217
bogdanm 73:1efda918f0ba 218 #define GPIO_Remap_TIM67_DAC_DMA ((uint32_t)0x80000800) /*!< TIM6/TIM7 and DAC DMA requests remapping (only for High density Value line devices) */
bogdanm 73:1efda918f0ba 219 #define GPIO_Remap_TIM12 ((uint32_t)0x80001000) /*!< TIM12 Alternate Function mapping (only for High density Value line devices) */
bogdanm 73:1efda918f0ba 220 #define GPIO_Remap_MISC ((uint32_t)0x80002000) /*!< Miscellaneous Remap (DMA2 Channel5 Position and DAC Trigger remapping,
bogdanm 73:1efda918f0ba 221 only for High density Value line devices) */
bogdanm 73:1efda918f0ba 222
bogdanm 73:1efda918f0ba 223 #define IS_GPIO_REMAP(REMAP) (((REMAP) == GPIO_Remap_SPI1) || ((REMAP) == GPIO_Remap_I2C1) || \
bogdanm 73:1efda918f0ba 224 ((REMAP) == GPIO_Remap_USART1) || ((REMAP) == GPIO_Remap_USART2) || \
bogdanm 73:1efda918f0ba 225 ((REMAP) == GPIO_PartialRemap_USART3) || ((REMAP) == GPIO_FullRemap_USART3) || \
bogdanm 73:1efda918f0ba 226 ((REMAP) == GPIO_PartialRemap_TIM1) || ((REMAP) == GPIO_FullRemap_TIM1) || \
bogdanm 73:1efda918f0ba 227 ((REMAP) == GPIO_PartialRemap1_TIM2) || ((REMAP) == GPIO_PartialRemap2_TIM2) || \
bogdanm 73:1efda918f0ba 228 ((REMAP) == GPIO_FullRemap_TIM2) || ((REMAP) == GPIO_PartialRemap_TIM3) || \
bogdanm 73:1efda918f0ba 229 ((REMAP) == GPIO_FullRemap_TIM3) || ((REMAP) == GPIO_Remap_TIM4) || \
bogdanm 73:1efda918f0ba 230 ((REMAP) == GPIO_Remap1_CAN1) || ((REMAP) == GPIO_Remap2_CAN1) || \
bogdanm 73:1efda918f0ba 231 ((REMAP) == GPIO_Remap_PD01) || ((REMAP) == GPIO_Remap_TIM5CH4_LSI) || \
bogdanm 73:1efda918f0ba 232 ((REMAP) == GPIO_Remap_ADC1_ETRGINJ) ||((REMAP) == GPIO_Remap_ADC1_ETRGREG) || \
bogdanm 73:1efda918f0ba 233 ((REMAP) == GPIO_Remap_ADC2_ETRGINJ) ||((REMAP) == GPIO_Remap_ADC2_ETRGREG) || \
bogdanm 73:1efda918f0ba 234 ((REMAP) == GPIO_Remap_ETH) ||((REMAP) == GPIO_Remap_CAN2) || \
bogdanm 73:1efda918f0ba 235 ((REMAP) == GPIO_Remap_SWJ_NoJTRST) || ((REMAP) == GPIO_Remap_SWJ_JTAGDisable) || \
bogdanm 73:1efda918f0ba 236 ((REMAP) == GPIO_Remap_SWJ_Disable)|| ((REMAP) == GPIO_Remap_SPI3) || \
bogdanm 73:1efda918f0ba 237 ((REMAP) == GPIO_Remap_TIM2ITR1_PTP_SOF) || ((REMAP) == GPIO_Remap_PTP_PPS) || \
bogdanm 73:1efda918f0ba 238 ((REMAP) == GPIO_Remap_TIM15) || ((REMAP) == GPIO_Remap_TIM16) || \
bogdanm 73:1efda918f0ba 239 ((REMAP) == GPIO_Remap_TIM17) || ((REMAP) == GPIO_Remap_CEC) || \
bogdanm 73:1efda918f0ba 240 ((REMAP) == GPIO_Remap_TIM1_DMA) || ((REMAP) == GPIO_Remap_TIM9) || \
bogdanm 73:1efda918f0ba 241 ((REMAP) == GPIO_Remap_TIM10) || ((REMAP) == GPIO_Remap_TIM11) || \
bogdanm 73:1efda918f0ba 242 ((REMAP) == GPIO_Remap_TIM13) || ((REMAP) == GPIO_Remap_TIM14) || \
bogdanm 73:1efda918f0ba 243 ((REMAP) == GPIO_Remap_FSMC_NADV) || ((REMAP) == GPIO_Remap_TIM67_DAC_DMA) || \
bogdanm 73:1efda918f0ba 244 ((REMAP) == GPIO_Remap_TIM12) || ((REMAP) == GPIO_Remap_MISC))
bogdanm 73:1efda918f0ba 245
bogdanm 73:1efda918f0ba 246 /**
bogdanm 73:1efda918f0ba 247 * @}
bogdanm 73:1efda918f0ba 248 */
bogdanm 73:1efda918f0ba 249
bogdanm 73:1efda918f0ba 250 /** @defgroup GPIO_Port_Sources
bogdanm 73:1efda918f0ba 251 * @{
bogdanm 73:1efda918f0ba 252 */
bogdanm 73:1efda918f0ba 253
bogdanm 73:1efda918f0ba 254 #define GPIO_PortSourceGPIOA ((uint8_t)0x00)
bogdanm 73:1efda918f0ba 255 #define GPIO_PortSourceGPIOB ((uint8_t)0x01)
bogdanm 73:1efda918f0ba 256 #define GPIO_PortSourceGPIOC ((uint8_t)0x02)
bogdanm 73:1efda918f0ba 257 #define GPIO_PortSourceGPIOD ((uint8_t)0x03)
bogdanm 73:1efda918f0ba 258 #define GPIO_PortSourceGPIOE ((uint8_t)0x04)
bogdanm 73:1efda918f0ba 259 #define GPIO_PortSourceGPIOF ((uint8_t)0x05)
bogdanm 73:1efda918f0ba 260 #define GPIO_PortSourceGPIOG ((uint8_t)0x06)
bogdanm 73:1efda918f0ba 261 #define IS_GPIO_EVENTOUT_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == GPIO_PortSourceGPIOA) || \
bogdanm 73:1efda918f0ba 262 ((PORTSOURCE) == GPIO_PortSourceGPIOB) || \
bogdanm 73:1efda918f0ba 263 ((PORTSOURCE) == GPIO_PortSourceGPIOC) || \
bogdanm 73:1efda918f0ba 264 ((PORTSOURCE) == GPIO_PortSourceGPIOD) || \
bogdanm 73:1efda918f0ba 265 ((PORTSOURCE) == GPIO_PortSourceGPIOE))
bogdanm 73:1efda918f0ba 266
bogdanm 73:1efda918f0ba 267 #define IS_GPIO_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == GPIO_PortSourceGPIOA) || \
bogdanm 73:1efda918f0ba 268 ((PORTSOURCE) == GPIO_PortSourceGPIOB) || \
bogdanm 73:1efda918f0ba 269 ((PORTSOURCE) == GPIO_PortSourceGPIOC) || \
bogdanm 73:1efda918f0ba 270 ((PORTSOURCE) == GPIO_PortSourceGPIOD) || \
bogdanm 73:1efda918f0ba 271 ((PORTSOURCE) == GPIO_PortSourceGPIOE) || \
bogdanm 73:1efda918f0ba 272 ((PORTSOURCE) == GPIO_PortSourceGPIOF) || \
bogdanm 73:1efda918f0ba 273 ((PORTSOURCE) == GPIO_PortSourceGPIOG))
bogdanm 73:1efda918f0ba 274
bogdanm 73:1efda918f0ba 275 /**
bogdanm 73:1efda918f0ba 276 * @}
bogdanm 73:1efda918f0ba 277 */
bogdanm 73:1efda918f0ba 278
bogdanm 73:1efda918f0ba 279 /** @defgroup GPIO_Pin_sources
bogdanm 73:1efda918f0ba 280 * @{
bogdanm 73:1efda918f0ba 281 */
bogdanm 73:1efda918f0ba 282
bogdanm 73:1efda918f0ba 283 #define GPIO_PinSource0 ((uint8_t)0x00)
bogdanm 73:1efda918f0ba 284 #define GPIO_PinSource1 ((uint8_t)0x01)
bogdanm 73:1efda918f0ba 285 #define GPIO_PinSource2 ((uint8_t)0x02)
bogdanm 73:1efda918f0ba 286 #define GPIO_PinSource3 ((uint8_t)0x03)
bogdanm 73:1efda918f0ba 287 #define GPIO_PinSource4 ((uint8_t)0x04)
bogdanm 73:1efda918f0ba 288 #define GPIO_PinSource5 ((uint8_t)0x05)
bogdanm 73:1efda918f0ba 289 #define GPIO_PinSource6 ((uint8_t)0x06)
bogdanm 73:1efda918f0ba 290 #define GPIO_PinSource7 ((uint8_t)0x07)
bogdanm 73:1efda918f0ba 291 #define GPIO_PinSource8 ((uint8_t)0x08)
bogdanm 73:1efda918f0ba 292 #define GPIO_PinSource9 ((uint8_t)0x09)
bogdanm 73:1efda918f0ba 293 #define GPIO_PinSource10 ((uint8_t)0x0A)
bogdanm 73:1efda918f0ba 294 #define GPIO_PinSource11 ((uint8_t)0x0B)
bogdanm 73:1efda918f0ba 295 #define GPIO_PinSource12 ((uint8_t)0x0C)
bogdanm 73:1efda918f0ba 296 #define GPIO_PinSource13 ((uint8_t)0x0D)
bogdanm 73:1efda918f0ba 297 #define GPIO_PinSource14 ((uint8_t)0x0E)
bogdanm 73:1efda918f0ba 298 #define GPIO_PinSource15 ((uint8_t)0x0F)
bogdanm 73:1efda918f0ba 299
bogdanm 73:1efda918f0ba 300 #define IS_GPIO_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == GPIO_PinSource0) || \
bogdanm 73:1efda918f0ba 301 ((PINSOURCE) == GPIO_PinSource1) || \
bogdanm 73:1efda918f0ba 302 ((PINSOURCE) == GPIO_PinSource2) || \
bogdanm 73:1efda918f0ba 303 ((PINSOURCE) == GPIO_PinSource3) || \
bogdanm 73:1efda918f0ba 304 ((PINSOURCE) == GPIO_PinSource4) || \
bogdanm 73:1efda918f0ba 305 ((PINSOURCE) == GPIO_PinSource5) || \
bogdanm 73:1efda918f0ba 306 ((PINSOURCE) == GPIO_PinSource6) || \
bogdanm 73:1efda918f0ba 307 ((PINSOURCE) == GPIO_PinSource7) || \
bogdanm 73:1efda918f0ba 308 ((PINSOURCE) == GPIO_PinSource8) || \
bogdanm 73:1efda918f0ba 309 ((PINSOURCE) == GPIO_PinSource9) || \
bogdanm 73:1efda918f0ba 310 ((PINSOURCE) == GPIO_PinSource10) || \
bogdanm 73:1efda918f0ba 311 ((PINSOURCE) == GPIO_PinSource11) || \
bogdanm 73:1efda918f0ba 312 ((PINSOURCE) == GPIO_PinSource12) || \
bogdanm 73:1efda918f0ba 313 ((PINSOURCE) == GPIO_PinSource13) || \
bogdanm 73:1efda918f0ba 314 ((PINSOURCE) == GPIO_PinSource14) || \
bogdanm 73:1efda918f0ba 315 ((PINSOURCE) == GPIO_PinSource15))
bogdanm 73:1efda918f0ba 316
bogdanm 73:1efda918f0ba 317 /**
bogdanm 73:1efda918f0ba 318 * @}
bogdanm 73:1efda918f0ba 319 */
bogdanm 73:1efda918f0ba 320
bogdanm 73:1efda918f0ba 321 /** @defgroup Ethernet_Media_Interface
bogdanm 73:1efda918f0ba 322 * @{
bogdanm 73:1efda918f0ba 323 */
bogdanm 73:1efda918f0ba 324 #define GPIO_ETH_MediaInterface_MII ((u32)0x00000000)
bogdanm 73:1efda918f0ba 325 #define GPIO_ETH_MediaInterface_RMII ((u32)0x00000001)
bogdanm 73:1efda918f0ba 326
bogdanm 73:1efda918f0ba 327 #define IS_GPIO_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == GPIO_ETH_MediaInterface_MII) || \
bogdanm 73:1efda918f0ba 328 ((INTERFACE) == GPIO_ETH_MediaInterface_RMII))
bogdanm 73:1efda918f0ba 329
bogdanm 73:1efda918f0ba 330 /**
bogdanm 73:1efda918f0ba 331 * @}
bogdanm 73:1efda918f0ba 332 */
bogdanm 73:1efda918f0ba 333 /**
bogdanm 73:1efda918f0ba 334 * @}
bogdanm 73:1efda918f0ba 335 */
bogdanm 73:1efda918f0ba 336
bogdanm 73:1efda918f0ba 337 /** @defgroup GPIO_Exported_Macros
bogdanm 73:1efda918f0ba 338 * @{
bogdanm 73:1efda918f0ba 339 */
bogdanm 73:1efda918f0ba 340
bogdanm 73:1efda918f0ba 341 /**
bogdanm 73:1efda918f0ba 342 * @}
bogdanm 73:1efda918f0ba 343 */
bogdanm 73:1efda918f0ba 344
bogdanm 73:1efda918f0ba 345 /** @defgroup GPIO_Exported_Functions
bogdanm 73:1efda918f0ba 346 * @{
bogdanm 73:1efda918f0ba 347 */
bogdanm 73:1efda918f0ba 348
bogdanm 73:1efda918f0ba 349 void GPIO_DeInit(GPIO_TypeDef* GPIOx);
bogdanm 73:1efda918f0ba 350 void GPIO_AFIODeInit(void);
bogdanm 73:1efda918f0ba 351 void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
bogdanm 73:1efda918f0ba 352 void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
bogdanm 73:1efda918f0ba 353 uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 73:1efda918f0ba 354 uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);
bogdanm 73:1efda918f0ba 355 uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 73:1efda918f0ba 356 uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);
bogdanm 73:1efda918f0ba 357 void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 73:1efda918f0ba 358 void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 73:1efda918f0ba 359 void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);
bogdanm 73:1efda918f0ba 360 void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);
bogdanm 73:1efda918f0ba 361 void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 73:1efda918f0ba 362 void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
bogdanm 73:1efda918f0ba 363 void GPIO_EventOutputCmd(FunctionalState NewState);
bogdanm 73:1efda918f0ba 364 void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState);
bogdanm 73:1efda918f0ba 365 void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
bogdanm 73:1efda918f0ba 366 void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface);
bogdanm 73:1efda918f0ba 367
bogdanm 73:1efda918f0ba 368 #ifdef __cplusplus
bogdanm 73:1efda918f0ba 369 }
bogdanm 73:1efda918f0ba 370 #endif
bogdanm 73:1efda918f0ba 371
bogdanm 73:1efda918f0ba 372 #endif /* __STM32F10x_GPIO_H */
bogdanm 73:1efda918f0ba 373 /**
bogdanm 73:1efda918f0ba 374 * @}
bogdanm 73:1efda918f0ba 375 */
bogdanm 73:1efda918f0ba 376
bogdanm 73:1efda918f0ba 377 /**
bogdanm 73:1efda918f0ba 378 * @}
bogdanm 73:1efda918f0ba 379 */
bogdanm 73:1efda918f0ba 380
bogdanm 73:1efda918f0ba 381 /**
bogdanm 73:1efda918f0ba 382 * @}
bogdanm 73:1efda918f0ba 383 */
bogdanm 73:1efda918f0ba 384
bogdanm 73:1efda918f0ba 385 /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/