version_2.0

Dependents:   cc3000_ping_demo_try_2

Fork of mbed by mbed official

Committer:
erezi
Date:
Wed Jun 25 06:08:49 2014 +0000
Revision:
86:4f9a848d74c7
Parent:
82:6473597d706e
version_2.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 82:6473597d706e 1 /**
bogdanm 82:6473597d706e 2 ******************************************************************************
bogdanm 82:6473597d706e 3 * @file stm32f30x_gpio.h
bogdanm 82:6473597d706e 4 * @author MCD Application Team
bogdanm 82:6473597d706e 5 * @version V1.1.0
bogdanm 82:6473597d706e 6 * @date 27-February-2014
bogdanm 82:6473597d706e 7 * @brief This file contains all the functions prototypes for the GPIO
bogdanm 82:6473597d706e 8 * firmware library.
bogdanm 82:6473597d706e 9 ******************************************************************************
bogdanm 82:6473597d706e 10 * @attention
bogdanm 82:6473597d706e 11 *
bogdanm 82:6473597d706e 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
bogdanm 82:6473597d706e 13 *
bogdanm 82:6473597d706e 14 * Redistribution and use in source and binary forms, with or without modification,
bogdanm 82:6473597d706e 15 * are permitted provided that the following conditions are met:
bogdanm 82:6473597d706e 16 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 82:6473597d706e 17 * this list of conditions and the following disclaimer.
bogdanm 82:6473597d706e 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 82:6473597d706e 19 * this list of conditions and the following disclaimer in the documentation
bogdanm 82:6473597d706e 20 * and/or other materials provided with the distribution.
bogdanm 82:6473597d706e 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 82:6473597d706e 22 * may be used to endorse or promote products derived from this software
bogdanm 82:6473597d706e 23 * without specific prior written permission.
bogdanm 82:6473597d706e 24 *
bogdanm 82:6473597d706e 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 82:6473597d706e 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 82:6473597d706e 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 82:6473597d706e 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 82:6473597d706e 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 82:6473597d706e 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 82:6473597d706e 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 82:6473597d706e 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 82:6473597d706e 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 82:6473597d706e 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 82:6473597d706e 35 *
bogdanm 82:6473597d706e 36 ******************************************************************************
bogdanm 82:6473597d706e 37 */
bogdanm 82:6473597d706e 38
bogdanm 82:6473597d706e 39 /* Define to prevent recursive inclusion -------------------------------------*/
bogdanm 82:6473597d706e 40 #ifndef __STM32F30x_GPIO_H
bogdanm 82:6473597d706e 41 #define __STM32F30x_GPIO_H
bogdanm 82:6473597d706e 42
bogdanm 82:6473597d706e 43 #ifdef __cplusplus
bogdanm 82:6473597d706e 44 extern "C" {
bogdanm 82:6473597d706e 45 #endif
bogdanm 82:6473597d706e 46
bogdanm 82:6473597d706e 47 /* Includes ------------------------------------------------------------------*/
bogdanm 82:6473597d706e 48 #include "stm32f30x.h"
bogdanm 82:6473597d706e 49
bogdanm 82:6473597d706e 50 /** @addtogroup STM32F30x_StdPeriph_Driver
bogdanm 82:6473597d706e 51 * @{
bogdanm 82:6473597d706e 52 */
bogdanm 82:6473597d706e 53
bogdanm 82:6473597d706e 54 /** @addtogroup GPIO
bogdanm 82:6473597d706e 55 * @{
bogdanm 82:6473597d706e 56 */
bogdanm 82:6473597d706e 57
bogdanm 82:6473597d706e 58 /* Exported types ------------------------------------------------------------*/
bogdanm 82:6473597d706e 59
bogdanm 82:6473597d706e 60 #define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
bogdanm 82:6473597d706e 61 ((PERIPH) == GPIOB) || \
bogdanm 82:6473597d706e 62 ((PERIPH) == GPIOC) || \
bogdanm 82:6473597d706e 63 ((PERIPH) == GPIOD) || \
bogdanm 82:6473597d706e 64 ((PERIPH) == GPIOE) || \
bogdanm 82:6473597d706e 65 ((PERIPH) == GPIOF))
bogdanm 82:6473597d706e 66
bogdanm 82:6473597d706e 67 #define IS_GPIO_LIST_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
bogdanm 82:6473597d706e 68 ((PERIPH) == GPIOB) || \
bogdanm 82:6473597d706e 69 ((PERIPH) == GPIOD))
bogdanm 82:6473597d706e 70 /** @defgroup Configuration_Mode_enumeration
bogdanm 82:6473597d706e 71 * @{
bogdanm 82:6473597d706e 72 */
bogdanm 82:6473597d706e 73 typedef enum
bogdanm 82:6473597d706e 74 {
bogdanm 82:6473597d706e 75 GPIO_Mode_IN = 0x00, /*!< GPIO Input Mode */
bogdanm 82:6473597d706e 76 GPIO_Mode_OUT = 0x01, /*!< GPIO Output Mode */
bogdanm 82:6473597d706e 77 GPIO_Mode_AF = 0x02, /*!< GPIO Alternate function Mode */
bogdanm 82:6473597d706e 78 GPIO_Mode_AN = 0x03 /*!< GPIO Analog In/Out Mode */
bogdanm 82:6473597d706e 79 }GPIOMode_TypeDef;
bogdanm 82:6473597d706e 80
bogdanm 82:6473597d706e 81 #define IS_GPIO_MODE(MODE) (((MODE) == GPIO_Mode_IN)|| ((MODE) == GPIO_Mode_OUT) || \
bogdanm 82:6473597d706e 82 ((MODE) == GPIO_Mode_AF)|| ((MODE) == GPIO_Mode_AN))
bogdanm 82:6473597d706e 83 /**
bogdanm 82:6473597d706e 84 * @}
bogdanm 82:6473597d706e 85 */
bogdanm 82:6473597d706e 86
bogdanm 82:6473597d706e 87 /** @defgroup Output_type_enumeration
bogdanm 82:6473597d706e 88 * @{
bogdanm 82:6473597d706e 89 */
bogdanm 82:6473597d706e 90 typedef enum
bogdanm 82:6473597d706e 91 {
bogdanm 82:6473597d706e 92 GPIO_OType_PP = 0x00,
bogdanm 82:6473597d706e 93 GPIO_OType_OD = 0x01
bogdanm 82:6473597d706e 94 }GPIOOType_TypeDef;
bogdanm 82:6473597d706e 95
bogdanm 82:6473597d706e 96 #define IS_GPIO_OTYPE(OTYPE) (((OTYPE) == GPIO_OType_PP) || ((OTYPE) == GPIO_OType_OD))
bogdanm 82:6473597d706e 97
bogdanm 82:6473597d706e 98 /**
bogdanm 82:6473597d706e 99 * @}
bogdanm 82:6473597d706e 100 */
bogdanm 82:6473597d706e 101
bogdanm 82:6473597d706e 102 /** @defgroup Output_Maximum_frequency_enumeration
bogdanm 82:6473597d706e 103 * @{
bogdanm 82:6473597d706e 104 */
bogdanm 82:6473597d706e 105 typedef enum
bogdanm 82:6473597d706e 106 {
bogdanm 82:6473597d706e 107 GPIO_Speed_Level_1 = 0x01, /*!< Fast Speed */
bogdanm 82:6473597d706e 108 GPIO_Speed_Level_2 = 0x02, /*!< Meduim Speed */
bogdanm 82:6473597d706e 109 GPIO_Speed_Level_3 = 0x03 /*!< High Speed */
bogdanm 82:6473597d706e 110 }GPIOSpeed_TypeDef;
bogdanm 82:6473597d706e 111
bogdanm 82:6473597d706e 112 #define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_Speed_Level_1) || ((SPEED) == GPIO_Speed_Level_2) || \
bogdanm 82:6473597d706e 113 ((SPEED) == GPIO_Speed_Level_3))
bogdanm 82:6473597d706e 114 /**
bogdanm 82:6473597d706e 115 * @}
bogdanm 82:6473597d706e 116 */
bogdanm 82:6473597d706e 117
bogdanm 82:6473597d706e 118 /** @defgroup Configuration_Pull-Up_Pull-Down_enumeration
bogdanm 82:6473597d706e 119 * @{
bogdanm 82:6473597d706e 120 */
bogdanm 82:6473597d706e 121 typedef enum
bogdanm 82:6473597d706e 122 {
bogdanm 82:6473597d706e 123 GPIO_PuPd_NOPULL = 0x00,
bogdanm 82:6473597d706e 124 GPIO_PuPd_UP = 0x01,
bogdanm 82:6473597d706e 125 GPIO_PuPd_DOWN = 0x02
bogdanm 82:6473597d706e 126 }GPIOPuPd_TypeDef;
bogdanm 82:6473597d706e 127
bogdanm 82:6473597d706e 128 #define IS_GPIO_PUPD(PUPD) (((PUPD) == GPIO_PuPd_NOPULL) || ((PUPD) == GPIO_PuPd_UP) || \
bogdanm 82:6473597d706e 129 ((PUPD) == GPIO_PuPd_DOWN))
bogdanm 82:6473597d706e 130 /**
bogdanm 82:6473597d706e 131 * @}
bogdanm 82:6473597d706e 132 */
bogdanm 82:6473597d706e 133
bogdanm 82:6473597d706e 134 /** @defgroup Bit_SET_and_Bit_RESET_enumeration
bogdanm 82:6473597d706e 135 * @{
bogdanm 82:6473597d706e 136 */
bogdanm 82:6473597d706e 137 typedef enum
bogdanm 82:6473597d706e 138 {
bogdanm 82:6473597d706e 139 Bit_RESET = 0,
bogdanm 82:6473597d706e 140 Bit_SET
bogdanm 82:6473597d706e 141 }BitAction;
bogdanm 82:6473597d706e 142
bogdanm 82:6473597d706e 143 #define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))
bogdanm 82:6473597d706e 144 /**
bogdanm 82:6473597d706e 145 * @}
bogdanm 82:6473597d706e 146 */
bogdanm 82:6473597d706e 147
bogdanm 82:6473597d706e 148 /**
bogdanm 82:6473597d706e 149 * @brief GPIO Init structure definition
bogdanm 82:6473597d706e 150 */
bogdanm 82:6473597d706e 151 typedef struct
bogdanm 82:6473597d706e 152 {
bogdanm 82:6473597d706e 153 uint32_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
bogdanm 82:6473597d706e 154 This parameter can be any value of @ref GPIO_pins_define */
bogdanm 82:6473597d706e 155
bogdanm 82:6473597d706e 156 GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
bogdanm 82:6473597d706e 157 This parameter can be a value of @ref GPIOMode_TypeDef */
bogdanm 82:6473597d706e 158
bogdanm 82:6473597d706e 159 GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
bogdanm 82:6473597d706e 160 This parameter can be a value of @ref GPIOSpeed_TypeDef */
bogdanm 82:6473597d706e 161
bogdanm 82:6473597d706e 162 GPIOOType_TypeDef GPIO_OType; /*!< Specifies the operating output type for the selected pins.
bogdanm 82:6473597d706e 163 This parameter can be a value of @ref GPIOOType_TypeDef */
bogdanm 82:6473597d706e 164
bogdanm 82:6473597d706e 165 GPIOPuPd_TypeDef GPIO_PuPd; /*!< Specifies the operating Pull-up/Pull down for the selected pins.
bogdanm 82:6473597d706e 166 This parameter can be a value of @ref GPIOPuPd_TypeDef */
bogdanm 82:6473597d706e 167 }GPIO_InitTypeDef;
bogdanm 82:6473597d706e 168
bogdanm 82:6473597d706e 169 /* Exported constants --------------------------------------------------------*/
bogdanm 82:6473597d706e 170
bogdanm 82:6473597d706e 171 /** @defgroup GPIO_Exported_Constants
bogdanm 82:6473597d706e 172 * @{
bogdanm 82:6473597d706e 173 */
bogdanm 82:6473597d706e 174
bogdanm 82:6473597d706e 175 /** @defgroup GPIO_pins_define
bogdanm 82:6473597d706e 176 * @{
bogdanm 82:6473597d706e 177 */
bogdanm 82:6473597d706e 178 #define GPIO_Pin_0 ((uint16_t)0x0001) /*!< Pin 0 selected */
bogdanm 82:6473597d706e 179 #define GPIO_Pin_1 ((uint16_t)0x0002) /*!< Pin 1 selected */
bogdanm 82:6473597d706e 180 #define GPIO_Pin_2 ((uint16_t)0x0004) /*!< Pin 2 selected */
bogdanm 82:6473597d706e 181 #define GPIO_Pin_3 ((uint16_t)0x0008) /*!< Pin 3 selected */
bogdanm 82:6473597d706e 182 #define GPIO_Pin_4 ((uint16_t)0x0010) /*!< Pin 4 selected */
bogdanm 82:6473597d706e 183 #define GPIO_Pin_5 ((uint16_t)0x0020) /*!< Pin 5 selected */
bogdanm 82:6473597d706e 184 #define GPIO_Pin_6 ((uint16_t)0x0040) /*!< Pin 6 selected */
bogdanm 82:6473597d706e 185 #define GPIO_Pin_7 ((uint16_t)0x0080) /*!< Pin 7 selected */
bogdanm 82:6473597d706e 186 #define GPIO_Pin_8 ((uint16_t)0x0100) /*!< Pin 8 selected */
bogdanm 82:6473597d706e 187 #define GPIO_Pin_9 ((uint16_t)0x0200) /*!< Pin 9 selected */
bogdanm 82:6473597d706e 188 #define GPIO_Pin_10 ((uint16_t)0x0400) /*!< Pin 10 selected */
bogdanm 82:6473597d706e 189 #define GPIO_Pin_11 ((uint16_t)0x0800) /*!< Pin 11 selected */
bogdanm 82:6473597d706e 190 #define GPIO_Pin_12 ((uint16_t)0x1000) /*!< Pin 12 selected */
bogdanm 82:6473597d706e 191 #define GPIO_Pin_13 ((uint16_t)0x2000) /*!< Pin 13 selected */
bogdanm 82:6473597d706e 192 #define GPIO_Pin_14 ((uint16_t)0x4000) /*!< Pin 14 selected */
bogdanm 82:6473597d706e 193 #define GPIO_Pin_15 ((uint16_t)0x8000) /*!< Pin 15 selected */
bogdanm 82:6473597d706e 194 #define GPIO_Pin_All ((uint16_t)0xFFFF) /*!< All pins selected */
bogdanm 82:6473597d706e 195
bogdanm 82:6473597d706e 196 #define IS_GPIO_PIN(PIN) ((PIN) != (uint16_t)0x00)
bogdanm 82:6473597d706e 197
bogdanm 82:6473597d706e 198 #define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \
bogdanm 82:6473597d706e 199 ((PIN) == GPIO_Pin_1) || \
bogdanm 82:6473597d706e 200 ((PIN) == GPIO_Pin_2) || \
bogdanm 82:6473597d706e 201 ((PIN) == GPIO_Pin_3) || \
bogdanm 82:6473597d706e 202 ((PIN) == GPIO_Pin_4) || \
bogdanm 82:6473597d706e 203 ((PIN) == GPIO_Pin_5) || \
bogdanm 82:6473597d706e 204 ((PIN) == GPIO_Pin_6) || \
bogdanm 82:6473597d706e 205 ((PIN) == GPIO_Pin_7) || \
bogdanm 82:6473597d706e 206 ((PIN) == GPIO_Pin_8) || \
bogdanm 82:6473597d706e 207 ((PIN) == GPIO_Pin_9) || \
bogdanm 82:6473597d706e 208 ((PIN) == GPIO_Pin_10) || \
bogdanm 82:6473597d706e 209 ((PIN) == GPIO_Pin_11) || \
bogdanm 82:6473597d706e 210 ((PIN) == GPIO_Pin_12) || \
bogdanm 82:6473597d706e 211 ((PIN) == GPIO_Pin_13) || \
bogdanm 82:6473597d706e 212 ((PIN) == GPIO_Pin_14) || \
bogdanm 82:6473597d706e 213 ((PIN) == GPIO_Pin_15))
bogdanm 82:6473597d706e 214
bogdanm 82:6473597d706e 215 /**
bogdanm 82:6473597d706e 216 * @}
bogdanm 82:6473597d706e 217 */
bogdanm 82:6473597d706e 218
bogdanm 82:6473597d706e 219 /** @defgroup GPIO_Pin_sources
bogdanm 82:6473597d706e 220 * @{
bogdanm 82:6473597d706e 221 */
bogdanm 82:6473597d706e 222 #define GPIO_PinSource0 ((uint8_t)0x00)
bogdanm 82:6473597d706e 223 #define GPIO_PinSource1 ((uint8_t)0x01)
bogdanm 82:6473597d706e 224 #define GPIO_PinSource2 ((uint8_t)0x02)
bogdanm 82:6473597d706e 225 #define GPIO_PinSource3 ((uint8_t)0x03)
bogdanm 82:6473597d706e 226 #define GPIO_PinSource4 ((uint8_t)0x04)
bogdanm 82:6473597d706e 227 #define GPIO_PinSource5 ((uint8_t)0x05)
bogdanm 82:6473597d706e 228 #define GPIO_PinSource6 ((uint8_t)0x06)
bogdanm 82:6473597d706e 229 #define GPIO_PinSource7 ((uint8_t)0x07)
bogdanm 82:6473597d706e 230 #define GPIO_PinSource8 ((uint8_t)0x08)
bogdanm 82:6473597d706e 231 #define GPIO_PinSource9 ((uint8_t)0x09)
bogdanm 82:6473597d706e 232 #define GPIO_PinSource10 ((uint8_t)0x0A)
bogdanm 82:6473597d706e 233 #define GPIO_PinSource11 ((uint8_t)0x0B)
bogdanm 82:6473597d706e 234 #define GPIO_PinSource12 ((uint8_t)0x0C)
bogdanm 82:6473597d706e 235 #define GPIO_PinSource13 ((uint8_t)0x0D)
bogdanm 82:6473597d706e 236 #define GPIO_PinSource14 ((uint8_t)0x0E)
bogdanm 82:6473597d706e 237 #define GPIO_PinSource15 ((uint8_t)0x0F)
bogdanm 82:6473597d706e 238
bogdanm 82:6473597d706e 239 #define IS_GPIO_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == GPIO_PinSource0) || \
bogdanm 82:6473597d706e 240 ((PINSOURCE) == GPIO_PinSource1) || \
bogdanm 82:6473597d706e 241 ((PINSOURCE) == GPIO_PinSource2) || \
bogdanm 82:6473597d706e 242 ((PINSOURCE) == GPIO_PinSource3) || \
bogdanm 82:6473597d706e 243 ((PINSOURCE) == GPIO_PinSource4) || \
bogdanm 82:6473597d706e 244 ((PINSOURCE) == GPIO_PinSource5) || \
bogdanm 82:6473597d706e 245 ((PINSOURCE) == GPIO_PinSource6) || \
bogdanm 82:6473597d706e 246 ((PINSOURCE) == GPIO_PinSource7) || \
bogdanm 82:6473597d706e 247 ((PINSOURCE) == GPIO_PinSource8) || \
bogdanm 82:6473597d706e 248 ((PINSOURCE) == GPIO_PinSource9) || \
bogdanm 82:6473597d706e 249 ((PINSOURCE) == GPIO_PinSource10) || \
bogdanm 82:6473597d706e 250 ((PINSOURCE) == GPIO_PinSource11) || \
bogdanm 82:6473597d706e 251 ((PINSOURCE) == GPIO_PinSource12) || \
bogdanm 82:6473597d706e 252 ((PINSOURCE) == GPIO_PinSource13) || \
bogdanm 82:6473597d706e 253 ((PINSOURCE) == GPIO_PinSource14) || \
bogdanm 82:6473597d706e 254 ((PINSOURCE) == GPIO_PinSource15))
bogdanm 82:6473597d706e 255 /**
bogdanm 82:6473597d706e 256 * @}
bogdanm 82:6473597d706e 257 */
bogdanm 82:6473597d706e 258
bogdanm 82:6473597d706e 259 /** @defgroup GPIO_Alternate_function_selection_define
bogdanm 82:6473597d706e 260 * @{
bogdanm 82:6473597d706e 261 */
bogdanm 82:6473597d706e 262
bogdanm 82:6473597d706e 263 /**
bogdanm 82:6473597d706e 264 * @brief AF 0 selection
bogdanm 82:6473597d706e 265 */
bogdanm 82:6473597d706e 266 #define GPIO_AF_0 ((uint8_t)0x00) /* JTCK-SWCLK, JTDI, JTDO/TRACESW0, JTMS-SWDAT,
bogdanm 82:6473597d706e 267 MCO, NJTRST, TRACED, TRACECK */
bogdanm 82:6473597d706e 268 /**
bogdanm 82:6473597d706e 269 * @brief AF 1 selection
bogdanm 82:6473597d706e 270 */
bogdanm 82:6473597d706e 271 #define GPIO_AF_1 ((uint8_t)0x01) /* OUT, TIM2, TIM15, TIM16, TIM17 */
bogdanm 82:6473597d706e 272
bogdanm 82:6473597d706e 273 /**
bogdanm 82:6473597d706e 274 * @brief AF 2 selection
bogdanm 82:6473597d706e 275 */
bogdanm 82:6473597d706e 276 #define GPIO_AF_2 ((uint8_t)0x02) /* COMP1_OUT, TIM1, TIM2, TIM3, TIM4, TIM8, TIM15, TIM16 */
bogdanm 82:6473597d706e 277
bogdanm 82:6473597d706e 278 /**
bogdanm 82:6473597d706e 279 * @brief AF 3 selection
bogdanm 82:6473597d706e 280 */
bogdanm 82:6473597d706e 281 #define GPIO_AF_3 ((uint8_t)0x03) /* COMP7_OUT, TIM8, TIM15, Touch, HRTIM1 */
bogdanm 82:6473597d706e 282
bogdanm 82:6473597d706e 283 /**
bogdanm 82:6473597d706e 284 * @brief AF 4 selection
bogdanm 82:6473597d706e 285 */
bogdanm 82:6473597d706e 286 #define GPIO_AF_4 ((uint8_t)0x04) /* I2C1, I2C2, TIM1, TIM8, TIM16, TIM17 */
bogdanm 82:6473597d706e 287
bogdanm 82:6473597d706e 288 /**
bogdanm 82:6473597d706e 289 * @brief AF 5 selection
bogdanm 82:6473597d706e 290 */
bogdanm 82:6473597d706e 291 #define GPIO_AF_5 ((uint8_t)0x05) /* IR_OUT, I2S2, I2S3, SPI1, SPI2, TIM8, USART4, USART5 */
bogdanm 82:6473597d706e 292
bogdanm 82:6473597d706e 293 /**
bogdanm 82:6473597d706e 294 * @brief AF 6 selection
bogdanm 82:6473597d706e 295 */
bogdanm 82:6473597d706e 296 #define GPIO_AF_6 ((uint8_t)0x06) /* IR_OUT, I2S2, I2S3, SPI2, SPI3, TIM1, TIM8 */
bogdanm 82:6473597d706e 297
bogdanm 82:6473597d706e 298 /**
bogdanm 82:6473597d706e 299 * @brief AF 7 selection
bogdanm 82:6473597d706e 300 */
bogdanm 82:6473597d706e 301 #define GPIO_AF_7 ((uint8_t)0x07) /* AOP2_OUT, CAN, COMP3_OUT, COMP5_OUT, COMP6_OUT,
bogdanm 82:6473597d706e 302 USART1, USART2, USART3 */
bogdanm 82:6473597d706e 303
bogdanm 82:6473597d706e 304 /**
bogdanm 82:6473597d706e 305 * @brief AF 8 selection
bogdanm 82:6473597d706e 306 */
bogdanm 82:6473597d706e 307 #define GPIO_AF_8 ((uint8_t)0x08) /* COMP1_OUT, COMP2_OUT, COMP3_OUT, COMP4_OUT,
bogdanm 82:6473597d706e 308 COMP5_OUT, COMP6_OUT */
bogdanm 82:6473597d706e 309
bogdanm 82:6473597d706e 310 /**
bogdanm 82:6473597d706e 311 * @brief AF 9 selection
bogdanm 82:6473597d706e 312 */
bogdanm 82:6473597d706e 313 #define GPIO_AF_9 ((uint8_t)0x09) /* AOP4_OUT, CAN, TIM1, TIM8, TIM15 */
bogdanm 82:6473597d706e 314
bogdanm 82:6473597d706e 315 /**
bogdanm 82:6473597d706e 316 * @brief AF 10 selection
bogdanm 82:6473597d706e 317 */
bogdanm 82:6473597d706e 318 #define GPIO_AF_10 ((uint8_t)0x0A) /* AOP1_OUT, AOP3_OUT, TIM2, TIM3, TIM4, TIM8, TIM17 */
bogdanm 82:6473597d706e 319
bogdanm 82:6473597d706e 320 /**
bogdanm 82:6473597d706e 321 * @brief AF 11 selection
bogdanm 82:6473597d706e 322 */
bogdanm 82:6473597d706e 323 #define GPIO_AF_11 ((uint8_t)0x0B) /* TIM1, TIM8 */
bogdanm 82:6473597d706e 324
bogdanm 82:6473597d706e 325 /**
bogdanm 82:6473597d706e 326 * @brief AF 12 selection
bogdanm 82:6473597d706e 327 */
bogdanm 82:6473597d706e 328 #define GPIO_AF_12 ((uint8_t)0x0C) /* TIM1, HRTIM1 */
bogdanm 82:6473597d706e 329
bogdanm 82:6473597d706e 330 /**
bogdanm 82:6473597d706e 331 * @brief AF 13 selection
bogdanm 82:6473597d706e 332 */
bogdanm 82:6473597d706e 333 #define GPIO_AF_13 ((uint8_t)0x0D) /* HRTIM1, AOP2_OUT */
bogdanm 82:6473597d706e 334
bogdanm 82:6473597d706e 335 /**
bogdanm 82:6473597d706e 336 * @brief AF 14 selection
bogdanm 82:6473597d706e 337 */
bogdanm 82:6473597d706e 338 #define GPIO_AF_14 ((uint8_t)0x0E) /* USBDM, USBDP */
bogdanm 82:6473597d706e 339
bogdanm 82:6473597d706e 340 /**
bogdanm 82:6473597d706e 341 * @brief AF 15 selection
bogdanm 82:6473597d706e 342 */
bogdanm 82:6473597d706e 343 #define GPIO_AF_15 ((uint8_t)0x0F) /* OUT */
bogdanm 82:6473597d706e 344
bogdanm 82:6473597d706e 345 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF_0)||((AF) == GPIO_AF_1)||\
bogdanm 82:6473597d706e 346 ((AF) == GPIO_AF_2)||((AF) == GPIO_AF_3)||\
bogdanm 82:6473597d706e 347 ((AF) == GPIO_AF_4)||((AF) == GPIO_AF_5)||\
bogdanm 82:6473597d706e 348 ((AF) == GPIO_AF_6)||((AF) == GPIO_AF_7)||\
bogdanm 82:6473597d706e 349 ((AF) == GPIO_AF_8)||((AF) == GPIO_AF_9)||\
bogdanm 82:6473597d706e 350 ((AF) == GPIO_AF_10)||((AF) == GPIO_AF_11)||\
bogdanm 82:6473597d706e 351 ((AF) == GPIO_AF_12)||((AF) == GPIO_AF_13)||\
bogdanm 82:6473597d706e 352 ((AF) == GPIO_AF_14)||((AF) == GPIO_AF_15))
bogdanm 82:6473597d706e 353
bogdanm 82:6473597d706e 354 /**
bogdanm 82:6473597d706e 355 * @}
bogdanm 82:6473597d706e 356 */
bogdanm 82:6473597d706e 357
bogdanm 82:6473597d706e 358 /** @defgroup GPIO_Speed_Legacy
bogdanm 82:6473597d706e 359 * @{
bogdanm 82:6473597d706e 360 */
bogdanm 82:6473597d706e 361
bogdanm 82:6473597d706e 362 #define GPIO_Speed_10MHz GPIO_Speed_Level_1 /*!< Fast Speed:10MHz */
bogdanm 82:6473597d706e 363 #define GPIO_Speed_2MHz GPIO_Speed_Level_2 /*!< Medium Speed:2MHz */
bogdanm 82:6473597d706e 364 #define GPIO_Speed_50MHz GPIO_Speed_Level_3 /*!< High Speed:50MHz */
bogdanm 82:6473597d706e 365
bogdanm 82:6473597d706e 366 /**
bogdanm 82:6473597d706e 367 * @}
bogdanm 82:6473597d706e 368 */
bogdanm 82:6473597d706e 369
bogdanm 82:6473597d706e 370 /**
bogdanm 82:6473597d706e 371 * @}
bogdanm 82:6473597d706e 372 */
bogdanm 82:6473597d706e 373
bogdanm 82:6473597d706e 374 /* Exported macro ------------------------------------------------------------*/
bogdanm 82:6473597d706e 375 /* Exported functions ------------------------------------------------------- */
bogdanm 82:6473597d706e 376 /* Function used to set the GPIO configuration to the default reset state *****/
bogdanm 82:6473597d706e 377 void GPIO_DeInit(GPIO_TypeDef* GPIOx);
bogdanm 82:6473597d706e 378
bogdanm 82:6473597d706e 379 /* Initialization and Configuration functions *********************************/
bogdanm 82:6473597d706e 380 void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
bogdanm 82:6473597d706e 381 void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
bogdanm 82:6473597d706e 382 void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 82:6473597d706e 383
bogdanm 82:6473597d706e 384 /* GPIO Read and Write functions **********************************************/
bogdanm 82:6473597d706e 385 uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 82:6473597d706e 386 uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);
bogdanm 82:6473597d706e 387 uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 82:6473597d706e 388 uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);
bogdanm 82:6473597d706e 389 void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 82:6473597d706e 390 void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
bogdanm 82:6473597d706e 391 void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);
bogdanm 82:6473597d706e 392 void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);
bogdanm 82:6473597d706e 393
bogdanm 82:6473597d706e 394 /* GPIO Alternate functions configuration functions ***************************/
bogdanm 82:6473597d706e 395 void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF);
bogdanm 82:6473597d706e 396
bogdanm 82:6473597d706e 397 #ifdef __cplusplus
bogdanm 82:6473597d706e 398 }
bogdanm 82:6473597d706e 399 #endif
bogdanm 82:6473597d706e 400
bogdanm 82:6473597d706e 401 #endif /* __STM32F30x_GPIO_H */
bogdanm 82:6473597d706e 402 /**
bogdanm 82:6473597d706e 403 * @}
bogdanm 82:6473597d706e 404 */
bogdanm 82:6473597d706e 405
bogdanm 82:6473597d706e 406 /**
bogdanm 82:6473597d706e 407 * @}
bogdanm 82:6473597d706e 408 */
bogdanm 82:6473597d706e 409
bogdanm 82:6473597d706e 410 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/