Hal Drivers for L4
Dependents: BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo
Fork of STM32L4xx_HAL_Driver by
Inc/stm32l4xx_hal_gpio.h@2:7aef7655b0a8, 2015-11-25 (annotated)
- Committer:
- EricLew
- Date:
- Wed Nov 25 17:30:43 2015 +0000
- Revision:
- 2:7aef7655b0a8
- Parent:
- 0:80ee8f3b695e
commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
EricLew | 0:80ee8f3b695e | 1 | /** |
EricLew | 0:80ee8f3b695e | 2 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 3 | * @file stm32l4xx_hal_gpio.h |
EricLew | 0:80ee8f3b695e | 4 | * @author MCD Application Team |
EricLew | 0:80ee8f3b695e | 5 | * @version V1.1.0 |
EricLew | 0:80ee8f3b695e | 6 | * @date 16-September-2015 |
EricLew | 0:80ee8f3b695e | 7 | * @brief Header file of GPIO HAL module. |
EricLew | 0:80ee8f3b695e | 8 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 9 | * @attention |
EricLew | 0:80ee8f3b695e | 10 | * |
EricLew | 0:80ee8f3b695e | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
EricLew | 0:80ee8f3b695e | 12 | * |
EricLew | 0:80ee8f3b695e | 13 | * Redistribution and use in source and binary forms, with or without modification, |
EricLew | 0:80ee8f3b695e | 14 | * are permitted provided that the following conditions are met: |
EricLew | 0:80ee8f3b695e | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
EricLew | 0:80ee8f3b695e | 16 | * this list of conditions and the following disclaimer. |
EricLew | 0:80ee8f3b695e | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
EricLew | 0:80ee8f3b695e | 18 | * this list of conditions and the following disclaimer in the documentation |
EricLew | 0:80ee8f3b695e | 19 | * and/or other materials provided with the distribution. |
EricLew | 0:80ee8f3b695e | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
EricLew | 0:80ee8f3b695e | 21 | * may be used to endorse or promote products derived from this software |
EricLew | 0:80ee8f3b695e | 22 | * without specific prior written permission. |
EricLew | 0:80ee8f3b695e | 23 | * |
EricLew | 0:80ee8f3b695e | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
EricLew | 0:80ee8f3b695e | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
EricLew | 0:80ee8f3b695e | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
EricLew | 0:80ee8f3b695e | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
EricLew | 0:80ee8f3b695e | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
EricLew | 0:80ee8f3b695e | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
EricLew | 0:80ee8f3b695e | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
EricLew | 0:80ee8f3b695e | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
EricLew | 0:80ee8f3b695e | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
EricLew | 0:80ee8f3b695e | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
EricLew | 0:80ee8f3b695e | 34 | * |
EricLew | 0:80ee8f3b695e | 35 | ****************************************************************************** |
EricLew | 0:80ee8f3b695e | 36 | */ |
EricLew | 0:80ee8f3b695e | 37 | |
EricLew | 0:80ee8f3b695e | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 39 | #ifndef __STM32L4xx_HAL_GPIO_H |
EricLew | 0:80ee8f3b695e | 40 | #define __STM32L4xx_HAL_GPIO_H |
EricLew | 0:80ee8f3b695e | 41 | |
EricLew | 0:80ee8f3b695e | 42 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 43 | extern "C" { |
EricLew | 0:80ee8f3b695e | 44 | #endif |
EricLew | 0:80ee8f3b695e | 45 | |
EricLew | 0:80ee8f3b695e | 46 | /* Includes ------------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 47 | #include "stm32l4xx_hal_def.h" |
EricLew | 0:80ee8f3b695e | 48 | |
EricLew | 0:80ee8f3b695e | 49 | /** @addtogroup STM32L4xx_HAL_Driver |
EricLew | 0:80ee8f3b695e | 50 | * @{ |
EricLew | 0:80ee8f3b695e | 51 | */ |
EricLew | 0:80ee8f3b695e | 52 | |
EricLew | 0:80ee8f3b695e | 53 | /** @addtogroup GPIO |
EricLew | 0:80ee8f3b695e | 54 | * @{ |
EricLew | 0:80ee8f3b695e | 55 | */ |
EricLew | 0:80ee8f3b695e | 56 | |
EricLew | 0:80ee8f3b695e | 57 | /* Exported types ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 58 | |
EricLew | 0:80ee8f3b695e | 59 | /** @defgroup GPIO_Exported_Types GPIO Exported Types |
EricLew | 0:80ee8f3b695e | 60 | * @{ |
EricLew | 0:80ee8f3b695e | 61 | */ |
EricLew | 0:80ee8f3b695e | 62 | /** |
EricLew | 0:80ee8f3b695e | 63 | * @brief GPIO Init structure definition |
EricLew | 0:80ee8f3b695e | 64 | */ |
EricLew | 0:80ee8f3b695e | 65 | typedef struct |
EricLew | 0:80ee8f3b695e | 66 | { |
EricLew | 0:80ee8f3b695e | 67 | uint32_t Pin; /*!< Specifies the GPIO pins to be configured. |
EricLew | 0:80ee8f3b695e | 68 | This parameter can be any value of @ref GPIO_pins */ |
EricLew | 0:80ee8f3b695e | 69 | |
EricLew | 0:80ee8f3b695e | 70 | uint32_t Mode; /*!< Specifies the operating mode for the selected pins. |
EricLew | 0:80ee8f3b695e | 71 | This parameter can be a value of @ref GPIO_mode */ |
EricLew | 0:80ee8f3b695e | 72 | |
EricLew | 0:80ee8f3b695e | 73 | uint32_t Pull; /*!< Specifies the Pull-up or Pull-Down activation for the selected pins. |
EricLew | 0:80ee8f3b695e | 74 | This parameter can be a value of @ref GPIO_pull */ |
EricLew | 0:80ee8f3b695e | 75 | |
EricLew | 0:80ee8f3b695e | 76 | uint32_t Speed; /*!< Specifies the speed for the selected pins. |
EricLew | 0:80ee8f3b695e | 77 | This parameter can be a value of @ref GPIO_speed */ |
EricLew | 0:80ee8f3b695e | 78 | |
EricLew | 0:80ee8f3b695e | 79 | uint32_t Alternate; /*!< Peripheral to be connected to the selected pins |
EricLew | 0:80ee8f3b695e | 80 | This parameter can be a value of @ref GPIOEx_Alternate_function_selection */ |
EricLew | 0:80ee8f3b695e | 81 | }GPIO_InitTypeDef; |
EricLew | 0:80ee8f3b695e | 82 | |
EricLew | 0:80ee8f3b695e | 83 | /** |
EricLew | 0:80ee8f3b695e | 84 | * @brief GPIO Bit SET and Bit RESET enumeration |
EricLew | 0:80ee8f3b695e | 85 | */ |
EricLew | 0:80ee8f3b695e | 86 | typedef enum |
EricLew | 0:80ee8f3b695e | 87 | { |
EricLew | 0:80ee8f3b695e | 88 | GPIO_PIN_RESET = 0, |
EricLew | 0:80ee8f3b695e | 89 | GPIO_PIN_SET |
EricLew | 0:80ee8f3b695e | 90 | }GPIO_PinState; |
EricLew | 0:80ee8f3b695e | 91 | /** |
EricLew | 0:80ee8f3b695e | 92 | * @} |
EricLew | 0:80ee8f3b695e | 93 | */ |
EricLew | 0:80ee8f3b695e | 94 | |
EricLew | 0:80ee8f3b695e | 95 | /* Exported constants --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 96 | /** @defgroup GPIO_Exported_Constants GPIO Exported Constants |
EricLew | 0:80ee8f3b695e | 97 | * @{ |
EricLew | 0:80ee8f3b695e | 98 | */ |
EricLew | 0:80ee8f3b695e | 99 | /** @defgroup GPIO_pins GPIO pins |
EricLew | 0:80ee8f3b695e | 100 | * @{ |
EricLew | 0:80ee8f3b695e | 101 | */ |
EricLew | 0:80ee8f3b695e | 102 | #define GPIO_PIN_0 ((uint16_t)0x0001) /* Pin 0 selected */ |
EricLew | 0:80ee8f3b695e | 103 | #define GPIO_PIN_1 ((uint16_t)0x0002) /* Pin 1 selected */ |
EricLew | 0:80ee8f3b695e | 104 | #define GPIO_PIN_2 ((uint16_t)0x0004) /* Pin 2 selected */ |
EricLew | 0:80ee8f3b695e | 105 | #define GPIO_PIN_3 ((uint16_t)0x0008) /* Pin 3 selected */ |
EricLew | 0:80ee8f3b695e | 106 | #define GPIO_PIN_4 ((uint16_t)0x0010) /* Pin 4 selected */ |
EricLew | 0:80ee8f3b695e | 107 | #define GPIO_PIN_5 ((uint16_t)0x0020) /* Pin 5 selected */ |
EricLew | 0:80ee8f3b695e | 108 | #define GPIO_PIN_6 ((uint16_t)0x0040) /* Pin 6 selected */ |
EricLew | 0:80ee8f3b695e | 109 | #define GPIO_PIN_7 ((uint16_t)0x0080) /* Pin 7 selected */ |
EricLew | 0:80ee8f3b695e | 110 | #define GPIO_PIN_8 ((uint16_t)0x0100) /* Pin 8 selected */ |
EricLew | 0:80ee8f3b695e | 111 | #define GPIO_PIN_9 ((uint16_t)0x0200) /* Pin 9 selected */ |
EricLew | 0:80ee8f3b695e | 112 | #define GPIO_PIN_10 ((uint16_t)0x0400) /* Pin 10 selected */ |
EricLew | 0:80ee8f3b695e | 113 | #define GPIO_PIN_11 ((uint16_t)0x0800) /* Pin 11 selected */ |
EricLew | 0:80ee8f3b695e | 114 | #define GPIO_PIN_12 ((uint16_t)0x1000) /* Pin 12 selected */ |
EricLew | 0:80ee8f3b695e | 115 | #define GPIO_PIN_13 ((uint16_t)0x2000) /* Pin 13 selected */ |
EricLew | 0:80ee8f3b695e | 116 | #define GPIO_PIN_14 ((uint16_t)0x4000) /* Pin 14 selected */ |
EricLew | 0:80ee8f3b695e | 117 | #define GPIO_PIN_15 ((uint16_t)0x8000) /* Pin 15 selected */ |
EricLew | 0:80ee8f3b695e | 118 | #define GPIO_PIN_All ((uint16_t)0xFFFF) /* All pins selected */ |
EricLew | 0:80ee8f3b695e | 119 | |
EricLew | 0:80ee8f3b695e | 120 | #define GPIO_PIN_MASK ((uint32_t)0x0000FFFF) /* PIN mask for assert test */ |
EricLew | 0:80ee8f3b695e | 121 | /** |
EricLew | 0:80ee8f3b695e | 122 | * @} |
EricLew | 0:80ee8f3b695e | 123 | */ |
EricLew | 0:80ee8f3b695e | 124 | |
EricLew | 0:80ee8f3b695e | 125 | /** @defgroup GPIO_mode GPIO mode |
EricLew | 0:80ee8f3b695e | 126 | * @brief GPIO Configuration Mode |
EricLew | 0:80ee8f3b695e | 127 | * Elements values convention: 0xX0yz00YZ |
EricLew | 0:80ee8f3b695e | 128 | * - X : GPIO mode or EXTI Mode |
EricLew | 0:80ee8f3b695e | 129 | * - y : External IT or Event trigger detection |
EricLew | 0:80ee8f3b695e | 130 | * - z : IO configuration on External IT or Event |
EricLew | 0:80ee8f3b695e | 131 | * - Y : Output type (Push Pull or Open Drain) |
EricLew | 0:80ee8f3b695e | 132 | * - Z : IO Direction mode (Input, Output, Alternate or Analog) |
EricLew | 0:80ee8f3b695e | 133 | * @{ |
EricLew | 0:80ee8f3b695e | 134 | */ |
EricLew | 0:80ee8f3b695e | 135 | #define GPIO_MODE_INPUT ((uint32_t)0x00000000) /*!< Input Floating Mode */ |
EricLew | 0:80ee8f3b695e | 136 | #define GPIO_MODE_OUTPUT_PP ((uint32_t)0x00000001) /*!< Output Push Pull Mode */ |
EricLew | 0:80ee8f3b695e | 137 | #define GPIO_MODE_OUTPUT_OD ((uint32_t)0x00000011) /*!< Output Open Drain Mode */ |
EricLew | 0:80ee8f3b695e | 138 | #define GPIO_MODE_AF_PP ((uint32_t)0x00000002) /*!< Alternate Function Push Pull Mode */ |
EricLew | 0:80ee8f3b695e | 139 | #define GPIO_MODE_AF_OD ((uint32_t)0x00000012) /*!< Alternate Function Open Drain Mode */ |
EricLew | 0:80ee8f3b695e | 140 | #define GPIO_MODE_ANALOG ((uint32_t)0x00000003) /*!< Analog Mode */ |
EricLew | 0:80ee8f3b695e | 141 | #define GPIO_MODE_ANALOG_ADC_CONTROL ((uint32_t)0x0000000B) /*!< Analog Mode for ADC conversion */ |
EricLew | 0:80ee8f3b695e | 142 | #define GPIO_MODE_IT_RISING ((uint32_t)0x10110000) /*!< External Interrupt Mode with Rising edge trigger detection */ |
EricLew | 0:80ee8f3b695e | 143 | #define GPIO_MODE_IT_FALLING ((uint32_t)0x10210000) /*!< External Interrupt Mode with Falling edge trigger detection */ |
EricLew | 0:80ee8f3b695e | 144 | #define GPIO_MODE_IT_RISING_FALLING ((uint32_t)0x10310000) /*!< External Interrupt Mode with Rising/Falling edge trigger detection */ |
EricLew | 0:80ee8f3b695e | 145 | #define GPIO_MODE_EVT_RISING ((uint32_t)0x10120000) /*!< External Event Mode with Rising edge trigger detection */ |
EricLew | 0:80ee8f3b695e | 146 | #define GPIO_MODE_EVT_FALLING ((uint32_t)0x10220000) /*!< External Event Mode with Falling edge trigger detection */ |
EricLew | 0:80ee8f3b695e | 147 | #define GPIO_MODE_EVT_RISING_FALLING ((uint32_t)0x10320000) /*!< External Event Mode with Rising/Falling edge trigger detection */ |
EricLew | 0:80ee8f3b695e | 148 | /** |
EricLew | 0:80ee8f3b695e | 149 | * @} |
EricLew | 0:80ee8f3b695e | 150 | */ |
EricLew | 0:80ee8f3b695e | 151 | |
EricLew | 0:80ee8f3b695e | 152 | /** @defgroup GPIO_speed GPIO speed |
EricLew | 0:80ee8f3b695e | 153 | * @brief GPIO Output Maximum frequency |
EricLew | 0:80ee8f3b695e | 154 | * @{ |
EricLew | 0:80ee8f3b695e | 155 | */ |
EricLew | 0:80ee8f3b695e | 156 | #define GPIO_SPEED_FREQ_LOW ((uint32_t)0x00000000) /*!< range up to 5 MHz, please refer to the product datasheet */ |
EricLew | 0:80ee8f3b695e | 157 | #define GPIO_SPEED_FREQ_MEDIUM ((uint32_t)0x00000001) /*!< range 5 MHz to 25 MHz, please refer to the product datasheet */ |
EricLew | 0:80ee8f3b695e | 158 | #define GPIO_SPEED_FREQ_HIGH ((uint32_t)0x00000002) /*!< range 25 MHz to 50 MHz, please refer to the product datasheet */ |
EricLew | 0:80ee8f3b695e | 159 | #define GPIO_SPEED_FREQ_VERY_HIGH ((uint32_t)0x00000003) /*!< range 50 MHz to 80 MHz, please refer to the product datasheet */ |
EricLew | 0:80ee8f3b695e | 160 | /** |
EricLew | 0:80ee8f3b695e | 161 | * @} |
EricLew | 0:80ee8f3b695e | 162 | */ |
EricLew | 0:80ee8f3b695e | 163 | |
EricLew | 0:80ee8f3b695e | 164 | /** @defgroup GPIO_pull GPIO pull |
EricLew | 0:80ee8f3b695e | 165 | * @brief GPIO Pull-Up or Pull-Down Activation |
EricLew | 0:80ee8f3b695e | 166 | * @{ |
EricLew | 0:80ee8f3b695e | 167 | */ |
EricLew | 0:80ee8f3b695e | 168 | #define GPIO_NOPULL ((uint32_t)0x00000000) /*!< No Pull-up or Pull-down activation */ |
EricLew | 0:80ee8f3b695e | 169 | #define GPIO_PULLUP ((uint32_t)0x00000001) /*!< Pull-up activation */ |
EricLew | 0:80ee8f3b695e | 170 | #define GPIO_PULLDOWN ((uint32_t)0x00000002) /*!< Pull-down activation */ |
EricLew | 0:80ee8f3b695e | 171 | /** |
EricLew | 0:80ee8f3b695e | 172 | * @} |
EricLew | 0:80ee8f3b695e | 173 | */ |
EricLew | 0:80ee8f3b695e | 174 | |
EricLew | 0:80ee8f3b695e | 175 | /** |
EricLew | 0:80ee8f3b695e | 176 | * @} |
EricLew | 0:80ee8f3b695e | 177 | */ |
EricLew | 0:80ee8f3b695e | 178 | |
EricLew | 0:80ee8f3b695e | 179 | /* Exported macro ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 180 | /** @defgroup GPIO_Exported_Macros GPIO Exported Macros |
EricLew | 0:80ee8f3b695e | 181 | * @{ |
EricLew | 0:80ee8f3b695e | 182 | */ |
EricLew | 0:80ee8f3b695e | 183 | |
EricLew | 0:80ee8f3b695e | 184 | /** |
EricLew | 0:80ee8f3b695e | 185 | * @brief Check whether the specified EXTI line flag is set or not. |
EricLew | 0:80ee8f3b695e | 186 | * @param __EXTI_LINE__: specifies the EXTI line flag to check. |
EricLew | 0:80ee8f3b695e | 187 | * This parameter can be GPIO_PIN_x where x can be(0..15) |
EricLew | 0:80ee8f3b695e | 188 | * @retval The new state of __EXTI_LINE__ (SET or RESET). |
EricLew | 0:80ee8f3b695e | 189 | */ |
EricLew | 0:80ee8f3b695e | 190 | #define __HAL_GPIO_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__)) |
EricLew | 0:80ee8f3b695e | 191 | |
EricLew | 0:80ee8f3b695e | 192 | /** |
EricLew | 0:80ee8f3b695e | 193 | * @brief Clear the EXTI's line pending flags. |
EricLew | 0:80ee8f3b695e | 194 | * @param __EXTI_LINE__: specifies the EXTI lines flags to clear. |
EricLew | 0:80ee8f3b695e | 195 | * This parameter can be any combination of GPIO_PIN_x where x can be (0..15) |
EricLew | 0:80ee8f3b695e | 196 | * @retval None |
EricLew | 0:80ee8f3b695e | 197 | */ |
EricLew | 0:80ee8f3b695e | 198 | #define __HAL_GPIO_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR1 = (__EXTI_LINE__)) |
EricLew | 0:80ee8f3b695e | 199 | |
EricLew | 0:80ee8f3b695e | 200 | /** |
EricLew | 0:80ee8f3b695e | 201 | * @brief Check whether the specified EXTI line is asserted or not. |
EricLew | 0:80ee8f3b695e | 202 | * @param __EXTI_LINE__: specifies the EXTI line to check. |
EricLew | 0:80ee8f3b695e | 203 | * This parameter can be GPIO_PIN_x where x can be(0..15) |
EricLew | 0:80ee8f3b695e | 204 | * @retval The new state of __EXTI_LINE__ (SET or RESET). |
EricLew | 0:80ee8f3b695e | 205 | */ |
EricLew | 0:80ee8f3b695e | 206 | #define __HAL_GPIO_EXTI_GET_IT(__EXTI_LINE__) (EXTI->PR1 & (__EXTI_LINE__)) |
EricLew | 0:80ee8f3b695e | 207 | |
EricLew | 0:80ee8f3b695e | 208 | /** |
EricLew | 0:80ee8f3b695e | 209 | * @brief Clear the EXTI's line pending bits. |
EricLew | 0:80ee8f3b695e | 210 | * @param __EXTI_LINE__: specifies the EXTI lines to clear. |
EricLew | 0:80ee8f3b695e | 211 | * This parameter can be any combination of GPIO_PIN_x where x can be (0..15) |
EricLew | 0:80ee8f3b695e | 212 | * @retval None |
EricLew | 0:80ee8f3b695e | 213 | */ |
EricLew | 0:80ee8f3b695e | 214 | #define __HAL_GPIO_EXTI_CLEAR_IT(__EXTI_LINE__) (EXTI->PR1 = (__EXTI_LINE__)) |
EricLew | 0:80ee8f3b695e | 215 | |
EricLew | 0:80ee8f3b695e | 216 | /** |
EricLew | 0:80ee8f3b695e | 217 | * @brief Generate a Software interrupt on selected EXTI line. |
EricLew | 0:80ee8f3b695e | 218 | * @param __EXTI_LINE__: specifies the EXTI line to check. |
EricLew | 0:80ee8f3b695e | 219 | * This parameter can be GPIO_PIN_x where x can be(0..15) |
EricLew | 0:80ee8f3b695e | 220 | * @retval None |
EricLew | 0:80ee8f3b695e | 221 | */ |
EricLew | 0:80ee8f3b695e | 222 | #define __HAL_GPIO_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER1 |= (__EXTI_LINE__)) |
EricLew | 0:80ee8f3b695e | 223 | |
EricLew | 0:80ee8f3b695e | 224 | /** |
EricLew | 0:80ee8f3b695e | 225 | * @} |
EricLew | 0:80ee8f3b695e | 226 | */ |
EricLew | 0:80ee8f3b695e | 227 | |
EricLew | 0:80ee8f3b695e | 228 | /* Private macros ------------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 229 | /** @addtogroup GPIO_Private_Macros GPIO Private Macros |
EricLew | 0:80ee8f3b695e | 230 | * @{ |
EricLew | 0:80ee8f3b695e | 231 | */ |
EricLew | 0:80ee8f3b695e | 232 | #define IS_GPIO_PIN_ACTION(ACTION) (((ACTION) == GPIO_PIN_RESET) || ((ACTION) == GPIO_PIN_SET)) |
EricLew | 0:80ee8f3b695e | 233 | |
EricLew | 0:80ee8f3b695e | 234 | #define IS_GPIO_PIN(__PIN__) (((__PIN__) & GPIO_PIN_MASK) != (uint32_t)0x00) |
EricLew | 0:80ee8f3b695e | 235 | |
EricLew | 0:80ee8f3b695e | 236 | #define IS_GPIO_MODE(__MODE__) (((__MODE__) == GPIO_MODE_INPUT) ||\ |
EricLew | 0:80ee8f3b695e | 237 | ((__MODE__) == GPIO_MODE_OUTPUT_PP) ||\ |
EricLew | 0:80ee8f3b695e | 238 | ((__MODE__) == GPIO_MODE_OUTPUT_OD) ||\ |
EricLew | 0:80ee8f3b695e | 239 | ((__MODE__) == GPIO_MODE_AF_PP) ||\ |
EricLew | 0:80ee8f3b695e | 240 | ((__MODE__) == GPIO_MODE_AF_OD) ||\ |
EricLew | 0:80ee8f3b695e | 241 | ((__MODE__) == GPIO_MODE_IT_RISING) ||\ |
EricLew | 0:80ee8f3b695e | 242 | ((__MODE__) == GPIO_MODE_IT_FALLING) ||\ |
EricLew | 0:80ee8f3b695e | 243 | ((__MODE__) == GPIO_MODE_IT_RISING_FALLING) ||\ |
EricLew | 0:80ee8f3b695e | 244 | ((__MODE__) == GPIO_MODE_EVT_RISING) ||\ |
EricLew | 0:80ee8f3b695e | 245 | ((__MODE__) == GPIO_MODE_EVT_FALLING) ||\ |
EricLew | 0:80ee8f3b695e | 246 | ((__MODE__) == GPIO_MODE_EVT_RISING_FALLING) ||\ |
EricLew | 0:80ee8f3b695e | 247 | ((__MODE__) == GPIO_MODE_ANALOG) ||\ |
EricLew | 0:80ee8f3b695e | 248 | ((__MODE__) == GPIO_MODE_ANALOG_ADC_CONTROL)) |
EricLew | 0:80ee8f3b695e | 249 | |
EricLew | 0:80ee8f3b695e | 250 | #define IS_GPIO_SPEED(__SPEED__) (((__SPEED__) == GPIO_SPEED_FREQ_LOW) ||\ |
EricLew | 0:80ee8f3b695e | 251 | ((__SPEED__) == GPIO_SPEED_FREQ_MEDIUM) ||\ |
EricLew | 0:80ee8f3b695e | 252 | ((__SPEED__) == GPIO_SPEED_FREQ_HIGH) ||\ |
EricLew | 0:80ee8f3b695e | 253 | ((__SPEED__) == GPIO_SPEED_FREQ_VERY_HIGH)) |
EricLew | 0:80ee8f3b695e | 254 | |
EricLew | 0:80ee8f3b695e | 255 | #define IS_GPIO_PULL(__PULL__) (((__PULL__) == GPIO_NOPULL) ||\ |
EricLew | 0:80ee8f3b695e | 256 | ((__PULL__) == GPIO_PULLUP) || \ |
EricLew | 0:80ee8f3b695e | 257 | ((__PULL__) == GPIO_PULLDOWN)) |
EricLew | 0:80ee8f3b695e | 258 | /** |
EricLew | 0:80ee8f3b695e | 259 | * @} |
EricLew | 0:80ee8f3b695e | 260 | */ |
EricLew | 0:80ee8f3b695e | 261 | |
EricLew | 0:80ee8f3b695e | 262 | /* Include GPIO HAL Extended module */ |
EricLew | 0:80ee8f3b695e | 263 | #include "stm32l4xx_hal_gpio_ex.h" |
EricLew | 0:80ee8f3b695e | 264 | |
EricLew | 0:80ee8f3b695e | 265 | /* Exported functions --------------------------------------------------------*/ |
EricLew | 0:80ee8f3b695e | 266 | /** @addtogroup GPIO_Exported_Functions GPIO Exported Functions |
EricLew | 0:80ee8f3b695e | 267 | * @{ |
EricLew | 0:80ee8f3b695e | 268 | */ |
EricLew | 0:80ee8f3b695e | 269 | |
EricLew | 0:80ee8f3b695e | 270 | /** @addtogroup GPIO_Exported_Functions_Group1 Initialization/de-initialization functions |
EricLew | 0:80ee8f3b695e | 271 | * @brief Initialization and Configuration functions |
EricLew | 0:80ee8f3b695e | 272 | * @{ |
EricLew | 0:80ee8f3b695e | 273 | */ |
EricLew | 0:80ee8f3b695e | 274 | |
EricLew | 0:80ee8f3b695e | 275 | /* Initialization and de-initialization functions *****************************/ |
EricLew | 0:80ee8f3b695e | 276 | void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init); |
EricLew | 0:80ee8f3b695e | 277 | void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin); |
EricLew | 0:80ee8f3b695e | 278 | |
EricLew | 0:80ee8f3b695e | 279 | /** |
EricLew | 0:80ee8f3b695e | 280 | * @} |
EricLew | 0:80ee8f3b695e | 281 | */ |
EricLew | 0:80ee8f3b695e | 282 | |
EricLew | 0:80ee8f3b695e | 283 | /** @addtogroup GPIO_Exported_Functions_Group2 IO operation functions |
EricLew | 0:80ee8f3b695e | 284 | * @{ |
EricLew | 0:80ee8f3b695e | 285 | */ |
EricLew | 0:80ee8f3b695e | 286 | |
EricLew | 0:80ee8f3b695e | 287 | /* IO operation functions *****************************************************/ |
EricLew | 0:80ee8f3b695e | 288 | GPIO_PinState HAL_GPIO_ReadPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
EricLew | 0:80ee8f3b695e | 289 | void HAL_GPIO_WritePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState); |
EricLew | 0:80ee8f3b695e | 290 | void HAL_GPIO_TogglePin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
EricLew | 0:80ee8f3b695e | 291 | HAL_StatusTypeDef HAL_GPIO_LockPin(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin); |
EricLew | 0:80ee8f3b695e | 292 | void HAL_GPIO_EXTI_IRQHandler(uint16_t GPIO_Pin); |
EricLew | 0:80ee8f3b695e | 293 | void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin); |
EricLew | 0:80ee8f3b695e | 294 | |
EricLew | 0:80ee8f3b695e | 295 | /** |
EricLew | 0:80ee8f3b695e | 296 | * @} |
EricLew | 0:80ee8f3b695e | 297 | */ |
EricLew | 0:80ee8f3b695e | 298 | |
EricLew | 0:80ee8f3b695e | 299 | /** |
EricLew | 0:80ee8f3b695e | 300 | * @} |
EricLew | 0:80ee8f3b695e | 301 | */ |
EricLew | 0:80ee8f3b695e | 302 | |
EricLew | 0:80ee8f3b695e | 303 | /** |
EricLew | 0:80ee8f3b695e | 304 | * @} |
EricLew | 0:80ee8f3b695e | 305 | */ |
EricLew | 0:80ee8f3b695e | 306 | |
EricLew | 0:80ee8f3b695e | 307 | /** |
EricLew | 0:80ee8f3b695e | 308 | * @} |
EricLew | 0:80ee8f3b695e | 309 | */ |
EricLew | 0:80ee8f3b695e | 310 | |
EricLew | 0:80ee8f3b695e | 311 | #ifdef __cplusplus |
EricLew | 0:80ee8f3b695e | 312 | } |
EricLew | 0:80ee8f3b695e | 313 | #endif |
EricLew | 0:80ee8f3b695e | 314 | |
EricLew | 0:80ee8f3b695e | 315 | #endif /* __STM32L4xx_HAL_GPIO_H */ |
EricLew | 0:80ee8f3b695e | 316 | |
EricLew | 0:80ee8f3b695e | 317 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
EricLew | 0:80ee8f3b695e | 318 |