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