Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of TUKS-COURSE-TIMER by
stm32l4xx_hal_gpio.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_hal_gpio.h 00004 * @author MCD Application Team 00005 * @version V1.5.1 00006 * @date 31-May-2016 00007 * @brief Header file of GPIO HAL module. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> 00012 * 00013 * Redistribution and use in source and binary forms, with or without modification, 00014 * are permitted provided that the following conditions are met: 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00021 * may be used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00028 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00029 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00030 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00032 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 ****************************************************************************** 00036 */ 00037 00038 /* Define to prevent recursive inclusion -------------------------------------*/ 00039 #ifndef __STM32L4xx_HAL_GPIO_H 00040 #define __STM32L4xx_HAL_GPIO_H 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 /* Includes ------------------------------------------------------------------*/ 00047 #include "stm32l4xx_hal_def.h" 00048 00049 /** @addtogroup STM32L4xx_HAL_Driver 00050 * @{ 00051 */ 00052 00053 /** @addtogroup GPIO 00054 * @{ 00055 */ 00056 00057 /* Exported types ------------------------------------------------------------*/ 00058 00059 /** @defgroup GPIO_Exported_Types GPIO Exported Types 00060 * @{ 00061 */ 00062 /** 00063 * @brief GPIO Init structure definition 00064 */ 00065 typedef struct 00066 { 00067 uint32_t Pin; /*!< Specifies the GPIO pins to be configured. 00068 This parameter can be any value of @ref GPIO_pins */ 00069 00070 uint32_t Mode; /*!< Specifies the operating mode for the selected pins. 00071 This parameter can be a value of @ref GPIO_mode */ 00072 00073 uint32_t Pull; /*!< Specifies the Pull-up or Pull-Down activation for the selected pins. 00074 This parameter can be a value of @ref GPIO_pull */ 00075 00076 uint32_t Speed; /*!< Specifies the speed for the selected pins. 00077 This parameter can be a value of @ref GPIO_speed */ 00078 00079 uint32_t Alternate; /*!< Peripheral to be connected to the selected pins 00080 This parameter can be a value of @ref GPIOEx_Alternate_function_selection */ 00081 }GPIO_InitTypeDef; 00082 00083 /** 00084 * @brief GPIO Bit SET and Bit RESET enumeration 00085 */ 00086 typedef enum 00087 { 00088 GPIO_PIN_RESET = 0, 00089 GPIO_PIN_SET 00090 }GPIO_PinState; 00091 /** 00092 * @} 00093 */ 00094 00095 /* Exported constants --------------------------------------------------------*/ 00096 /** @defgroup GPIO_Exported_Constants GPIO Exported Constants 00097 * @{ 00098 */ 00099 /** @defgroup GPIO_pins GPIO pins 00100 * @{ 00101 */ 00102 #define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */ 00103 #define GPIO_PIN_1 ((uint16_t)0x0002) /* Pin 1 selected */ 00104 #define GPIO_PIN_2 ((uint16_t)0x0004) /* Pin 2 selected */ 00105 #define GPIO_PIN_3 ((uint16_t)0x0008) /* Pin 3 selected */ 00106 #define GPIO_PIN_4 ((uint16_t)0x0010) /* Pin 4 selected */ 00107 #define GPIO_PIN_5 ((uint16_t)0x0020) /* Pin 5 selected */ 00108 #define GPIO_PIN_6 ((uint16_t)0x0040) /* Pin 6 selected */ 00109 #define GPIO_PIN_7 ((uint16_t)0x0080) /* Pin 7 selected */ 00110 #define GPIO_PIN_8 ((uint16_t)0x0100) /* Pin 8 selected */ 00111 #define GPIO_PIN_9 ((uint16_t)0x0200) /* Pin 9 selected */ 00112 #define GPIO_PIN_10 ((uint16_t)0x0400) /* Pin 10 selected */ 00113 #define GPIO_PIN_11 ((uint16_t)0x0800) /* Pin 11 selected */ 00114 #define GPIO_PIN_12 ((uint16_t)0x1000) /* Pin 12 selected */ 00115 #define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */ 00116 #define GPIO_PIN_14 ((uint16_t)0x4000) /* Pin 14 selected */ 00117 #define GPIO_PIN_15 ((uint16_t)0x8000) /* Pin 15 selected */ 00118 #define GPIO_PIN_All ((uint16_t)0xFFFF) /* All pins selected */ 00119 00120 #define GPIO_PIN_MASK ((uint32_t)0x0000FFFF) /* PIN mask for assert test */ 00121 /** 00122 * @} 00123 */ 00124 00125 /** @defgroup GPIO_mode GPIO mode 00126 * @brief GPIO Configuration Mode 00127 * Elements values convention: 0xX0yz00YZ 00128 * - X : GPIO mode or EXTI Mode 00129 * - y : External IT or Event trigger detection 00130 * - z : IO configuration on External IT or Event 00131 * - Y : Output type (Push Pull or Open Drain) 00132 * - Z : IO Direction mode (Input, Output, Alternate or Analog) 00133 * @{ 00134 */ 00135 #define GPIO_MODE_INPUT ((uint32_t)0x00000000) /*!< Input Floating Mode */ 00136 #define GPIO_MODE_OUTPUT_PP ((uint32_t)0x00000001) /*!< Output Push Pull Mode */ 00137 #define GPIO_MODE_OUTPUT_OD ((uint32_t)0x00000011) /*!< Output Open Drain Mode */ 00138 #define GPIO_MODE_AF_PP ((uint32_t)0x00000002) /*!< Alternate Function Push Pull Mode */ 00139 #define GPIO_MODE_AF_OD ((uint32_t)0x00000012) /*!< Alternate Function Open Drain Mode */ 00140 #define GPIO_MODE_ANALOG ((uint32_t)0x00000003) /*!< Analog Mode */ 00141 #define GPIO_MODE_ANALOG_ADC_CONTROL ((uint32_t)0x0000000B) /*!< Analog Mode for ADC conversion */ 00142 #define GPIO_MODE_IT_RISING ((uint32_t)0x10110000) /*!< External Interrupt Mode with Rising edge trigger detection */ 00143 #define GPIO_MODE_IT_FALLING ((uint32_t)0x10210000) /*!< External Interrupt Mode with Falling edge trigger detection */ 00144 #define GPIO_MODE_IT_RISING_FALLING ((uint32_t)0x10310000) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ 00145 #define GPIO_MODE_EVT_RISING ((uint32_t)0x10120000) /*!< External Event Mode with Rising edge trigger detection */ 00146 #define GPIO_MODE_EVT_FALLING ((uint32_t)0x10220000) /*!< External Event Mode with Falling edge trigger detection */ 00147 #define GPIO_MODE_EVT_RISING_FALLING ((uint32_t)0x10320000) /*!< External Event Mode with Rising/Falling edge trigger detection */ 00148 /** 00149 * @} 00150 */ 00151 00152 /** @defgroup GPIO_speed GPIO speed 00153 * @brief GPIO Output Maximum frequency 00154 * @{ 00155 */ 00156 #define GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000) /*!< range up to 5 MHz, please refer to the product datasheet */ 00157 #define GPIO_SPEED_FREQ_MEDIUM ((uint32_t)0x00000001) /*!< range 5 MHz to 25 MHz, please refer to the product datasheet */ 00158 #define GPIO_SPEED_FREQ_HIGH ((uint32_t)0x00000002) /*!< range 25 MHz to 50 MHz, please refer to the product datasheet */ 00159 #define GPIO_SPEED_FREQ_VERY_HIGH ((uint32_t)0x00000003) /*!< range 50 MHz to 80 MHz, please refer to the product datasheet */ 00160 /** 00161 * @} 00162 */ 00163 00164 /** @defgroup GPIO_pull GPIO pull 00165 * @brief GPIO Pull-Up or Pull-Down Activation 00166 * @{ 00167 */ 00168 #define GPIO_NOPULL ((uint32_t)0x00000000) /*!< No Pull-up or Pull-down activation */ 00169 #define GPIO_PULLUP ((uint32_t)0x00000001) /*!< Pull-up activation */ 00170 #define GPIO_PULLDOWN ((uint32_t)0x00000002) /*!< Pull-down activation */ 00171 /** 00172 * @} 00173 */ 00174 00175 /** 00176 * @} 00177 */ 00178 00179 /* Exported macro ------------------------------------------------------------*/ 00180 /** @defgroup GPIO_Exported_Macros GPIO Exported Macros 00181 * @{ 00182 */ 00183 00184 /** 00185 * @brief Check whether the specified EXTI line flag is set or not. 00186 * @param __EXTI_LINE__: specifies the EXTI line flag to check. 00187 * This parameter can be GPIO_PIN_x where x can be(0..15) 00188 * @retval The new state of __EXTI_LINE__ (SET or RESET). 00189 */ 00190 #define __HAL_GPIO_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__)) 00191 00192 /** 00193 * @brief Clear the EXTI's line pending flags. 00194 * @param __EXTI_LINE__: specifies the EXTI lines flags to clear. 00195 * This parameter can be any combination of GPIO_PIN_x where x can be (0..15) 00196 * @retval None 00197 */ 00198 #define __HAL_GPIO_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR1 = (__EXTI_LINE__)) 00199 00200 /** 00201 * @brief Check whether the specified EXTI line is asserted or not. 00202 * @param __EXTI_LINE__: specifies the EXTI line to check. 00203 * This parameter can be GPIO_PIN_x where x can be(0..15) 00204 * @retval The new state of __EXTI_LINE__ (SET or RESET). 00205 */ 00206 #define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__)) 00207 00208 /** 00209 * @brief Clear the EXTI's line pending bits. 00210 * @param __EXTI_LINE__: specifies the EXTI lines to clear. 00211 * This parameter can be any combination of GPIO_PIN_x where x can be (0..15) 00212 * @retval None 00213 */ 00214 #define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__) (EXTI->PR1 = (__EXTI_LINE__)) 00215 00216 /** 00217 * @brief Generate a Software interrupt on selected EXTI line. 00218 * @param __EXTI_LINE__: specifies the EXTI line to check. 00219 * This parameter can be GPIO_PIN_x where x can be(0..15) 00220 * @retval None 00221 */ 00222 #define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER1 |= (__EXTI_LINE__)) 00223 00224 /** 00225 * @} 00226 */ 00227 00228 /* Private macros ------------------------------------------------------------*/ 00229 /** @addtogroup GPIO_Private_Macros GPIO Private Macros 00230 * @{ 00231 */ 00232 #define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) 00233 00234 #define IS_GPIO_PIN(__PIN__) (((__PIN__) & GPIO_PIN_MASK) != (uint32_t)0x00) 00235 00236 #define IS_GPIO_MODE(__MODE__) (((__MODE__) == GPIO_MODE_INPUT) ||\ 00237 ((__MODE__) == GPIO_MODE_OUTPUT_PP) ||\ 00238 ((__MODE__) == GPIO_MODE_OUTPUT_OD) ||\ 00239 ((__MODE__) == GPIO_MODE_AF_PP) ||\ 00240 ((__MODE__) == GPIO_MODE_AF_OD) ||\ 00241 ((__MODE__) == GPIO_MODE_IT_RISING) ||\ 00242 ((__MODE__) == GPIO_MODE_IT_FALLING) ||\ 00243 ((__MODE__) == GPIO_MODE_IT_RISING_FALLING) ||\ 00244 ((__MODE__) == GPIO_MODE_EVT_RISING) ||\ 00245 ((__MODE__) == GPIO_MODE_EVT_FALLING) ||\ 00246 ((__MODE__) == GPIO_MODE_EVT_RISING_FALLING) ||\ 00247 ((__MODE__) == GPIO_MODE_ANALOG) ||\ 00248 ((__MODE__) == GPIO_MODE_ANALOG_ADC_CONTROL)) 00249 00250 #define IS_GPIO_SPEED(__SPEED__) (((__SPEED__) == GPIO_SPEED_FREQ_LOW) ||\ 00251 ((__SPEED__) == GPIO_SPEED_FREQ_MEDIUM) ||\ 00252 ((__SPEED__) == GPIO_SPEED_FREQ_HIGH) ||\ 00253 ((__SPEED__) == GPIO_SPEED_FREQ_VERY_HIGH)) 00254 00255 #define IS_GPIO_PULL(__PULL__) (((__PULL__) == GPIO_NOPULL) ||\ 00256 ((__PULL__) == GPIO_PULLUP) || \ 00257 ((__PULL__) == GPIO_PULLDOWN)) 00258 /** 00259 * @} 00260 */ 00261 00262 /* Include GPIO HAL Extended module */ 00263 #include "stm32l4xx_hal_gpio_ex.h" 00264 00265 /* Exported functions --------------------------------------------------------*/ 00266 /** @addtogroup GPIO_Exported_Functions GPIO Exported Functions 00267 * @{ 00268 */ 00269 00270 /** @addtogroup GPIO_Exported_Functions_Group1 Initialization/de-initialization functions 00271 * @brief Initialization and Configuration functions 00272 * @{ 00273 */ 00274 00275 /* Initialization and de-initialization functions *****************************/ 00276 void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init); 00277 void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin); 00278 00279 /** 00280 * @} 00281 */ 00282 00283 /** @addtogroup GPIO_Exported_Functions_Group2 IO operation functions 00284 * @{ 00285 */ 00286 00287 /* IO operation functions *****************************************************/ 00288 GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); 00289 void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState); 00290 void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); 00291 HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); 00292 void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin); 00293 void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); 00294 00295 /** 00296 * @} 00297 */ 00298 00299 /** 00300 * @} 00301 */ 00302 00303 /** 00304 * @} 00305 */ 00306 00307 /** 00308 * @} 00309 */ 00310 00311 #ifdef __cplusplus 00312 } 00313 #endif 00314 00315 #endif /* __STM32L4xx_HAL_GPIO_H */ 00316 00317 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 17:38:49 by
