The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
emilmont
Date:
Fri Feb 14 14:36:43 2014 +0000
Revision:
77:869cf507173a
Child:
81:7d30d6019079
Release 77 of the mbed library

Main changes:
* Add target NUCLEO_F030R8
* Add target NUCLEO_F401RE
* Add target NUCLEO_F103RB
* Add target NUCLEO_L152RE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 77:869cf507173a 1 /**
emilmont 77:869cf507173a 2 ******************************************************************************
emilmont 77:869cf507173a 3 * @file stm32l1xx_gpio.h
emilmont 77:869cf507173a 4 * @author MCD Application Team
emilmont 77:869cf507173a 5 * @version V1.3.0
emilmont 77:869cf507173a 6 * @date 31-January-2014
emilmont 77:869cf507173a 7 * @brief This file contains all the functions prototypes for the GPIO
emilmont 77:869cf507173a 8 * firmware library.
emilmont 77:869cf507173a 9 ******************************************************************************
emilmont 77:869cf507173a 10 * @attention
emilmont 77:869cf507173a 11 *
emilmont 77:869cf507173a 12 * <h2><center>&copy; COPYRIGHT 2014 STMicroelectronics</center></h2>
emilmont 77:869cf507173a 13 *
emilmont 77:869cf507173a 14 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
emilmont 77:869cf507173a 15 * You may not use this file except in compliance with the License.
emilmont 77:869cf507173a 16 * You may obtain a copy of the License at:
emilmont 77:869cf507173a 17 *
emilmont 77:869cf507173a 18 * http://www.st.com/software_license_agreement_liberty_v2
emilmont 77:869cf507173a 19 *
emilmont 77:869cf507173a 20 * Unless required by applicable law or agreed to in writing, software
emilmont 77:869cf507173a 21 * distributed under the License is distributed on an "AS IS" BASIS,
emilmont 77:869cf507173a 22 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
emilmont 77:869cf507173a 23 * See the License for the specific language governing permissions and
emilmont 77:869cf507173a 24 * limitations under the License.
emilmont 77:869cf507173a 25 *
emilmont 77:869cf507173a 26 ******************************************************************************
emilmont 77:869cf507173a 27 */
emilmont 77:869cf507173a 28
emilmont 77:869cf507173a 29 /* Define to prevent recursive inclusion -------------------------------------*/
emilmont 77:869cf507173a 30 #ifndef __STM32L1xx_GPIO_H
emilmont 77:869cf507173a 31 #define __STM32L1xx_GPIO_H
emilmont 77:869cf507173a 32
emilmont 77:869cf507173a 33 #ifdef __cplusplus
emilmont 77:869cf507173a 34 extern "C" {
emilmont 77:869cf507173a 35 #endif
emilmont 77:869cf507173a 36
emilmont 77:869cf507173a 37 /* Includes ------------------------------------------------------------------*/
emilmont 77:869cf507173a 38 #include "stm32l1xx.h"
emilmont 77:869cf507173a 39
emilmont 77:869cf507173a 40 /** @addtogroup STM32L1xx_StdPeriph_Driver
emilmont 77:869cf507173a 41 * @{
emilmont 77:869cf507173a 42 */
emilmont 77:869cf507173a 43
emilmont 77:869cf507173a 44 /** @addtogroup GPIO
emilmont 77:869cf507173a 45 * @{
emilmont 77:869cf507173a 46 */
emilmont 77:869cf507173a 47
emilmont 77:869cf507173a 48 /* Exported types ------------------------------------------------------------*/
emilmont 77:869cf507173a 49
emilmont 77:869cf507173a 50 #define IS_GPIO_ALL_PERIPH(PERIPH) (((PERIPH) == GPIOA) || \
emilmont 77:869cf507173a 51 ((PERIPH) == GPIOB) || \
emilmont 77:869cf507173a 52 ((PERIPH) == GPIOC) || \
emilmont 77:869cf507173a 53 ((PERIPH) == GPIOD) || \
emilmont 77:869cf507173a 54 ((PERIPH) == GPIOE) || \
emilmont 77:869cf507173a 55 ((PERIPH) == GPIOH) || \
emilmont 77:869cf507173a 56 ((PERIPH) == GPIOF) || \
emilmont 77:869cf507173a 57 ((PERIPH) == GPIOG))
emilmont 77:869cf507173a 58
emilmont 77:869cf507173a 59 /** @defgroup Configuration_Mode_enumeration
emilmont 77:869cf507173a 60 * @{
emilmont 77:869cf507173a 61 */
emilmont 77:869cf507173a 62 typedef enum
emilmont 77:869cf507173a 63 {
emilmont 77:869cf507173a 64 GPIO_Mode_IN = 0x00, /*!< GPIO Input Mode */
emilmont 77:869cf507173a 65 GPIO_Mode_OUT = 0x01, /*!< GPIO Output Mode */
emilmont 77:869cf507173a 66 GPIO_Mode_AF = 0x02, /*!< GPIO Alternate function Mode */
emilmont 77:869cf507173a 67 GPIO_Mode_AN = 0x03 /*!< GPIO Analog Mode */
emilmont 77:869cf507173a 68 }GPIOMode_TypeDef;
emilmont 77:869cf507173a 69 #define IS_GPIO_MODE(MODE) (((MODE) == GPIO_Mode_IN) || ((MODE) == GPIO_Mode_OUT) || \
emilmont 77:869cf507173a 70 ((MODE) == GPIO_Mode_AF)|| ((MODE) == GPIO_Mode_AN))
emilmont 77:869cf507173a 71 /**
emilmont 77:869cf507173a 72 * @}
emilmont 77:869cf507173a 73 */
emilmont 77:869cf507173a 74
emilmont 77:869cf507173a 75 /** @defgroup Output_type_enumeration
emilmont 77:869cf507173a 76 * @{
emilmont 77:869cf507173a 77 */
emilmont 77:869cf507173a 78 typedef enum
emilmont 77:869cf507173a 79 { GPIO_OType_PP = 0x00,
emilmont 77:869cf507173a 80 GPIO_OType_OD = 0x01
emilmont 77:869cf507173a 81 }GPIOOType_TypeDef;
emilmont 77:869cf507173a 82 #define IS_GPIO_OTYPE(OTYPE) (((OTYPE) == GPIO_OType_PP) || ((OTYPE) == GPIO_OType_OD))
emilmont 77:869cf507173a 83
emilmont 77:869cf507173a 84 /**
emilmont 77:869cf507173a 85 * @}
emilmont 77:869cf507173a 86 */
emilmont 77:869cf507173a 87
emilmont 77:869cf507173a 88 /** @defgroup Output_Maximum_frequency_enumeration
emilmont 77:869cf507173a 89 * @{
emilmont 77:869cf507173a 90 */
emilmont 77:869cf507173a 91 typedef enum
emilmont 77:869cf507173a 92 {
emilmont 77:869cf507173a 93 GPIO_Speed_400KHz = 0x00, /*!< Very Low Speed */
emilmont 77:869cf507173a 94 GPIO_Speed_2MHz = 0x01, /*!< Low Speed */
emilmont 77:869cf507173a 95 GPIO_Speed_10MHz = 0x02, /*!< Medium Speed */
emilmont 77:869cf507173a 96 GPIO_Speed_40MHz = 0x03 /*!< High Speed */
emilmont 77:869cf507173a 97 }GPIOSpeed_TypeDef;
emilmont 77:869cf507173a 98 #define IS_GPIO_SPEED(SPEED) (((SPEED) == GPIO_Speed_400KHz) || ((SPEED) == GPIO_Speed_2MHz) || \
emilmont 77:869cf507173a 99 ((SPEED) == GPIO_Speed_10MHz)|| ((SPEED) == GPIO_Speed_40MHz))
emilmont 77:869cf507173a 100 /**
emilmont 77:869cf507173a 101 * @}
emilmont 77:869cf507173a 102 */
emilmont 77:869cf507173a 103
emilmont 77:869cf507173a 104 /** @defgroup Configuration_Pull-Up_Pull-Down_enumeration
emilmont 77:869cf507173a 105 * @{
emilmont 77:869cf507173a 106 */
emilmont 77:869cf507173a 107 typedef enum
emilmont 77:869cf507173a 108 { GPIO_PuPd_NOPULL = 0x00,
emilmont 77:869cf507173a 109 GPIO_PuPd_UP = 0x01,
emilmont 77:869cf507173a 110 GPIO_PuPd_DOWN = 0x02
emilmont 77:869cf507173a 111 }GPIOPuPd_TypeDef;
emilmont 77:869cf507173a 112 #define IS_GPIO_PUPD(PUPD) (((PUPD) == GPIO_PuPd_NOPULL) || ((PUPD) == GPIO_PuPd_UP) || \
emilmont 77:869cf507173a 113 ((PUPD) == GPIO_PuPd_DOWN))
emilmont 77:869cf507173a 114 /**
emilmont 77:869cf507173a 115 * @}
emilmont 77:869cf507173a 116 */
emilmont 77:869cf507173a 117
emilmont 77:869cf507173a 118 /** @defgroup Bit_SET_and_Bit_RESET_enumeration
emilmont 77:869cf507173a 119 * @{
emilmont 77:869cf507173a 120 */
emilmont 77:869cf507173a 121 typedef enum
emilmont 77:869cf507173a 122 { Bit_RESET = 0,
emilmont 77:869cf507173a 123 Bit_SET
emilmont 77:869cf507173a 124 }BitAction;
emilmont 77:869cf507173a 125 #define IS_GPIO_BIT_ACTION(ACTION) (((ACTION) == Bit_RESET) || ((ACTION) == Bit_SET))
emilmont 77:869cf507173a 126
emilmont 77:869cf507173a 127 /**
emilmont 77:869cf507173a 128 * @}
emilmont 77:869cf507173a 129 */
emilmont 77:869cf507173a 130
emilmont 77:869cf507173a 131 /**
emilmont 77:869cf507173a 132 * @brief GPIO Init structure definition
emilmont 77:869cf507173a 133 */
emilmont 77:869cf507173a 134 typedef struct
emilmont 77:869cf507173a 135 {
emilmont 77:869cf507173a 136 uint32_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
emilmont 77:869cf507173a 137 This parameter can be any value of @ref GPIO_pins_define */
emilmont 77:869cf507173a 138
emilmont 77:869cf507173a 139 GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
emilmont 77:869cf507173a 140 This parameter can be a value of @ref GPIOMode_TypeDef */
emilmont 77:869cf507173a 141
emilmont 77:869cf507173a 142 GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
emilmont 77:869cf507173a 143 This parameter can be a value of @ref GPIOSpeed_TypeDef */
emilmont 77:869cf507173a 144
emilmont 77:869cf507173a 145 GPIOOType_TypeDef GPIO_OType; /*!< Specifies the operating output type for the selected pins.
emilmont 77:869cf507173a 146 This parameter can be a value of @ref GPIOOType_TypeDef */
emilmont 77:869cf507173a 147
emilmont 77:869cf507173a 148 GPIOPuPd_TypeDef GPIO_PuPd; /*!< Specifies the operating Pull-up/Pull down for the selected pins.
emilmont 77:869cf507173a 149 This parameter can be a value of @ref GPIOPuPd_TypeDef */
emilmont 77:869cf507173a 150 }GPIO_InitTypeDef;
emilmont 77:869cf507173a 151
emilmont 77:869cf507173a 152 /* Exported constants --------------------------------------------------------*/
emilmont 77:869cf507173a 153
emilmont 77:869cf507173a 154 /** @defgroup GPIO_Exported_Constants
emilmont 77:869cf507173a 155 * @{
emilmont 77:869cf507173a 156 */
emilmont 77:869cf507173a 157
emilmont 77:869cf507173a 158 /** @defgroup GPIO_pins_define
emilmont 77:869cf507173a 159 * @{
emilmont 77:869cf507173a 160 */
emilmont 77:869cf507173a 161 #define GPIO_Pin_0 ((uint16_t)0x0001) /*!< Pin 0 selected */
emilmont 77:869cf507173a 162 #define GPIO_Pin_1 ((uint16_t)0x0002) /*!< Pin 1 selected */
emilmont 77:869cf507173a 163 #define GPIO_Pin_2 ((uint16_t)0x0004) /*!< Pin 2 selected */
emilmont 77:869cf507173a 164 #define GPIO_Pin_3 ((uint16_t)0x0008) /*!< Pin 3 selected */
emilmont 77:869cf507173a 165 #define GPIO_Pin_4 ((uint16_t)0x0010) /*!< Pin 4 selected */
emilmont 77:869cf507173a 166 #define GPIO_Pin_5 ((uint16_t)0x0020) /*!< Pin 5 selected */
emilmont 77:869cf507173a 167 #define GPIO_Pin_6 ((uint16_t)0x0040) /*!< Pin 6 selected */
emilmont 77:869cf507173a 168 #define GPIO_Pin_7 ((uint16_t)0x0080) /*!< Pin 7 selected */
emilmont 77:869cf507173a 169 #define GPIO_Pin_8 ((uint16_t)0x0100) /*!< Pin 8 selected */
emilmont 77:869cf507173a 170 #define GPIO_Pin_9 ((uint16_t)0x0200) /*!< Pin 9 selected */
emilmont 77:869cf507173a 171 #define GPIO_Pin_10 ((uint16_t)0x0400) /*!< Pin 10 selected */
emilmont 77:869cf507173a 172 #define GPIO_Pin_11 ((uint16_t)0x0800) /*!< Pin 11 selected */
emilmont 77:869cf507173a 173 #define GPIO_Pin_12 ((uint16_t)0x1000) /*!< Pin 12 selected */
emilmont 77:869cf507173a 174 #define GPIO_Pin_13 ((uint16_t)0x2000) /*!< Pin 13 selected */
emilmont 77:869cf507173a 175 #define GPIO_Pin_14 ((uint16_t)0x4000) /*!< Pin 14 selected */
emilmont 77:869cf507173a 176 #define GPIO_Pin_15 ((uint16_t)0x8000) /*!< Pin 15 selected */
emilmont 77:869cf507173a 177 #define GPIO_Pin_All ((uint16_t)0xFFFF) /*!< All pins selected */
emilmont 77:869cf507173a 178
emilmont 77:869cf507173a 179 #define IS_GPIO_PIN(PIN) ((PIN) != (uint16_t)0x00)
emilmont 77:869cf507173a 180 #define IS_GET_GPIO_PIN(PIN) (((PIN) == GPIO_Pin_0) || \
emilmont 77:869cf507173a 181 ((PIN) == GPIO_Pin_1) || \
emilmont 77:869cf507173a 182 ((PIN) == GPIO_Pin_2) || \
emilmont 77:869cf507173a 183 ((PIN) == GPIO_Pin_3) || \
emilmont 77:869cf507173a 184 ((PIN) == GPIO_Pin_4) || \
emilmont 77:869cf507173a 185 ((PIN) == GPIO_Pin_5) || \
emilmont 77:869cf507173a 186 ((PIN) == GPIO_Pin_6) || \
emilmont 77:869cf507173a 187 ((PIN) == GPIO_Pin_7) || \
emilmont 77:869cf507173a 188 ((PIN) == GPIO_Pin_8) || \
emilmont 77:869cf507173a 189 ((PIN) == GPIO_Pin_9) || \
emilmont 77:869cf507173a 190 ((PIN) == GPIO_Pin_10) || \
emilmont 77:869cf507173a 191 ((PIN) == GPIO_Pin_11) || \
emilmont 77:869cf507173a 192 ((PIN) == GPIO_Pin_12) || \
emilmont 77:869cf507173a 193 ((PIN) == GPIO_Pin_13) || \
emilmont 77:869cf507173a 194 ((PIN) == GPIO_Pin_14) || \
emilmont 77:869cf507173a 195 ((PIN) == GPIO_Pin_15))
emilmont 77:869cf507173a 196 /**
emilmont 77:869cf507173a 197 * @}
emilmont 77:869cf507173a 198 */
emilmont 77:869cf507173a 199
emilmont 77:869cf507173a 200 /** @defgroup GPIO_Pin_sources
emilmont 77:869cf507173a 201 * @{
emilmont 77:869cf507173a 202 */
emilmont 77:869cf507173a 203 #define GPIO_PinSource0 ((uint8_t)0x00)
emilmont 77:869cf507173a 204 #define GPIO_PinSource1 ((uint8_t)0x01)
emilmont 77:869cf507173a 205 #define GPIO_PinSource2 ((uint8_t)0x02)
emilmont 77:869cf507173a 206 #define GPIO_PinSource3 ((uint8_t)0x03)
emilmont 77:869cf507173a 207 #define GPIO_PinSource4 ((uint8_t)0x04)
emilmont 77:869cf507173a 208 #define GPIO_PinSource5 ((uint8_t)0x05)
emilmont 77:869cf507173a 209 #define GPIO_PinSource6 ((uint8_t)0x06)
emilmont 77:869cf507173a 210 #define GPIO_PinSource7 ((uint8_t)0x07)
emilmont 77:869cf507173a 211 #define GPIO_PinSource8 ((uint8_t)0x08)
emilmont 77:869cf507173a 212 #define GPIO_PinSource9 ((uint8_t)0x09)
emilmont 77:869cf507173a 213 #define GPIO_PinSource10 ((uint8_t)0x0A)
emilmont 77:869cf507173a 214 #define GPIO_PinSource11 ((uint8_t)0x0B)
emilmont 77:869cf507173a 215 #define GPIO_PinSource12 ((uint8_t)0x0C)
emilmont 77:869cf507173a 216 #define GPIO_PinSource13 ((uint8_t)0x0D)
emilmont 77:869cf507173a 217 #define GPIO_PinSource14 ((uint8_t)0x0E)
emilmont 77:869cf507173a 218 #define GPIO_PinSource15 ((uint8_t)0x0F)
emilmont 77:869cf507173a 219
emilmont 77:869cf507173a 220 #define IS_GPIO_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == GPIO_PinSource0) || \
emilmont 77:869cf507173a 221 ((PINSOURCE) == GPIO_PinSource1) || \
emilmont 77:869cf507173a 222 ((PINSOURCE) == GPIO_PinSource2) || \
emilmont 77:869cf507173a 223 ((PINSOURCE) == GPIO_PinSource3) || \
emilmont 77:869cf507173a 224 ((PINSOURCE) == GPIO_PinSource4) || \
emilmont 77:869cf507173a 225 ((PINSOURCE) == GPIO_PinSource5) || \
emilmont 77:869cf507173a 226 ((PINSOURCE) == GPIO_PinSource6) || \
emilmont 77:869cf507173a 227 ((PINSOURCE) == GPIO_PinSource7) || \
emilmont 77:869cf507173a 228 ((PINSOURCE) == GPIO_PinSource8) || \
emilmont 77:869cf507173a 229 ((PINSOURCE) == GPIO_PinSource9) || \
emilmont 77:869cf507173a 230 ((PINSOURCE) == GPIO_PinSource10) || \
emilmont 77:869cf507173a 231 ((PINSOURCE) == GPIO_PinSource11) || \
emilmont 77:869cf507173a 232 ((PINSOURCE) == GPIO_PinSource12) || \
emilmont 77:869cf507173a 233 ((PINSOURCE) == GPIO_PinSource13) || \
emilmont 77:869cf507173a 234 ((PINSOURCE) == GPIO_PinSource14) || \
emilmont 77:869cf507173a 235 ((PINSOURCE) == GPIO_PinSource15))
emilmont 77:869cf507173a 236 /**
emilmont 77:869cf507173a 237 * @}
emilmont 77:869cf507173a 238 */
emilmont 77:869cf507173a 239
emilmont 77:869cf507173a 240 /** @defgroup GPIO_Alternat_function_selection_define
emilmont 77:869cf507173a 241 * @{
emilmont 77:869cf507173a 242 */
emilmont 77:869cf507173a 243
emilmont 77:869cf507173a 244 /**
emilmont 77:869cf507173a 245 * @brief AF 0 selection
emilmont 77:869cf507173a 246 */
emilmont 77:869cf507173a 247 #define GPIO_AF_RTC_50Hz ((uint8_t)0x00) /*!< RTC 50/60 Hz Alternate Function mapping */
emilmont 77:869cf507173a 248 #define GPIO_AF_MCO ((uint8_t)0x00) /*!< MCO Alternate Function mapping */
emilmont 77:869cf507173a 249 #define GPIO_AF_RTC_AF1 ((uint8_t)0x00) /*!< RTC_AF1 Alternate Function mapping */
emilmont 77:869cf507173a 250 #define GPIO_AF_WKUP ((uint8_t)0x00) /*!< Wakeup (WKUP1, WKUP2 and WKUP3) Alternate Function mapping */
emilmont 77:869cf507173a 251 #define GPIO_AF_SWJ ((uint8_t)0x00) /*!< SWJ (SW and JTAG) Alternate Function mapping */
emilmont 77:869cf507173a 252 #define GPIO_AF_TRACE ((uint8_t)0x00) /*!< TRACE Alternate Function mapping */
emilmont 77:869cf507173a 253
emilmont 77:869cf507173a 254 /**
emilmont 77:869cf507173a 255 * @brief AF 1 selection
emilmont 77:869cf507173a 256 */
emilmont 77:869cf507173a 257 #define GPIO_AF_TIM2 ((uint8_t)0x01) /*!< TIM2 Alternate Function mapping */
emilmont 77:869cf507173a 258 /**
emilmont 77:869cf507173a 259 * @brief AF 2 selection
emilmont 77:869cf507173a 260 */
emilmont 77:869cf507173a 261 #define GPIO_AF_TIM3 ((uint8_t)0x02) /*!< TIM3 Alternate Function mapping */
emilmont 77:869cf507173a 262 #define GPIO_AF_TIM4 ((uint8_t)0x02) /*!< TIM4 Alternate Function mapping */
emilmont 77:869cf507173a 263 #define GPIO_AF_TIM5 ((uint8_t)0x02) /*!< TIM5 Alternate Function mapping */
emilmont 77:869cf507173a 264 /**
emilmont 77:869cf507173a 265 * @brief AF 3 selection
emilmont 77:869cf507173a 266 */
emilmont 77:869cf507173a 267 #define GPIO_AF_TIM9 ((uint8_t)0x03) /*!< TIM9 Alternate Function mapping */
emilmont 77:869cf507173a 268 #define GPIO_AF_TIM10 ((uint8_t)0x03) /*!< TIM10 Alternate Function mapping */
emilmont 77:869cf507173a 269 #define GPIO_AF_TIM11 ((uint8_t)0x03) /*!< TIM11 Alternate Function mapping */
emilmont 77:869cf507173a 270 /**
emilmont 77:869cf507173a 271 * @brief AF 4 selection
emilmont 77:869cf507173a 272 */
emilmont 77:869cf507173a 273 #define GPIO_AF_I2C1 ((uint8_t)0x04) /*!< I2C1 Alternate Function mapping */
emilmont 77:869cf507173a 274 #define GPIO_AF_I2C2 ((uint8_t)0x04) /*!< I2C2 Alternate Function mapping */
emilmont 77:869cf507173a 275 /**
emilmont 77:869cf507173a 276 * @brief AF 5 selection
emilmont 77:869cf507173a 277 */
emilmont 77:869cf507173a 278 #define GPIO_AF_SPI1 ((uint8_t)0x05) /*!< SPI1 Alternate Function mapping */
emilmont 77:869cf507173a 279 #define GPIO_AF_SPI2 ((uint8_t)0x05) /*!< SPI2 Alternate Function mapping */
emilmont 77:869cf507173a 280 /**
emilmont 77:869cf507173a 281 * @brief AF 6 selection
emilmont 77:869cf507173a 282 */
emilmont 77:869cf507173a 283 #define GPIO_AF_SPI3 ((uint8_t)0x06) /*!< SPI3 Alternate Function mapping */
emilmont 77:869cf507173a 284 /**
emilmont 77:869cf507173a 285 * @brief AF 7 selection
emilmont 77:869cf507173a 286 */
emilmont 77:869cf507173a 287 #define GPIO_AF_USART1 ((uint8_t)0x07) /*!< USART1 Alternate Function mapping */
emilmont 77:869cf507173a 288 #define GPIO_AF_USART2 ((uint8_t)0x07) /*!< USART2 Alternate Function mapping */
emilmont 77:869cf507173a 289 #define GPIO_AF_USART3 ((uint8_t)0x07) /*!< USART3 Alternate Function mapping */
emilmont 77:869cf507173a 290 /**
emilmont 77:869cf507173a 291 * @brief AF 8 selection
emilmont 77:869cf507173a 292 */
emilmont 77:869cf507173a 293 #define GPIO_AF_UART4 ((uint8_t)0x08) /*!< UART4 Alternate Function mapping */
emilmont 77:869cf507173a 294 #define GPIO_AF_UART5 ((uint8_t)0x08) /*!< UART5 Alternate Function mapping */
emilmont 77:869cf507173a 295 /**
emilmont 77:869cf507173a 296 * @brief AF 10 selection
emilmont 77:869cf507173a 297 */
emilmont 77:869cf507173a 298 #define GPIO_AF_USB ((uint8_t)0xA) /*!< USB Full speed device Alternate Function mapping */
emilmont 77:869cf507173a 299 /**
emilmont 77:869cf507173a 300 * @brief AF 11 selection
emilmont 77:869cf507173a 301 */
emilmont 77:869cf507173a 302 #define GPIO_AF_LCD ((uint8_t)0x0B) /*!< LCD Alternate Function mapping */
emilmont 77:869cf507173a 303 /**
emilmont 77:869cf507173a 304 * @brief AF 12 selection
emilmont 77:869cf507173a 305 */
emilmont 77:869cf507173a 306 #define GPIO_AF_FSMC ((uint8_t)0x0C) /*!< FSMC Alternate Function mapping */
emilmont 77:869cf507173a 307 #define GPIO_AF_SDIO ((uint8_t)0x0C) /*!< SDIO Alternate Function mapping */
emilmont 77:869cf507173a 308 /**
emilmont 77:869cf507173a 309 * @brief AF 14 selection
emilmont 77:869cf507173a 310 */
emilmont 77:869cf507173a 311 #define GPIO_AF_RI ((uint8_t)0x0E) /*!< RI Alternate Function mapping */
emilmont 77:869cf507173a 312
emilmont 77:869cf507173a 313 /**
emilmont 77:869cf507173a 314 * @brief AF 15 selection
emilmont 77:869cf507173a 315 */
emilmont 77:869cf507173a 316 #define GPIO_AF_EVENTOUT ((uint8_t)0x0F) /*!< EVENTOUT Alternate Function mapping */
emilmont 77:869cf507173a 317
emilmont 77:869cf507173a 318 #define IS_GPIO_AF(AF) (((AF) == GPIO_AF_RTC_50Hz) || ((AF) == GPIO_AF_MCO) || \
emilmont 77:869cf507173a 319 ((AF) == GPIO_AF_RTC_AF1) || ((AF) == GPIO_AF_WKUP) || \
emilmont 77:869cf507173a 320 ((AF) == GPIO_AF_SWJ) || ((AF) == GPIO_AF_TRACE) || \
emilmont 77:869cf507173a 321 ((AF) == GPIO_AF_TIM2) || ((AF)== GPIO_AF_TIM3) || \
emilmont 77:869cf507173a 322 ((AF) == GPIO_AF_TIM4) || ((AF)== GPIO_AF_TIM9) || \
emilmont 77:869cf507173a 323 ((AF) == GPIO_AF_TIM10) || ((AF)== GPIO_AF_TIM11) || \
emilmont 77:869cf507173a 324 ((AF) == GPIO_AF_I2C1) || ((AF) == GPIO_AF_I2C2) || \
emilmont 77:869cf507173a 325 ((AF) == GPIO_AF_SPI1) || ((AF) == GPIO_AF_SPI2) || \
emilmont 77:869cf507173a 326 ((AF) == GPIO_AF_USART1) || ((AF) == GPIO_AF_USART2) || \
emilmont 77:869cf507173a 327 ((AF) == GPIO_AF_USART3) || ((AF) == GPIO_AF_USB) || \
emilmont 77:869cf507173a 328 ((AF) == GPIO_AF_LCD) || ((AF) == GPIO_AF_RI) || \
emilmont 77:869cf507173a 329 ((AF) == GPIO_AF_TIM5) || ((AF) == GPIO_AF_SPI3) || \
emilmont 77:869cf507173a 330 ((AF) == GPIO_AF_UART4) || ((AF) == GPIO_AF_UART5) || \
emilmont 77:869cf507173a 331 ((AF) == GPIO_AF_FSMC) || ((AF) == GPIO_AF_SDIO) || \
emilmont 77:869cf507173a 332 ((AF) == GPIO_AF_EVENTOUT))
emilmont 77:869cf507173a 333
emilmont 77:869cf507173a 334 /**
emilmont 77:869cf507173a 335 * @}
emilmont 77:869cf507173a 336 */
emilmont 77:869cf507173a 337
emilmont 77:869cf507173a 338 /** @defgroup GPIO_Legacy
emilmont 77:869cf507173a 339 * @{
emilmont 77:869cf507173a 340 */
emilmont 77:869cf507173a 341
emilmont 77:869cf507173a 342 #define GPIO_Mode_AIN GPIO_Mode_AN
emilmont 77:869cf507173a 343
emilmont 77:869cf507173a 344 /**
emilmont 77:869cf507173a 345 * @}
emilmont 77:869cf507173a 346 */
emilmont 77:869cf507173a 347
emilmont 77:869cf507173a 348 /**
emilmont 77:869cf507173a 349 * @}
emilmont 77:869cf507173a 350 */
emilmont 77:869cf507173a 351
emilmont 77:869cf507173a 352 /* Exported macro ------------------------------------------------------------*/
emilmont 77:869cf507173a 353 /* Exported functions ------------------------------------------------------- */
emilmont 77:869cf507173a 354
emilmont 77:869cf507173a 355 /* Function used to set the GPIO configuration to the default reset state ****/
emilmont 77:869cf507173a 356 void GPIO_DeInit(GPIO_TypeDef* GPIOx);
emilmont 77:869cf507173a 357
emilmont 77:869cf507173a 358 /* Initialization and Configuration functions *********************************/
emilmont 77:869cf507173a 359 void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
emilmont 77:869cf507173a 360 void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
emilmont 77:869cf507173a 361 void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
emilmont 77:869cf507173a 362
emilmont 77:869cf507173a 363 /* GPIO Read and Write functions **********************************************/
emilmont 77:869cf507173a 364 uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
emilmont 77:869cf507173a 365 uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);
emilmont 77:869cf507173a 366 uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
emilmont 77:869cf507173a 367 uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);
emilmont 77:869cf507173a 368 void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
emilmont 77:869cf507173a 369 void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
emilmont 77:869cf507173a 370 void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);
emilmont 77:869cf507173a 371 void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);
emilmont 77:869cf507173a 372 void GPIO_ToggleBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
emilmont 77:869cf507173a 373
emilmont 77:869cf507173a 374 /* GPIO Alternate functions configuration functions ***************************/
emilmont 77:869cf507173a 375 void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF);
emilmont 77:869cf507173a 376
emilmont 77:869cf507173a 377 #ifdef __cplusplus
emilmont 77:869cf507173a 378 }
emilmont 77:869cf507173a 379 #endif
emilmont 77:869cf507173a 380
emilmont 77:869cf507173a 381 #endif /*__STM32L1xx_GPIO_H */
emilmont 77:869cf507173a 382
emilmont 77:869cf507173a 383 /**
emilmont 77:869cf507173a 384 * @}
emilmont 77:869cf507173a 385 */
emilmont 77:869cf507173a 386
emilmont 77:869cf507173a 387 /**
emilmont 77:869cf507173a 388 * @}
emilmont 77:869cf507173a 389 */
emilmont 77:869cf507173a 390
emilmont 77:869cf507173a 391 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/