001
targets/TARGET_STM/TARGET_STM32F4/device/stm32f4xx_hal_gpio.c@0:13413ea9a877, 2022-06-12 (annotated)
- Committer:
- ganlikun
- Date:
- Sun Jun 12 14:02:44 2022 +0000
- Revision:
- 0:13413ea9a877
00
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ganlikun | 0:13413ea9a877 | 1 | /** |
ganlikun | 0:13413ea9a877 | 2 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 3 | * @file stm32f4xx_hal_gpio.c |
ganlikun | 0:13413ea9a877 | 4 | * @author MCD Application Team |
ganlikun | 0:13413ea9a877 | 5 | * @version V1.7.1 |
ganlikun | 0:13413ea9a877 | 6 | * @date 14-April-2017 |
ganlikun | 0:13413ea9a877 | 7 | * @brief GPIO HAL module driver. |
ganlikun | 0:13413ea9a877 | 8 | * This file provides firmware functions to manage the following |
ganlikun | 0:13413ea9a877 | 9 | * functionalities of the General Purpose Input/Output (GPIO) peripheral: |
ganlikun | 0:13413ea9a877 | 10 | * + Initialization and de-initialization functions |
ganlikun | 0:13413ea9a877 | 11 | * + IO operation functions |
ganlikun | 0:13413ea9a877 | 12 | * |
ganlikun | 0:13413ea9a877 | 13 | @verbatim |
ganlikun | 0:13413ea9a877 | 14 | ============================================================================== |
ganlikun | 0:13413ea9a877 | 15 | ##### GPIO Peripheral features ##### |
ganlikun | 0:13413ea9a877 | 16 | ============================================================================== |
ganlikun | 0:13413ea9a877 | 17 | [..] |
ganlikun | 0:13413ea9a877 | 18 | Subject to the specific hardware characteristics of each I/O port listed in the datasheet, each |
ganlikun | 0:13413ea9a877 | 19 | port bit of the General Purpose IO (GPIO) Ports, can be individually configured by software |
ganlikun | 0:13413ea9a877 | 20 | in several modes: |
ganlikun | 0:13413ea9a877 | 21 | (+) Input mode |
ganlikun | 0:13413ea9a877 | 22 | (+) Analog mode |
ganlikun | 0:13413ea9a877 | 23 | (+) Output mode |
ganlikun | 0:13413ea9a877 | 24 | (+) Alternate function mode |
ganlikun | 0:13413ea9a877 | 25 | (+) External interrupt/event lines |
ganlikun | 0:13413ea9a877 | 26 | |
ganlikun | 0:13413ea9a877 | 27 | [..] |
ganlikun | 0:13413ea9a877 | 28 | During and just after reset, the alternate functions and external interrupt |
ganlikun | 0:13413ea9a877 | 29 | lines are not active and the I/O ports are configured in input floating mode. |
ganlikun | 0:13413ea9a877 | 30 | |
ganlikun | 0:13413ea9a877 | 31 | [..] |
ganlikun | 0:13413ea9a877 | 32 | All GPIO pins have weak internal pull-up and pull-down resistors, which can be |
ganlikun | 0:13413ea9a877 | 33 | activated or not. |
ganlikun | 0:13413ea9a877 | 34 | |
ganlikun | 0:13413ea9a877 | 35 | [..] |
ganlikun | 0:13413ea9a877 | 36 | In Output or Alternate mode, each IO can be configured on open-drain or push-pull |
ganlikun | 0:13413ea9a877 | 37 | type and the IO speed can be selected depending on the VDD value. |
ganlikun | 0:13413ea9a877 | 38 | |
ganlikun | 0:13413ea9a877 | 39 | [..] |
ganlikun | 0:13413ea9a877 | 40 | All ports have external interrupt/event capability. To use external interrupt |
ganlikun | 0:13413ea9a877 | 41 | lines, the port must be configured in input mode. All available GPIO pins are |
ganlikun | 0:13413ea9a877 | 42 | connected to the 16 external interrupt/event lines from EXTI0 to EXTI15. |
ganlikun | 0:13413ea9a877 | 43 | |
ganlikun | 0:13413ea9a877 | 44 | [..] |
ganlikun | 0:13413ea9a877 | 45 | The external interrupt/event controller consists of up to 23 edge detectors |
ganlikun | 0:13413ea9a877 | 46 | (16 lines are connected to GPIO) for generating event/interrupt requests (each |
ganlikun | 0:13413ea9a877 | 47 | input line can be independently configured to select the type (interrupt or event) |
ganlikun | 0:13413ea9a877 | 48 | and the corresponding trigger event (rising or falling or both). Each line can |
ganlikun | 0:13413ea9a877 | 49 | also be masked independently. |
ganlikun | 0:13413ea9a877 | 50 | |
ganlikun | 0:13413ea9a877 | 51 | ##### How to use this driver ##### |
ganlikun | 0:13413ea9a877 | 52 | ============================================================================== |
ganlikun | 0:13413ea9a877 | 53 | [..] |
ganlikun | 0:13413ea9a877 | 54 | (#) Enable the GPIO AHB clock using the following function: __HAL_RCC_GPIOx_CLK_ENABLE(). |
ganlikun | 0:13413ea9a877 | 55 | |
ganlikun | 0:13413ea9a877 | 56 | (#) Configure the GPIO pin(s) using HAL_GPIO_Init(). |
ganlikun | 0:13413ea9a877 | 57 | (++) Configure the IO mode using "Mode" member from GPIO_InitTypeDef structure |
ganlikun | 0:13413ea9a877 | 58 | (++) Activate Pull-up, Pull-down resistor using "Pull" member from GPIO_InitTypeDef |
ganlikun | 0:13413ea9a877 | 59 | structure. |
ganlikun | 0:13413ea9a877 | 60 | (++) In case of Output or alternate function mode selection: the speed is |
ganlikun | 0:13413ea9a877 | 61 | configured through "Speed" member from GPIO_InitTypeDef structure. |
ganlikun | 0:13413ea9a877 | 62 | (++) In alternate mode is selection, the alternate function connected to the IO |
ganlikun | 0:13413ea9a877 | 63 | is configured through "Alternate" member from GPIO_InitTypeDef structure. |
ganlikun | 0:13413ea9a877 | 64 | (++) Analog mode is required when a pin is to be used as ADC channel |
ganlikun | 0:13413ea9a877 | 65 | or DAC output. |
ganlikun | 0:13413ea9a877 | 66 | (++) In case of external interrupt/event selection the "Mode" member from |
ganlikun | 0:13413ea9a877 | 67 | GPIO_InitTypeDef structure select the type (interrupt or event) and |
ganlikun | 0:13413ea9a877 | 68 | the corresponding trigger event (rising or falling or both). |
ganlikun | 0:13413ea9a877 | 69 | |
ganlikun | 0:13413ea9a877 | 70 | (#) In case of external interrupt/event mode selection, configure NVIC IRQ priority |
ganlikun | 0:13413ea9a877 | 71 | mapped to the EXTI line using HAL_NVIC_SetPriority() and enable it using |
ganlikun | 0:13413ea9a877 | 72 | HAL_NVIC_EnableIRQ(). |
ganlikun | 0:13413ea9a877 | 73 | |
ganlikun | 0:13413ea9a877 | 74 | (#) To get the level of a pin configured in input mode use HAL_GPIO_ReadPin(). |
ganlikun | 0:13413ea9a877 | 75 | |
ganlikun | 0:13413ea9a877 | 76 | (#) To set/reset the level of a pin configured in output mode use |
ganlikun | 0:13413ea9a877 | 77 | HAL_GPIO_WritePin()/HAL_GPIO_TogglePin(). |
ganlikun | 0:13413ea9a877 | 78 | |
ganlikun | 0:13413ea9a877 | 79 | (#) To lock pin configuration until next reset use HAL_GPIO_LockPin(). |
ganlikun | 0:13413ea9a877 | 80 | |
ganlikun | 0:13413ea9a877 | 81 | |
ganlikun | 0:13413ea9a877 | 82 | (#) During and just after reset, the alternate functions are not |
ganlikun | 0:13413ea9a877 | 83 | active and the GPIO pins are configured in input floating mode (except JTAG |
ganlikun | 0:13413ea9a877 | 84 | pins). |
ganlikun | 0:13413ea9a877 | 85 | |
ganlikun | 0:13413ea9a877 | 86 | (#) The LSE oscillator pins OSC32_IN and OSC32_OUT can be used as general purpose |
ganlikun | 0:13413ea9a877 | 87 | (PC14 and PC15, respectively) when the LSE oscillator is off. The LSE has |
ganlikun | 0:13413ea9a877 | 88 | priority over the GPIO function. |
ganlikun | 0:13413ea9a877 | 89 | |
ganlikun | 0:13413ea9a877 | 90 | (#) The HSE oscillator pins OSC_IN/OSC_OUT can be used as |
ganlikun | 0:13413ea9a877 | 91 | general purpose PH0 and PH1, respectively, when the HSE oscillator is off. |
ganlikun | 0:13413ea9a877 | 92 | The HSE has priority over the GPIO function. |
ganlikun | 0:13413ea9a877 | 93 | |
ganlikun | 0:13413ea9a877 | 94 | @endverbatim |
ganlikun | 0:13413ea9a877 | 95 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 96 | * @attention |
ganlikun | 0:13413ea9a877 | 97 | * |
ganlikun | 0:13413ea9a877 | 98 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
ganlikun | 0:13413ea9a877 | 99 | * |
ganlikun | 0:13413ea9a877 | 100 | * Redistribution and use in source and binary forms, with or without modification, |
ganlikun | 0:13413ea9a877 | 101 | * are permitted provided that the following conditions are met: |
ganlikun | 0:13413ea9a877 | 102 | * 1. Redistributions of source code must retain the above copyright notice, |
ganlikun | 0:13413ea9a877 | 103 | * this list of conditions and the following disclaimer. |
ganlikun | 0:13413ea9a877 | 104 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
ganlikun | 0:13413ea9a877 | 105 | * this list of conditions and the following disclaimer in the documentation |
ganlikun | 0:13413ea9a877 | 106 | * and/or other materials provided with the distribution. |
ganlikun | 0:13413ea9a877 | 107 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
ganlikun | 0:13413ea9a877 | 108 | * may be used to endorse or promote products derived from this software |
ganlikun | 0:13413ea9a877 | 109 | * without specific prior written permission. |
ganlikun | 0:13413ea9a877 | 110 | * |
ganlikun | 0:13413ea9a877 | 111 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
ganlikun | 0:13413ea9a877 | 112 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
ganlikun | 0:13413ea9a877 | 113 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
ganlikun | 0:13413ea9a877 | 114 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
ganlikun | 0:13413ea9a877 | 115 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
ganlikun | 0:13413ea9a877 | 116 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
ganlikun | 0:13413ea9a877 | 117 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
ganlikun | 0:13413ea9a877 | 118 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
ganlikun | 0:13413ea9a877 | 119 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
ganlikun | 0:13413ea9a877 | 120 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
ganlikun | 0:13413ea9a877 | 121 | * |
ganlikun | 0:13413ea9a877 | 122 | ****************************************************************************** |
ganlikun | 0:13413ea9a877 | 123 | */ |
ganlikun | 0:13413ea9a877 | 124 | |
ganlikun | 0:13413ea9a877 | 125 | /* Includes ------------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 126 | #include "stm32f4xx_hal.h" |
ganlikun | 0:13413ea9a877 | 127 | |
ganlikun | 0:13413ea9a877 | 128 | /** @addtogroup STM32F4xx_HAL_Driver |
ganlikun | 0:13413ea9a877 | 129 | * @{ |
ganlikun | 0:13413ea9a877 | 130 | */ |
ganlikun | 0:13413ea9a877 | 131 | |
ganlikun | 0:13413ea9a877 | 132 | /** @defgroup GPIO GPIO |
ganlikun | 0:13413ea9a877 | 133 | * @brief GPIO HAL module driver |
ganlikun | 0:13413ea9a877 | 134 | * @{ |
ganlikun | 0:13413ea9a877 | 135 | */ |
ganlikun | 0:13413ea9a877 | 136 | |
ganlikun | 0:13413ea9a877 | 137 | #ifdef HAL_GPIO_MODULE_ENABLED |
ganlikun | 0:13413ea9a877 | 138 | |
ganlikun | 0:13413ea9a877 | 139 | /* Private typedef -----------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 140 | /* Private define ------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 141 | /** @addtogroup GPIO_Private_Constants GPIO Private Constants |
ganlikun | 0:13413ea9a877 | 142 | * @{ |
ganlikun | 0:13413ea9a877 | 143 | */ |
ganlikun | 0:13413ea9a877 | 144 | #define GPIO_MODE 0x00000003U |
ganlikun | 0:13413ea9a877 | 145 | #define EXTI_MODE 0x10000000U |
ganlikun | 0:13413ea9a877 | 146 | #define GPIO_MODE_IT 0x00010000U |
ganlikun | 0:13413ea9a877 | 147 | #define GPIO_MODE_EVT 0x00020000U |
ganlikun | 0:13413ea9a877 | 148 | #define RISING_EDGE 0x00100000U |
ganlikun | 0:13413ea9a877 | 149 | #define FALLING_EDGE 0x00200000U |
ganlikun | 0:13413ea9a877 | 150 | #define GPIO_OUTPUT_TYPE 0x00000010U |
ganlikun | 0:13413ea9a877 | 151 | |
ganlikun | 0:13413ea9a877 | 152 | #define GPIO_NUMBER 16U |
ganlikun | 0:13413ea9a877 | 153 | /** |
ganlikun | 0:13413ea9a877 | 154 | * @} |
ganlikun | 0:13413ea9a877 | 155 | */ |
ganlikun | 0:13413ea9a877 | 156 | /* Private macro -------------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 157 | /* Private variables ---------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 158 | /* Private function prototypes -----------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 159 | /* Private functions ---------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 160 | /* Exported functions --------------------------------------------------------*/ |
ganlikun | 0:13413ea9a877 | 161 | /** @defgroup GPIO_Exported_Functions GPIO Exported Functions |
ganlikun | 0:13413ea9a877 | 162 | * @{ |
ganlikun | 0:13413ea9a877 | 163 | */ |
ganlikun | 0:13413ea9a877 | 164 | |
ganlikun | 0:13413ea9a877 | 165 | /** @defgroup GPIO_Exported_Functions_Group1 Initialization and de-initialization functions |
ganlikun | 0:13413ea9a877 | 166 | * @brief Initialization and Configuration functions |
ganlikun | 0:13413ea9a877 | 167 | * |
ganlikun | 0:13413ea9a877 | 168 | @verbatim |
ganlikun | 0:13413ea9a877 | 169 | =============================================================================== |
ganlikun | 0:13413ea9a877 | 170 | ##### Initialization and de-initialization functions ##### |
ganlikun | 0:13413ea9a877 | 171 | =============================================================================== |
ganlikun | 0:13413ea9a877 | 172 | [..] |
ganlikun | 0:13413ea9a877 | 173 | This section provides functions allowing to initialize and de-initialize the GPIOs |
ganlikun | 0:13413ea9a877 | 174 | to be ready for use. |
ganlikun | 0:13413ea9a877 | 175 | |
ganlikun | 0:13413ea9a877 | 176 | @endverbatim |
ganlikun | 0:13413ea9a877 | 177 | * @{ |
ganlikun | 0:13413ea9a877 | 178 | */ |
ganlikun | 0:13413ea9a877 | 179 | |
ganlikun | 0:13413ea9a877 | 180 | |
ganlikun | 0:13413ea9a877 | 181 | /** |
ganlikun | 0:13413ea9a877 | 182 | * @brief Initializes the GPIOx peripheral according to the specified parameters in the GPIO_Init. |
ganlikun | 0:13413ea9a877 | 183 | * @param GPIOx: where x can be (A..K) to select the GPIO peripheral for STM32F429X device or |
ganlikun | 0:13413ea9a877 | 184 | * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. |
ganlikun | 0:13413ea9a877 | 185 | * @param GPIO_Init: pointer to a GPIO_InitTypeDef structure that contains |
ganlikun | 0:13413ea9a877 | 186 | * the configuration information for the specified GPIO peripheral. |
ganlikun | 0:13413ea9a877 | 187 | * @retval None |
ganlikun | 0:13413ea9a877 | 188 | */ |
ganlikun | 0:13413ea9a877 | 189 | void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init) |
ganlikun | 0:13413ea9a877 | 190 | { |
ganlikun | 0:13413ea9a877 | 191 | uint32_t position; |
ganlikun | 0:13413ea9a877 | 192 | uint32_t ioposition = 0x00U; |
ganlikun | 0:13413ea9a877 | 193 | uint32_t iocurrent = 0x00U; |
ganlikun | 0:13413ea9a877 | 194 | uint32_t temp = 0x00U; |
ganlikun | 0:13413ea9a877 | 195 | |
ganlikun | 0:13413ea9a877 | 196 | /* Check the parameters */ |
ganlikun | 0:13413ea9a877 | 197 | assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); |
ganlikun | 0:13413ea9a877 | 198 | assert_param(IS_GPIO_PIN(GPIO_Init->Pin)); |
ganlikun | 0:13413ea9a877 | 199 | assert_param(IS_GPIO_MODE(GPIO_Init->Mode)); |
ganlikun | 0:13413ea9a877 | 200 | assert_param(IS_GPIO_PULL(GPIO_Init->Pull)); |
ganlikun | 0:13413ea9a877 | 201 | |
ganlikun | 0:13413ea9a877 | 202 | /* Configure the port pins */ |
ganlikun | 0:13413ea9a877 | 203 | for(position = 0U; position < GPIO_NUMBER; position++) |
ganlikun | 0:13413ea9a877 | 204 | { |
ganlikun | 0:13413ea9a877 | 205 | /* Get the IO position */ |
ganlikun | 0:13413ea9a877 | 206 | ioposition = 0x01U << position; |
ganlikun | 0:13413ea9a877 | 207 | /* Get the current IO position */ |
ganlikun | 0:13413ea9a877 | 208 | iocurrent = (uint32_t)(GPIO_Init->Pin) & ioposition; |
ganlikun | 0:13413ea9a877 | 209 | |
ganlikun | 0:13413ea9a877 | 210 | if(iocurrent == ioposition) |
ganlikun | 0:13413ea9a877 | 211 | { |
ganlikun | 0:13413ea9a877 | 212 | /*--------------------- GPIO Mode Configuration ------------------------*/ |
ganlikun | 0:13413ea9a877 | 213 | /* In case of Alternate function mode selection */ |
ganlikun | 0:13413ea9a877 | 214 | if((GPIO_Init->Mode == GPIO_MODE_AF_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_OD)) |
ganlikun | 0:13413ea9a877 | 215 | { |
ganlikun | 0:13413ea9a877 | 216 | /* Check the Alternate function parameter */ |
ganlikun | 0:13413ea9a877 | 217 | assert_param(IS_GPIO_AF(GPIO_Init->Alternate)); |
ganlikun | 0:13413ea9a877 | 218 | /* Configure Alternate function mapped with the current IO */ |
ganlikun | 0:13413ea9a877 | 219 | temp = GPIOx->AFR[position >> 3U]; |
ganlikun | 0:13413ea9a877 | 220 | temp &= ~(0xFU << ((uint32_t)(position & 0x07U) * 4U)) ; |
ganlikun | 0:13413ea9a877 | 221 | temp |= ((uint32_t)(GPIO_Init->Alternate) << (((uint32_t)position & 0x07U) * 4U)); |
ganlikun | 0:13413ea9a877 | 222 | GPIOx->AFR[position >> 3U] = temp; |
ganlikun | 0:13413ea9a877 | 223 | } |
ganlikun | 0:13413ea9a877 | 224 | |
ganlikun | 0:13413ea9a877 | 225 | /* Configure IO Direction mode (Input, Output, Alternate or Analog) */ |
ganlikun | 0:13413ea9a877 | 226 | temp = GPIOx->MODER; |
ganlikun | 0:13413ea9a877 | 227 | temp &= ~(GPIO_MODER_MODER0 << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 228 | temp |= ((GPIO_Init->Mode & GPIO_MODE) << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 229 | GPIOx->MODER = temp; |
ganlikun | 0:13413ea9a877 | 230 | |
ganlikun | 0:13413ea9a877 | 231 | /* In case of Output or Alternate function mode selection */ |
ganlikun | 0:13413ea9a877 | 232 | if((GPIO_Init->Mode == GPIO_MODE_OUTPUT_PP) || (GPIO_Init->Mode == GPIO_MODE_AF_PP) || |
ganlikun | 0:13413ea9a877 | 233 | (GPIO_Init->Mode == GPIO_MODE_OUTPUT_OD) || (GPIO_Init->Mode == GPIO_MODE_AF_OD)) |
ganlikun | 0:13413ea9a877 | 234 | { |
ganlikun | 0:13413ea9a877 | 235 | /* Check the Speed parameter */ |
ganlikun | 0:13413ea9a877 | 236 | assert_param(IS_GPIO_SPEED(GPIO_Init->Speed)); |
ganlikun | 0:13413ea9a877 | 237 | /* Configure the IO Speed */ |
ganlikun | 0:13413ea9a877 | 238 | temp = GPIOx->OSPEEDR; |
ganlikun | 0:13413ea9a877 | 239 | temp &= ~(GPIO_OSPEEDER_OSPEEDR0 << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 240 | temp |= (GPIO_Init->Speed << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 241 | GPIOx->OSPEEDR = temp; |
ganlikun | 0:13413ea9a877 | 242 | |
ganlikun | 0:13413ea9a877 | 243 | /* Configure the IO Output Type */ |
ganlikun | 0:13413ea9a877 | 244 | temp = GPIOx->OTYPER; |
ganlikun | 0:13413ea9a877 | 245 | temp &= ~(GPIO_OTYPER_OT_0 << position) ; |
ganlikun | 0:13413ea9a877 | 246 | temp |= (((GPIO_Init->Mode & GPIO_OUTPUT_TYPE) >> 4U) << position); |
ganlikun | 0:13413ea9a877 | 247 | GPIOx->OTYPER = temp; |
ganlikun | 0:13413ea9a877 | 248 | } |
ganlikun | 0:13413ea9a877 | 249 | |
ganlikun | 0:13413ea9a877 | 250 | /* Activate the Pull-up or Pull down resistor for the current IO */ |
ganlikun | 0:13413ea9a877 | 251 | temp = GPIOx->PUPDR; |
ganlikun | 0:13413ea9a877 | 252 | temp &= ~(GPIO_PUPDR_PUPDR0 << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 253 | temp |= ((GPIO_Init->Pull) << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 254 | GPIOx->PUPDR = temp; |
ganlikun | 0:13413ea9a877 | 255 | |
ganlikun | 0:13413ea9a877 | 256 | /*--------------------- EXTI Mode Configuration ------------------------*/ |
ganlikun | 0:13413ea9a877 | 257 | /* Configure the External Interrupt or event for the current IO */ |
ganlikun | 0:13413ea9a877 | 258 | if((GPIO_Init->Mode & EXTI_MODE) == EXTI_MODE) |
ganlikun | 0:13413ea9a877 | 259 | { |
ganlikun | 0:13413ea9a877 | 260 | /* Enable SYSCFG Clock */ |
ganlikun | 0:13413ea9a877 | 261 | __HAL_RCC_SYSCFG_CLK_ENABLE(); |
ganlikun | 0:13413ea9a877 | 262 | |
ganlikun | 0:13413ea9a877 | 263 | temp = SYSCFG->EXTICR[position >> 2U]; |
ganlikun | 0:13413ea9a877 | 264 | temp &= ~(0x0FU << (4U * (position & 0x03U))); |
ganlikun | 0:13413ea9a877 | 265 | temp |= ((uint32_t)(GPIO_GET_INDEX(GPIOx)) << (4U * (position & 0x03U))); |
ganlikun | 0:13413ea9a877 | 266 | SYSCFG->EXTICR[position >> 2U] = temp; |
ganlikun | 0:13413ea9a877 | 267 | |
ganlikun | 0:13413ea9a877 | 268 | /* Clear EXTI line configuration */ |
ganlikun | 0:13413ea9a877 | 269 | temp = EXTI->IMR; |
ganlikun | 0:13413ea9a877 | 270 | temp &= ~((uint32_t)iocurrent); |
ganlikun | 0:13413ea9a877 | 271 | if((GPIO_Init->Mode & GPIO_MODE_IT) == GPIO_MODE_IT) |
ganlikun | 0:13413ea9a877 | 272 | { |
ganlikun | 0:13413ea9a877 | 273 | temp |= iocurrent; |
ganlikun | 0:13413ea9a877 | 274 | } |
ganlikun | 0:13413ea9a877 | 275 | EXTI->IMR = temp; |
ganlikun | 0:13413ea9a877 | 276 | |
ganlikun | 0:13413ea9a877 | 277 | temp = EXTI->EMR; |
ganlikun | 0:13413ea9a877 | 278 | temp &= ~((uint32_t)iocurrent); |
ganlikun | 0:13413ea9a877 | 279 | if((GPIO_Init->Mode & GPIO_MODE_EVT) == GPIO_MODE_EVT) |
ganlikun | 0:13413ea9a877 | 280 | { |
ganlikun | 0:13413ea9a877 | 281 | temp |= iocurrent; |
ganlikun | 0:13413ea9a877 | 282 | } |
ganlikun | 0:13413ea9a877 | 283 | EXTI->EMR = temp; |
ganlikun | 0:13413ea9a877 | 284 | |
ganlikun | 0:13413ea9a877 | 285 | /* Clear Rising Falling edge configuration */ |
ganlikun | 0:13413ea9a877 | 286 | temp = EXTI->RTSR; |
ganlikun | 0:13413ea9a877 | 287 | temp &= ~((uint32_t)iocurrent); |
ganlikun | 0:13413ea9a877 | 288 | if((GPIO_Init->Mode & RISING_EDGE) == RISING_EDGE) |
ganlikun | 0:13413ea9a877 | 289 | { |
ganlikun | 0:13413ea9a877 | 290 | temp |= iocurrent; |
ganlikun | 0:13413ea9a877 | 291 | } |
ganlikun | 0:13413ea9a877 | 292 | EXTI->RTSR = temp; |
ganlikun | 0:13413ea9a877 | 293 | |
ganlikun | 0:13413ea9a877 | 294 | temp = EXTI->FTSR; |
ganlikun | 0:13413ea9a877 | 295 | temp &= ~((uint32_t)iocurrent); |
ganlikun | 0:13413ea9a877 | 296 | if((GPIO_Init->Mode & FALLING_EDGE) == FALLING_EDGE) |
ganlikun | 0:13413ea9a877 | 297 | { |
ganlikun | 0:13413ea9a877 | 298 | temp |= iocurrent; |
ganlikun | 0:13413ea9a877 | 299 | } |
ganlikun | 0:13413ea9a877 | 300 | EXTI->FTSR = temp; |
ganlikun | 0:13413ea9a877 | 301 | } |
ganlikun | 0:13413ea9a877 | 302 | } |
ganlikun | 0:13413ea9a877 | 303 | } |
ganlikun | 0:13413ea9a877 | 304 | } |
ganlikun | 0:13413ea9a877 | 305 | |
ganlikun | 0:13413ea9a877 | 306 | /** |
ganlikun | 0:13413ea9a877 | 307 | * @brief De-initializes the GPIOx peripheral registers to their default reset values. |
ganlikun | 0:13413ea9a877 | 308 | * @param GPIOx: where x can be (A..K) to select the GPIO peripheral for STM32F429X device or |
ganlikun | 0:13413ea9a877 | 309 | * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. |
ganlikun | 0:13413ea9a877 | 310 | * @param GPIO_Pin: specifies the port bit to be written. |
ganlikun | 0:13413ea9a877 | 311 | * This parameter can be one of GPIO_PIN_x where x can be (0..15). |
ganlikun | 0:13413ea9a877 | 312 | * @retval None |
ganlikun | 0:13413ea9a877 | 313 | */ |
ganlikun | 0:13413ea9a877 | 314 | void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin) |
ganlikun | 0:13413ea9a877 | 315 | { |
ganlikun | 0:13413ea9a877 | 316 | uint32_t position; |
ganlikun | 0:13413ea9a877 | 317 | uint32_t ioposition = 0x00U; |
ganlikun | 0:13413ea9a877 | 318 | uint32_t iocurrent = 0x00U; |
ganlikun | 0:13413ea9a877 | 319 | uint32_t tmp = 0x00U; |
ganlikun | 0:13413ea9a877 | 320 | |
ganlikun | 0:13413ea9a877 | 321 | /* Check the parameters */ |
ganlikun | 0:13413ea9a877 | 322 | assert_param(IS_GPIO_ALL_INSTANCE(GPIOx)); |
ganlikun | 0:13413ea9a877 | 323 | |
ganlikun | 0:13413ea9a877 | 324 | /* Configure the port pins */ |
ganlikun | 0:13413ea9a877 | 325 | for(position = 0U; position < GPIO_NUMBER; position++) |
ganlikun | 0:13413ea9a877 | 326 | { |
ganlikun | 0:13413ea9a877 | 327 | /* Get the IO position */ |
ganlikun | 0:13413ea9a877 | 328 | ioposition = 0x01U << position; |
ganlikun | 0:13413ea9a877 | 329 | /* Get the current IO position */ |
ganlikun | 0:13413ea9a877 | 330 | iocurrent = (GPIO_Pin) & ioposition; |
ganlikun | 0:13413ea9a877 | 331 | |
ganlikun | 0:13413ea9a877 | 332 | if(iocurrent == ioposition) |
ganlikun | 0:13413ea9a877 | 333 | { |
ganlikun | 0:13413ea9a877 | 334 | /*------------------------- GPIO Mode Configuration --------------------*/ |
ganlikun | 0:13413ea9a877 | 335 | /* Configure IO Direction in Input Floating Mode */ |
ganlikun | 0:13413ea9a877 | 336 | GPIOx->MODER &= ~(GPIO_MODER_MODER0 << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 337 | |
ganlikun | 0:13413ea9a877 | 338 | /* Configure the default Alternate Function in current IO */ |
ganlikun | 0:13413ea9a877 | 339 | GPIOx->AFR[position >> 3U] &= ~(0xFU << ((uint32_t)(position & 0x07U) * 4U)) ; |
ganlikun | 0:13413ea9a877 | 340 | |
ganlikun | 0:13413ea9a877 | 341 | /* Configure the default value for IO Speed */ |
ganlikun | 0:13413ea9a877 | 342 | GPIOx->OSPEEDR &= ~(GPIO_OSPEEDER_OSPEEDR0 << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 343 | |
ganlikun | 0:13413ea9a877 | 344 | /* Configure the default value IO Output Type */ |
ganlikun | 0:13413ea9a877 | 345 | GPIOx->OTYPER &= ~(GPIO_OTYPER_OT_0 << position) ; |
ganlikun | 0:13413ea9a877 | 346 | |
ganlikun | 0:13413ea9a877 | 347 | /* Deactivate the Pull-up and Pull-down resistor for the current IO */ |
ganlikun | 0:13413ea9a877 | 348 | GPIOx->PUPDR &= ~(GPIO_PUPDR_PUPDR0 << (position * 2U)); |
ganlikun | 0:13413ea9a877 | 349 | |
ganlikun | 0:13413ea9a877 | 350 | /*------------------------- EXTI Mode Configuration --------------------*/ |
ganlikun | 0:13413ea9a877 | 351 | tmp = SYSCFG->EXTICR[position >> 2U]; |
ganlikun | 0:13413ea9a877 | 352 | tmp &= (0x0FU << (4U * (position & 0x03U))); |
ganlikun | 0:13413ea9a877 | 353 | if(tmp == ((uint32_t)(GPIO_GET_INDEX(GPIOx)) << (4U * (position & 0x03U)))) |
ganlikun | 0:13413ea9a877 | 354 | { |
ganlikun | 0:13413ea9a877 | 355 | /* Configure the External Interrupt or event for the current IO */ |
ganlikun | 0:13413ea9a877 | 356 | tmp = 0x0FU << (4U * (position & 0x03U)); |
ganlikun | 0:13413ea9a877 | 357 | SYSCFG->EXTICR[position >> 2U] &= ~tmp; |
ganlikun | 0:13413ea9a877 | 358 | |
ganlikun | 0:13413ea9a877 | 359 | /* Clear EXTI line configuration */ |
ganlikun | 0:13413ea9a877 | 360 | EXTI->IMR &= ~((uint32_t)iocurrent); |
ganlikun | 0:13413ea9a877 | 361 | EXTI->EMR &= ~((uint32_t)iocurrent); |
ganlikun | 0:13413ea9a877 | 362 | |
ganlikun | 0:13413ea9a877 | 363 | /* Clear Rising Falling edge configuration */ |
ganlikun | 0:13413ea9a877 | 364 | EXTI->RTSR &= ~((uint32_t)iocurrent); |
ganlikun | 0:13413ea9a877 | 365 | EXTI->FTSR &= ~((uint32_t)iocurrent); |
ganlikun | 0:13413ea9a877 | 366 | } |
ganlikun | 0:13413ea9a877 | 367 | } |
ganlikun | 0:13413ea9a877 | 368 | } |
ganlikun | 0:13413ea9a877 | 369 | } |
ganlikun | 0:13413ea9a877 | 370 | |
ganlikun | 0:13413ea9a877 | 371 | /** |
ganlikun | 0:13413ea9a877 | 372 | * @} |
ganlikun | 0:13413ea9a877 | 373 | */ |
ganlikun | 0:13413ea9a877 | 374 | |
ganlikun | 0:13413ea9a877 | 375 | /** @defgroup GPIO_Exported_Functions_Group2 IO operation functions |
ganlikun | 0:13413ea9a877 | 376 | * @brief GPIO Read and Write |
ganlikun | 0:13413ea9a877 | 377 | * |
ganlikun | 0:13413ea9a877 | 378 | @verbatim |
ganlikun | 0:13413ea9a877 | 379 | =============================================================================== |
ganlikun | 0:13413ea9a877 | 380 | ##### IO operation functions ##### |
ganlikun | 0:13413ea9a877 | 381 | =============================================================================== |
ganlikun | 0:13413ea9a877 | 382 | |
ganlikun | 0:13413ea9a877 | 383 | @endverbatim |
ganlikun | 0:13413ea9a877 | 384 | * @{ |
ganlikun | 0:13413ea9a877 | 385 | */ |
ganlikun | 0:13413ea9a877 | 386 | |
ganlikun | 0:13413ea9a877 | 387 | /** |
ganlikun | 0:13413ea9a877 | 388 | * @brief Reads the specified input port pin. |
ganlikun | 0:13413ea9a877 | 389 | * @param GPIOx: where x can be (A..K) to select the GPIO peripheral for STM32F429X device or |
ganlikun | 0:13413ea9a877 | 390 | * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. |
ganlikun | 0:13413ea9a877 | 391 | * @param GPIO_Pin: specifies the port bit to read. |
ganlikun | 0:13413ea9a877 | 392 | * This parameter can be GPIO_PIN_x where x can be (0..15). |
ganlikun | 0:13413ea9a877 | 393 | * @retval The input port pin value. |
ganlikun | 0:13413ea9a877 | 394 | */ |
ganlikun | 0:13413ea9a877 | 395 | GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) |
ganlikun | 0:13413ea9a877 | 396 | { |
ganlikun | 0:13413ea9a877 | 397 | GPIO_PinState bitstatus; |
ganlikun | 0:13413ea9a877 | 398 | |
ganlikun | 0:13413ea9a877 | 399 | /* Check the parameters */ |
ganlikun | 0:13413ea9a877 | 400 | assert_param(IS_GPIO_PIN(GPIO_Pin)); |
ganlikun | 0:13413ea9a877 | 401 | |
ganlikun | 0:13413ea9a877 | 402 | if((GPIOx->IDR & GPIO_Pin) != (uint32_t)GPIO_PIN_RESET) |
ganlikun | 0:13413ea9a877 | 403 | { |
ganlikun | 0:13413ea9a877 | 404 | bitstatus = GPIO_PIN_SET; |
ganlikun | 0:13413ea9a877 | 405 | } |
ganlikun | 0:13413ea9a877 | 406 | else |
ganlikun | 0:13413ea9a877 | 407 | { |
ganlikun | 0:13413ea9a877 | 408 | bitstatus = GPIO_PIN_RESET; |
ganlikun | 0:13413ea9a877 | 409 | } |
ganlikun | 0:13413ea9a877 | 410 | return bitstatus; |
ganlikun | 0:13413ea9a877 | 411 | } |
ganlikun | 0:13413ea9a877 | 412 | |
ganlikun | 0:13413ea9a877 | 413 | /** |
ganlikun | 0:13413ea9a877 | 414 | * @brief Sets or clears the selected data port bit. |
ganlikun | 0:13413ea9a877 | 415 | * |
ganlikun | 0:13413ea9a877 | 416 | * @note This function uses GPIOx_BSRR register to allow atomic read/modify |
ganlikun | 0:13413ea9a877 | 417 | * accesses. In this way, there is no risk of an IRQ occurring between |
ganlikun | 0:13413ea9a877 | 418 | * the read and the modify access. |
ganlikun | 0:13413ea9a877 | 419 | * |
ganlikun | 0:13413ea9a877 | 420 | * @param GPIOx: where x can be (A..K) to select the GPIO peripheral for STM32F429X device or |
ganlikun | 0:13413ea9a877 | 421 | * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. |
ganlikun | 0:13413ea9a877 | 422 | * @param GPIO_Pin: specifies the port bit to be written. |
ganlikun | 0:13413ea9a877 | 423 | * This parameter can be one of GPIO_PIN_x where x can be (0..15). |
ganlikun | 0:13413ea9a877 | 424 | * @param PinState: specifies the value to be written to the selected bit. |
ganlikun | 0:13413ea9a877 | 425 | * This parameter can be one of the GPIO_PinState enum values: |
ganlikun | 0:13413ea9a877 | 426 | * @arg GPIO_PIN_RESET: to clear the port pin |
ganlikun | 0:13413ea9a877 | 427 | * @arg GPIO_PIN_SET: to set the port pin |
ganlikun | 0:13413ea9a877 | 428 | * @retval None |
ganlikun | 0:13413ea9a877 | 429 | */ |
ganlikun | 0:13413ea9a877 | 430 | void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState) |
ganlikun | 0:13413ea9a877 | 431 | { |
ganlikun | 0:13413ea9a877 | 432 | /* Check the parameters */ |
ganlikun | 0:13413ea9a877 | 433 | assert_param(IS_GPIO_PIN(GPIO_Pin)); |
ganlikun | 0:13413ea9a877 | 434 | assert_param(IS_GPIO_PIN_ACTION(PinState)); |
ganlikun | 0:13413ea9a877 | 435 | |
ganlikun | 0:13413ea9a877 | 436 | if(PinState != GPIO_PIN_RESET) |
ganlikun | 0:13413ea9a877 | 437 | { |
ganlikun | 0:13413ea9a877 | 438 | GPIOx->BSRR = GPIO_Pin; |
ganlikun | 0:13413ea9a877 | 439 | } |
ganlikun | 0:13413ea9a877 | 440 | else |
ganlikun | 0:13413ea9a877 | 441 | { |
ganlikun | 0:13413ea9a877 | 442 | GPIOx->BSRR = (uint32_t)GPIO_Pin << 16U; |
ganlikun | 0:13413ea9a877 | 443 | } |
ganlikun | 0:13413ea9a877 | 444 | } |
ganlikun | 0:13413ea9a877 | 445 | |
ganlikun | 0:13413ea9a877 | 446 | /** |
ganlikun | 0:13413ea9a877 | 447 | * @brief Toggles the specified GPIO pins. |
ganlikun | 0:13413ea9a877 | 448 | * @param GPIOx: Where x can be (A..K) to select the GPIO peripheral for STM32F429X device or |
ganlikun | 0:13413ea9a877 | 449 | * x can be (A..I) to select the GPIO peripheral for STM32F40XX and STM32F427X devices. |
ganlikun | 0:13413ea9a877 | 450 | * @param GPIO_Pin: Specifies the pins to be toggled. |
ganlikun | 0:13413ea9a877 | 451 | * @retval None |
ganlikun | 0:13413ea9a877 | 452 | */ |
ganlikun | 0:13413ea9a877 | 453 | void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) |
ganlikun | 0:13413ea9a877 | 454 | { |
ganlikun | 0:13413ea9a877 | 455 | /* Check the parameters */ |
ganlikun | 0:13413ea9a877 | 456 | assert_param(IS_GPIO_PIN(GPIO_Pin)); |
ganlikun | 0:13413ea9a877 | 457 | |
ganlikun | 0:13413ea9a877 | 458 | GPIOx->ODR ^= GPIO_Pin; |
ganlikun | 0:13413ea9a877 | 459 | } |
ganlikun | 0:13413ea9a877 | 460 | |
ganlikun | 0:13413ea9a877 | 461 | /** |
ganlikun | 0:13413ea9a877 | 462 | * @brief Locks GPIO Pins configuration registers. |
ganlikun | 0:13413ea9a877 | 463 | * @note The locked registers are GPIOx_MODER, GPIOx_OTYPER, GPIOx_OSPEEDR, |
ganlikun | 0:13413ea9a877 | 464 | * GPIOx_PUPDR, GPIOx_AFRL and GPIOx_AFRH. |
ganlikun | 0:13413ea9a877 | 465 | * @note The configuration of the locked GPIO pins can no longer be modified |
ganlikun | 0:13413ea9a877 | 466 | * until the next reset. |
ganlikun | 0:13413ea9a877 | 467 | * @param GPIOx: where x can be (A..F) to select the GPIO peripheral for STM32F4 family |
ganlikun | 0:13413ea9a877 | 468 | * @param GPIO_Pin: specifies the port bit to be locked. |
ganlikun | 0:13413ea9a877 | 469 | * This parameter can be any combination of GPIO_PIN_x where x can be (0..15). |
ganlikun | 0:13413ea9a877 | 470 | * @retval None |
ganlikun | 0:13413ea9a877 | 471 | */ |
ganlikun | 0:13413ea9a877 | 472 | HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin) |
ganlikun | 0:13413ea9a877 | 473 | { |
ganlikun | 0:13413ea9a877 | 474 | __IO uint32_t tmp = GPIO_LCKR_LCKK; |
ganlikun | 0:13413ea9a877 | 475 | |
ganlikun | 0:13413ea9a877 | 476 | /* Check the parameters */ |
ganlikun | 0:13413ea9a877 | 477 | assert_param(IS_GPIO_PIN(GPIO_Pin)); |
ganlikun | 0:13413ea9a877 | 478 | |
ganlikun | 0:13413ea9a877 | 479 | /* Apply lock key write sequence */ |
ganlikun | 0:13413ea9a877 | 480 | tmp |= GPIO_Pin; |
ganlikun | 0:13413ea9a877 | 481 | /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */ |
ganlikun | 0:13413ea9a877 | 482 | GPIOx->LCKR = tmp; |
ganlikun | 0:13413ea9a877 | 483 | /* Reset LCKx bit(s): LCKK='0' + LCK[15-0] */ |
ganlikun | 0:13413ea9a877 | 484 | GPIOx->LCKR = GPIO_Pin; |
ganlikun | 0:13413ea9a877 | 485 | /* Set LCKx bit(s): LCKK='1' + LCK[15-0] */ |
ganlikun | 0:13413ea9a877 | 486 | GPIOx->LCKR = tmp; |
ganlikun | 0:13413ea9a877 | 487 | /* Read LCKK bit*/ |
ganlikun | 0:13413ea9a877 | 488 | tmp = GPIOx->LCKR; |
ganlikun | 0:13413ea9a877 | 489 | |
ganlikun | 0:13413ea9a877 | 490 | if((GPIOx->LCKR & GPIO_LCKR_LCKK) != RESET) |
ganlikun | 0:13413ea9a877 | 491 | { |
ganlikun | 0:13413ea9a877 | 492 | return HAL_OK; |
ganlikun | 0:13413ea9a877 | 493 | } |
ganlikun | 0:13413ea9a877 | 494 | else |
ganlikun | 0:13413ea9a877 | 495 | { |
ganlikun | 0:13413ea9a877 | 496 | return HAL_ERROR; |
ganlikun | 0:13413ea9a877 | 497 | } |
ganlikun | 0:13413ea9a877 | 498 | } |
ganlikun | 0:13413ea9a877 | 499 | |
ganlikun | 0:13413ea9a877 | 500 | /** |
ganlikun | 0:13413ea9a877 | 501 | * @brief This function handles EXTI interrupt request. |
ganlikun | 0:13413ea9a877 | 502 | * @param GPIO_Pin: Specifies the pins connected EXTI line |
ganlikun | 0:13413ea9a877 | 503 | * @retval None |
ganlikun | 0:13413ea9a877 | 504 | */ |
ganlikun | 0:13413ea9a877 | 505 | void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin) |
ganlikun | 0:13413ea9a877 | 506 | { |
ganlikun | 0:13413ea9a877 | 507 | /* EXTI line interrupt detected */ |
ganlikun | 0:13413ea9a877 | 508 | if(__HAL_GPIO_EXTI_GET_IT(GPIO_Pin) != RESET) |
ganlikun | 0:13413ea9a877 | 509 | { |
ganlikun | 0:13413ea9a877 | 510 | __HAL_GPIO_EXTI_CLEAR_IT(GPIO_Pin); |
ganlikun | 0:13413ea9a877 | 511 | HAL_GPIO_EXTI_Callback(GPIO_Pin); |
ganlikun | 0:13413ea9a877 | 512 | } |
ganlikun | 0:13413ea9a877 | 513 | } |
ganlikun | 0:13413ea9a877 | 514 | |
ganlikun | 0:13413ea9a877 | 515 | /** |
ganlikun | 0:13413ea9a877 | 516 | * @brief EXTI line detection callbacks. |
ganlikun | 0:13413ea9a877 | 517 | * @param GPIO_Pin: Specifies the pins connected EXTI line |
ganlikun | 0:13413ea9a877 | 518 | * @retval None |
ganlikun | 0:13413ea9a877 | 519 | */ |
ganlikun | 0:13413ea9a877 | 520 | __weak void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) |
ganlikun | 0:13413ea9a877 | 521 | { |
ganlikun | 0:13413ea9a877 | 522 | /* Prevent unused argument(s) compilation warning */ |
ganlikun | 0:13413ea9a877 | 523 | UNUSED(GPIO_Pin); |
ganlikun | 0:13413ea9a877 | 524 | /* NOTE: This function Should not be modified, when the callback is needed, |
ganlikun | 0:13413ea9a877 | 525 | the HAL_GPIO_EXTI_Callback could be implemented in the user file |
ganlikun | 0:13413ea9a877 | 526 | */ |
ganlikun | 0:13413ea9a877 | 527 | } |
ganlikun | 0:13413ea9a877 | 528 | |
ganlikun | 0:13413ea9a877 | 529 | /** |
ganlikun | 0:13413ea9a877 | 530 | * @} |
ganlikun | 0:13413ea9a877 | 531 | */ |
ganlikun | 0:13413ea9a877 | 532 | |
ganlikun | 0:13413ea9a877 | 533 | |
ganlikun | 0:13413ea9a877 | 534 | /** |
ganlikun | 0:13413ea9a877 | 535 | * @} |
ganlikun | 0:13413ea9a877 | 536 | */ |
ganlikun | 0:13413ea9a877 | 537 | |
ganlikun | 0:13413ea9a877 | 538 | #endif /* HAL_GPIO_MODULE_ENABLED */ |
ganlikun | 0:13413ea9a877 | 539 | /** |
ganlikun | 0:13413ea9a877 | 540 | * @} |
ganlikun | 0:13413ea9a877 | 541 | */ |
ganlikun | 0:13413ea9a877 | 542 | |
ganlikun | 0:13413ea9a877 | 543 | /** |
ganlikun | 0:13413ea9a877 | 544 | * @} |
ganlikun | 0:13413ea9a877 | 545 | */ |
ganlikun | 0:13413ea9a877 | 546 | |
ganlikun | 0:13413ea9a877 | 547 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
ganlikun | 0:13413ea9a877 | 548 |