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