Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 9 | ||
|---|---|---|---|
| Line 4... | Line 4... | ||
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @brief Header file of GPIO HAL module. |
5 | * @brief Header file of GPIO HAL module. |
| 6 | ****************************************************************************** |
6 | ****************************************************************************** |
| 7 | * @attention |
7 | * @attention |
| 8 | * |
8 | * |
| 9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
9 | * <h2><center>© Copyright (c) 2016 STMicroelectronics. |
| - | 10 | * All rights reserved.</center></h2> |
|
| 10 | * |
11 | * |
| 11 | * Redistribution and use in source and binary forms, with or without modification, |
12 | * This software component is licensed by ST under BSD 3-Clause license, |
| 12 | * are permitted provided that the following conditions are met: |
13 | * the "License"; You may not use this file except in compliance with the |
| 13 | * 1. Redistributions of source code must retain the above copyright notice, |
- | |
| 14 | * this list of conditions and the following disclaimer. |
- | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
- | |
| 16 | * this list of conditions and the following disclaimer in the documentation |
- | |
| 17 | * and/or other materials provided with the distribution. |
14 | * License. You may obtain a copy of the License at: |
| 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
- | |
| 19 | * may be used to endorse or promote products derived from this software |
15 | * opensource.org/licenses/BSD-3-Clause |
| 20 | * without specific prior written permission. |
- | |
| 21 | * |
- | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
- | |
| 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
- | |
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
- | |
| 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
- | |
| 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
- | |
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
- | |
| 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
- | |
| 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
- | |
| 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
- | |
| 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- | |
| 32 | * |
16 | * |
| 33 | ****************************************************************************** |
17 | ****************************************************************************** |
| 34 | */ |
18 | */ |
| 35 | 19 | ||
| 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
20 | /* Define to prevent recursive inclusion -------------------------------------*/ |
| 37 | #ifndef __STM32F1xx_HAL_GPIO_H |
21 | #ifndef STM32F1xx_HAL_GPIO_H |
| 38 | #define __STM32F1xx_HAL_GPIO_H |
22 | #define STM32F1xx_HAL_GPIO_H |
| 39 | 23 | ||
| 40 | #ifdef __cplusplus |
24 | #ifdef __cplusplus |
| 41 | extern "C" { |
25 | extern "C" { |
| 42 | #endif |
26 | #endif |
| 43 | 27 | ||
| Line 78... | Line 62... | ||
| 78 | /** |
62 | /** |
| 79 | * @brief GPIO Bit SET and Bit RESET enumeration |
63 | * @brief GPIO Bit SET and Bit RESET enumeration |
| 80 | */ |
64 | */ |
| 81 | typedef enum |
65 | typedef enum |
| 82 | { |
66 | { |
| 83 | GPIO_PIN_RESET = 0U, |
67 | GPIO_PIN_RESET = 0u, |
| 84 | GPIO_PIN_SET |
68 | GPIO_PIN_SET |
| 85 | } GPIO_PinState; |
69 | } GPIO_PinState; |
| 86 | /** |
70 | /** |
| 87 | * @} |
71 | * @} |
| 88 | */ |
72 | */ |
| Line 112... | Line 96... | ||
| 112 | #define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */ |
96 | #define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */ |
| 113 | #define GPIO_PIN_14 ((uint16_t)0x4000) /* Pin 14 selected */ |
97 | #define GPIO_PIN_14 ((uint16_t)0x4000) /* Pin 14 selected */ |
| 114 | #define GPIO_PIN_15 ((uint16_t)0x8000) /* Pin 15 selected */ |
98 | #define GPIO_PIN_15 ((uint16_t)0x8000) /* Pin 15 selected */ |
| 115 | #define GPIO_PIN_All ((uint16_t)0xFFFF) /* All pins selected */ |
99 | #define GPIO_PIN_All ((uint16_t)0xFFFF) /* All pins selected */ |
| 116 | 100 | ||
| 117 | #define GPIO_PIN_MASK 0x0000FFFFU /* PIN mask for assert test */ |
101 | #define GPIO_PIN_MASK 0x0000FFFFu /* PIN mask for assert test */ |
| 118 | /** |
102 | /** |
| 119 | * @} |
103 | * @} |
| 120 | */ |
104 | */ |
| 121 | 105 | ||
| 122 | /** @defgroup GPIO_mode_define GPIO mode define |
106 | /** @defgroup GPIO_mode_define GPIO mode define |
| Line 127... | Line 111... | ||
| 127 | * - z : IO configuration on External IT or Event |
111 | * - z : IO configuration on External IT or Event |
| 128 | * - Y : Output type (Push Pull or Open Drain) |
112 | * - Y : Output type (Push Pull or Open Drain) |
| 129 | * - Z : IO Direction mode (Input, Output, Alternate or Analog) |
113 | * - Z : IO Direction mode (Input, Output, Alternate or Analog) |
| 130 | * @{ |
114 | * @{ |
| 131 | */ |
115 | */ |
| 132 | #define GPIO_MODE_INPUT 0x00000000U /*!< Input Floating Mode */ |
116 | #define GPIO_MODE_INPUT 0x00000000u /*!< Input Floating Mode */ |
| 133 | #define GPIO_MODE_OUTPUT_PP 0x00000001U /*!< Output Push Pull Mode */ |
117 | #define GPIO_MODE_OUTPUT_PP 0x00000001u /*!< Output Push Pull Mode */ |
| 134 | #define GPIO_MODE_OUTPUT_OD 0x00000011U /*!< Output Open Drain Mode */ |
118 | #define GPIO_MODE_OUTPUT_OD 0x00000011u /*!< Output Open Drain Mode */ |
| 135 | #define GPIO_MODE_AF_PP 0x00000002U /*!< Alternate Function Push Pull Mode */ |
119 | #define GPIO_MODE_AF_PP 0x00000002u /*!< Alternate Function Push Pull Mode */ |
| 136 | #define GPIO_MODE_AF_OD 0x00000012U /*!< Alternate Function Open Drain Mode */ |
120 | #define GPIO_MODE_AF_OD 0x00000012u /*!< Alternate Function Open Drain Mode */ |
| 137 | #define GPIO_MODE_AF_INPUT GPIO_MODE_INPUT /*!< Alternate Function Input Mode */ |
121 | #define GPIO_MODE_AF_INPUT GPIO_MODE_INPUT /*!< Alternate Function Input Mode */ |
| 138 | 122 | ||
| 139 | #define GPIO_MODE_ANALOG 0x00000003U /*!< Analog Mode */ |
123 | #define GPIO_MODE_ANALOG 0x00000003u /*!< Analog Mode */ |
| 140 | 124 | ||
| 141 | #define GPIO_MODE_IT_RISING 0x10110000U /*!< External Interrupt Mode with Rising edge trigger detection */ |
125 | #define GPIO_MODE_IT_RISING 0x10110000u /*!< External Interrupt Mode with Rising edge trigger detection */ |
| 142 | #define GPIO_MODE_IT_FALLING 0x10210000U /*!< External Interrupt Mode with Falling edge trigger detection */ |
126 | #define GPIO_MODE_IT_FALLING 0x10210000u /*!< External Interrupt Mode with Falling edge trigger detection */ |
| 143 | #define GPIO_MODE_IT_RISING_FALLING 0x10310000U /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ |
127 | #define GPIO_MODE_IT_RISING_FALLING 0x10310000u /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ |
| 144 | 128 | ||
| 145 | #define GPIO_MODE_EVT_RISING 0x10120000U /*!< External Event Mode with Rising edge trigger detection */ |
129 | #define GPIO_MODE_EVT_RISING 0x10120000u /*!< External Event Mode with Rising edge trigger detection */ |
| 146 | #define GPIO_MODE_EVT_FALLING 0x10220000U /*!< External Event Mode with Falling edge trigger detection */ |
130 | #define GPIO_MODE_EVT_FALLING 0x10220000u /*!< External Event Mode with Falling edge trigger detection */ |
| 147 | #define GPIO_MODE_EVT_RISING_FALLING 0x10320000U /*!< External Event Mode with Rising/Falling edge trigger detection */ |
131 | #define GPIO_MODE_EVT_RISING_FALLING 0x10320000u /*!< External Event Mode with Rising/Falling edge trigger detection */ |
| 148 | 132 | ||
| 149 | /** |
133 | /** |
| 150 | * @} |
134 | * @} |
| 151 | */ |
135 | */ |
| 152 | 136 | ||
| Line 164... | Line 148... | ||
| 164 | 148 | ||
| 165 | /** @defgroup GPIO_pull_define GPIO pull define |
149 | /** @defgroup GPIO_pull_define GPIO pull define |
| 166 | * @brief GPIO Pull-Up or Pull-Down Activation |
150 | * @brief GPIO Pull-Up or Pull-Down Activation |
| 167 | * @{ |
151 | * @{ |
| 168 | */ |
152 | */ |
| 169 | #define GPIO_NOPULL 0x00000000U /*!< No Pull-up or Pull-down activation */ |
153 | #define GPIO_NOPULL 0x00000000u /*!< No Pull-up or Pull-down activation */ |
| 170 | #define GPIO_PULLUP 0x00000001U /*!< Pull-up activation */ |
154 | #define GPIO_PULLUP 0x00000001u /*!< Pull-up activation */ |
| 171 | #define GPIO_PULLDOWN 0x00000002U /*!< Pull-down activation */ |
155 | #define GPIO_PULLDOWN 0x00000002u /*!< Pull-down activation */ |
| 172 | /** |
156 | /** |
| 173 | * @} |
157 | * @} |
| 174 | */ |
158 | */ |
| 175 | 159 | ||
| 176 | /** |
160 | /** |
| Line 275... | Line 259... | ||
| 275 | /* Private macros ------------------------------------------------------------*/ |
259 | /* Private macros ------------------------------------------------------------*/ |
| 276 | /** @defgroup GPIO_Private_Macros GPIO Private Macros |
260 | /** @defgroup GPIO_Private_Macros GPIO Private Macros |
| 277 | * @{ |
261 | * @{ |
| 278 | */ |
262 | */ |
| 279 | #define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) |
263 | #define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) |
| 280 | #define IS_GPIO_PIN(PIN) ((((PIN) & GPIO_PIN_MASK ) != 0x00U) && (((PIN) & ~GPIO_PIN_MASK) == 0x00U)) |
264 | #define IS_GPIO_PIN(PIN) (((((uint32_t)PIN) & GPIO_PIN_MASK ) != 0x00u) && ((((uint32_t)PIN) & ~GPIO_PIN_MASK) == 0x00u)) |
| 281 | #define IS_GPIO_MODE(MODE) (((MODE) == GPIO_MODE_INPUT) ||\ |
265 | #define IS_GPIO_MODE(MODE) (((MODE) == GPIO_MODE_INPUT) ||\ |
| 282 | ((MODE) == GPIO_MODE_OUTPUT_PP) ||\ |
266 | ((MODE) == GPIO_MODE_OUTPUT_PP) ||\ |
| 283 | ((MODE) == GPIO_MODE_OUTPUT_OD) ||\ |
267 | ((MODE) == GPIO_MODE_OUTPUT_OD) ||\ |
| 284 | ((MODE) == GPIO_MODE_AF_PP) ||\ |
268 | ((MODE) == GPIO_MODE_AF_PP) ||\ |
| 285 | ((MODE) == GPIO_MODE_AF_OD) ||\ |
269 | ((MODE) == GPIO_MODE_AF_OD) ||\ |
| Line 317... | Line 301... | ||
| 317 | 301 | ||
| 318 | #ifdef __cplusplus |
302 | #ifdef __cplusplus |
| 319 | } |
303 | } |
| 320 | #endif |
304 | #endif |
| 321 | 305 | ||
| 322 | #endif /* __STM32F1xx_HAL_GPIO_H */ |
306 | #endif /* STM32F1xx_HAL_GPIO_H */ |
| 323 | 307 | ||
| 324 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
308 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |