inport from local

Dependents:   Hobbyking_Cheetah_0511

Committer:
NYX
Date:
Mon Mar 16 06:35:48 2020 +0000
Revision:
0:85b3fd62ea1a
reinport to mbed;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
NYX 0:85b3fd62ea1a 1 /**
NYX 0:85b3fd62ea1a 2 ******************************************************************************
NYX 0:85b3fd62ea1a 3 * @file stm32f4xx_ll_gpio.h
NYX 0:85b3fd62ea1a 4 * @author MCD Application Team
NYX 0:85b3fd62ea1a 5 * @version V1.7.1
NYX 0:85b3fd62ea1a 6 * @date 14-April-2017
NYX 0:85b3fd62ea1a 7 * @brief Header file of GPIO LL module.
NYX 0:85b3fd62ea1a 8 ******************************************************************************
NYX 0:85b3fd62ea1a 9 * @attention
NYX 0:85b3fd62ea1a 10 *
NYX 0:85b3fd62ea1a 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
NYX 0:85b3fd62ea1a 12 *
NYX 0:85b3fd62ea1a 13 * Redistribution and use in source and binary forms, with or without modification,
NYX 0:85b3fd62ea1a 14 * are permitted provided that the following conditions are met:
NYX 0:85b3fd62ea1a 15 * 1. Redistributions of source code must retain the above copyright notice,
NYX 0:85b3fd62ea1a 16 * this list of conditions and the following disclaimer.
NYX 0:85b3fd62ea1a 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
NYX 0:85b3fd62ea1a 18 * this list of conditions and the following disclaimer in the documentation
NYX 0:85b3fd62ea1a 19 * and/or other materials provided with the distribution.
NYX 0:85b3fd62ea1a 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
NYX 0:85b3fd62ea1a 21 * may be used to endorse or promote products derived from this software
NYX 0:85b3fd62ea1a 22 * without specific prior written permission.
NYX 0:85b3fd62ea1a 23 *
NYX 0:85b3fd62ea1a 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
NYX 0:85b3fd62ea1a 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
NYX 0:85b3fd62ea1a 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
NYX 0:85b3fd62ea1a 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
NYX 0:85b3fd62ea1a 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
NYX 0:85b3fd62ea1a 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
NYX 0:85b3fd62ea1a 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
NYX 0:85b3fd62ea1a 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
NYX 0:85b3fd62ea1a 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
NYX 0:85b3fd62ea1a 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
NYX 0:85b3fd62ea1a 34 *
NYX 0:85b3fd62ea1a 35 ******************************************************************************
NYX 0:85b3fd62ea1a 36 */
NYX 0:85b3fd62ea1a 37
NYX 0:85b3fd62ea1a 38 /* Define to prevent recursive inclusion -------------------------------------*/
NYX 0:85b3fd62ea1a 39 #ifndef __STM32F4xx_LL_GPIO_H
NYX 0:85b3fd62ea1a 40 #define __STM32F4xx_LL_GPIO_H
NYX 0:85b3fd62ea1a 41
NYX 0:85b3fd62ea1a 42 #ifdef __cplusplus
NYX 0:85b3fd62ea1a 43 extern "C" {
NYX 0:85b3fd62ea1a 44 #endif
NYX 0:85b3fd62ea1a 45
NYX 0:85b3fd62ea1a 46 /* Includes ------------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 47 #include "stm32f4xx.h"
NYX 0:85b3fd62ea1a 48
NYX 0:85b3fd62ea1a 49 /** @addtogroup STM32F4xx_LL_Driver
NYX 0:85b3fd62ea1a 50 * @{
NYX 0:85b3fd62ea1a 51 */
NYX 0:85b3fd62ea1a 52
NYX 0:85b3fd62ea1a 53 #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || defined (GPIOI) || defined (GPIOJ) || defined (GPIOK)
NYX 0:85b3fd62ea1a 54
NYX 0:85b3fd62ea1a 55 /** @defgroup GPIO_LL GPIO
NYX 0:85b3fd62ea1a 56 * @{
NYX 0:85b3fd62ea1a 57 */
NYX 0:85b3fd62ea1a 58
NYX 0:85b3fd62ea1a 59 /* Private types -------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 60 /* Private variables ---------------------------------------------------------*/
NYX 0:85b3fd62ea1a 61 /* Private constants ---------------------------------------------------------*/
NYX 0:85b3fd62ea1a 62 /* Private macros ------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 63 #if defined(USE_FULL_LL_DRIVER)
NYX 0:85b3fd62ea1a 64 /** @defgroup GPIO_LL_Private_Macros GPIO Private Macros
NYX 0:85b3fd62ea1a 65 * @{
NYX 0:85b3fd62ea1a 66 */
NYX 0:85b3fd62ea1a 67
NYX 0:85b3fd62ea1a 68 /**
NYX 0:85b3fd62ea1a 69 * @}
NYX 0:85b3fd62ea1a 70 */
NYX 0:85b3fd62ea1a 71 #endif /*USE_FULL_LL_DRIVER*/
NYX 0:85b3fd62ea1a 72
NYX 0:85b3fd62ea1a 73 /* Exported types ------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 74 #if defined(USE_FULL_LL_DRIVER)
NYX 0:85b3fd62ea1a 75 /** @defgroup GPIO_LL_ES_INIT GPIO Exported Init structures
NYX 0:85b3fd62ea1a 76 * @{
NYX 0:85b3fd62ea1a 77 */
NYX 0:85b3fd62ea1a 78
NYX 0:85b3fd62ea1a 79 /**
NYX 0:85b3fd62ea1a 80 * @brief LL GPIO Init Structure definition
NYX 0:85b3fd62ea1a 81 */
NYX 0:85b3fd62ea1a 82 typedef struct
NYX 0:85b3fd62ea1a 83 {
NYX 0:85b3fd62ea1a 84 uint32_t Pin; /*!< Specifies the GPIO pins to be configured.
NYX 0:85b3fd62ea1a 85 This parameter can be any value of @ref GPIO_LL_EC_PIN */
NYX 0:85b3fd62ea1a 86
NYX 0:85b3fd62ea1a 87 uint32_t Mode; /*!< Specifies the operating mode for the selected pins.
NYX 0:85b3fd62ea1a 88 This parameter can be a value of @ref GPIO_LL_EC_MODE.
NYX 0:85b3fd62ea1a 89
NYX 0:85b3fd62ea1a 90 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinMode().*/
NYX 0:85b3fd62ea1a 91
NYX 0:85b3fd62ea1a 92 uint32_t Speed; /*!< Specifies the speed for the selected pins.
NYX 0:85b3fd62ea1a 93 This parameter can be a value of @ref GPIO_LL_EC_SPEED.
NYX 0:85b3fd62ea1a 94
NYX 0:85b3fd62ea1a 95 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinSpeed().*/
NYX 0:85b3fd62ea1a 96
NYX 0:85b3fd62ea1a 97 uint32_t OutputType; /*!< Specifies the operating output type for the selected pins.
NYX 0:85b3fd62ea1a 98 This parameter can be a value of @ref GPIO_LL_EC_OUTPUT.
NYX 0:85b3fd62ea1a 99
NYX 0:85b3fd62ea1a 100 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinOutputType().*/
NYX 0:85b3fd62ea1a 101
NYX 0:85b3fd62ea1a 102 uint32_t Pull; /*!< Specifies the operating Pull-up/Pull down for the selected pins.
NYX 0:85b3fd62ea1a 103 This parameter can be a value of @ref GPIO_LL_EC_PULL.
NYX 0:85b3fd62ea1a 104
NYX 0:85b3fd62ea1a 105 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinPull().*/
NYX 0:85b3fd62ea1a 106
NYX 0:85b3fd62ea1a 107 uint32_t Alternate; /*!< Specifies the Peripheral to be connected to the selected pins.
NYX 0:85b3fd62ea1a 108 This parameter can be a value of @ref GPIO_LL_EC_AF.
NYX 0:85b3fd62ea1a 109
NYX 0:85b3fd62ea1a 110 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetAFPin_0_7() and LL_GPIO_SetAFPin_8_15().*/
NYX 0:85b3fd62ea1a 111 } LL_GPIO_InitTypeDef;
NYX 0:85b3fd62ea1a 112
NYX 0:85b3fd62ea1a 113 /**
NYX 0:85b3fd62ea1a 114 * @}
NYX 0:85b3fd62ea1a 115 */
NYX 0:85b3fd62ea1a 116 #endif /* USE_FULL_LL_DRIVER */
NYX 0:85b3fd62ea1a 117
NYX 0:85b3fd62ea1a 118 /* Exported constants --------------------------------------------------------*/
NYX 0:85b3fd62ea1a 119 /** @defgroup GPIO_LL_Exported_Constants GPIO Exported Constants
NYX 0:85b3fd62ea1a 120 * @{
NYX 0:85b3fd62ea1a 121 */
NYX 0:85b3fd62ea1a 122
NYX 0:85b3fd62ea1a 123 /** @defgroup GPIO_LL_EC_PIN PIN
NYX 0:85b3fd62ea1a 124 * @{
NYX 0:85b3fd62ea1a 125 */
NYX 0:85b3fd62ea1a 126 #define LL_GPIO_PIN_0 GPIO_BSRR_BS_0 /*!< Select pin 0 */
NYX 0:85b3fd62ea1a 127 #define LL_GPIO_PIN_1 GPIO_BSRR_BS_1 /*!< Select pin 1 */
NYX 0:85b3fd62ea1a 128 #define LL_GPIO_PIN_2 GPIO_BSRR_BS_2 /*!< Select pin 2 */
NYX 0:85b3fd62ea1a 129 #define LL_GPIO_PIN_3 GPIO_BSRR_BS_3 /*!< Select pin 3 */
NYX 0:85b3fd62ea1a 130 #define LL_GPIO_PIN_4 GPIO_BSRR_BS_4 /*!< Select pin 4 */
NYX 0:85b3fd62ea1a 131 #define LL_GPIO_PIN_5 GPIO_BSRR_BS_5 /*!< Select pin 5 */
NYX 0:85b3fd62ea1a 132 #define LL_GPIO_PIN_6 GPIO_BSRR_BS_6 /*!< Select pin 6 */
NYX 0:85b3fd62ea1a 133 #define LL_GPIO_PIN_7 GPIO_BSRR_BS_7 /*!< Select pin 7 */
NYX 0:85b3fd62ea1a 134 #define LL_GPIO_PIN_8 GPIO_BSRR_BS_8 /*!< Select pin 8 */
NYX 0:85b3fd62ea1a 135 #define LL_GPIO_PIN_9 GPIO_BSRR_BS_9 /*!< Select pin 9 */
NYX 0:85b3fd62ea1a 136 #define LL_GPIO_PIN_10 GPIO_BSRR_BS_10 /*!< Select pin 10 */
NYX 0:85b3fd62ea1a 137 #define LL_GPIO_PIN_11 GPIO_BSRR_BS_11 /*!< Select pin 11 */
NYX 0:85b3fd62ea1a 138 #define LL_GPIO_PIN_12 GPIO_BSRR_BS_12 /*!< Select pin 12 */
NYX 0:85b3fd62ea1a 139 #define LL_GPIO_PIN_13 GPIO_BSRR_BS_13 /*!< Select pin 13 */
NYX 0:85b3fd62ea1a 140 #define LL_GPIO_PIN_14 GPIO_BSRR_BS_14 /*!< Select pin 14 */
NYX 0:85b3fd62ea1a 141 #define LL_GPIO_PIN_15 GPIO_BSRR_BS_15 /*!< Select pin 15 */
NYX 0:85b3fd62ea1a 142 #define LL_GPIO_PIN_ALL (GPIO_BSRR_BS_0 | GPIO_BSRR_BS_1 | GPIO_BSRR_BS_2 | \
NYX 0:85b3fd62ea1a 143 GPIO_BSRR_BS_3 | GPIO_BSRR_BS_4 | GPIO_BSRR_BS_5 | \
NYX 0:85b3fd62ea1a 144 GPIO_BSRR_BS_6 | GPIO_BSRR_BS_7 | GPIO_BSRR_BS_8 | \
NYX 0:85b3fd62ea1a 145 GPIO_BSRR_BS_9 | GPIO_BSRR_BS_10 | GPIO_BSRR_BS_11 | \
NYX 0:85b3fd62ea1a 146 GPIO_BSRR_BS_12 | GPIO_BSRR_BS_13 | GPIO_BSRR_BS_14 | \
NYX 0:85b3fd62ea1a 147 GPIO_BSRR_BS_15) /*!< Select all pins */
NYX 0:85b3fd62ea1a 148 /**
NYX 0:85b3fd62ea1a 149 * @}
NYX 0:85b3fd62ea1a 150 */
NYX 0:85b3fd62ea1a 151
NYX 0:85b3fd62ea1a 152 /** @defgroup GPIO_LL_EC_MODE Mode
NYX 0:85b3fd62ea1a 153 * @{
NYX 0:85b3fd62ea1a 154 */
NYX 0:85b3fd62ea1a 155 #define LL_GPIO_MODE_INPUT (0x00000000U) /*!< Select input mode */
NYX 0:85b3fd62ea1a 156 #define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODER0_0 /*!< Select output mode */
NYX 0:85b3fd62ea1a 157 #define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODER0_1 /*!< Select alternate function mode */
NYX 0:85b3fd62ea1a 158 #define LL_GPIO_MODE_ANALOG GPIO_MODER_MODER0 /*!< Select analog mode */
NYX 0:85b3fd62ea1a 159 /**
NYX 0:85b3fd62ea1a 160 * @}
NYX 0:85b3fd62ea1a 161 */
NYX 0:85b3fd62ea1a 162
NYX 0:85b3fd62ea1a 163 /** @defgroup GPIO_LL_EC_OUTPUT Output Type
NYX 0:85b3fd62ea1a 164 * @{
NYX 0:85b3fd62ea1a 165 */
NYX 0:85b3fd62ea1a 166 #define LL_GPIO_OUTPUT_PUSHPULL (0x00000000U) /*!< Select push-pull as output type */
NYX 0:85b3fd62ea1a 167 #define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT_0 /*!< Select open-drain as output type */
NYX 0:85b3fd62ea1a 168 /**
NYX 0:85b3fd62ea1a 169 * @}
NYX 0:85b3fd62ea1a 170 */
NYX 0:85b3fd62ea1a 171
NYX 0:85b3fd62ea1a 172 /** @defgroup GPIO_LL_EC_SPEED Output Speed
NYX 0:85b3fd62ea1a 173 * @{
NYX 0:85b3fd62ea1a 174 */
NYX 0:85b3fd62ea1a 175 #define LL_GPIO_SPEED_FREQ_LOW (0x00000000U) /*!< Select I/O low output speed */
NYX 0:85b3fd62ea1a 176 #define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */
NYX 0:85b3fd62ea1a 177 #define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */
NYX 0:85b3fd62ea1a 178 #define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */
NYX 0:85b3fd62ea1a 179 /**
NYX 0:85b3fd62ea1a 180 * @}
NYX 0:85b3fd62ea1a 181 */
NYX 0:85b3fd62ea1a 182
NYX 0:85b3fd62ea1a 183 /** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down
NYX 0:85b3fd62ea1a 184 * @{
NYX 0:85b3fd62ea1a 185 */
NYX 0:85b3fd62ea1a 186 #define LL_GPIO_PULL_NO (0x00000000U) /*!< Select I/O no pull */
NYX 0:85b3fd62ea1a 187 #define LL_GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */
NYX 0:85b3fd62ea1a 188 #define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPDR0_1 /*!< Select I/O pull down */
NYX 0:85b3fd62ea1a 189 /**
NYX 0:85b3fd62ea1a 190 * @}
NYX 0:85b3fd62ea1a 191 */
NYX 0:85b3fd62ea1a 192
NYX 0:85b3fd62ea1a 193 /** @defgroup GPIO_LL_EC_AF Alternate Function
NYX 0:85b3fd62ea1a 194 * @{
NYX 0:85b3fd62ea1a 195 */
NYX 0:85b3fd62ea1a 196 #define LL_GPIO_AF_0 (0x0000000U) /*!< Select alternate function 0 */
NYX 0:85b3fd62ea1a 197 #define LL_GPIO_AF_1 (0x0000001U) /*!< Select alternate function 1 */
NYX 0:85b3fd62ea1a 198 #define LL_GPIO_AF_2 (0x0000002U) /*!< Select alternate function 2 */
NYX 0:85b3fd62ea1a 199 #define LL_GPIO_AF_3 (0x0000003U) /*!< Select alternate function 3 */
NYX 0:85b3fd62ea1a 200 #define LL_GPIO_AF_4 (0x0000004U) /*!< Select alternate function 4 */
NYX 0:85b3fd62ea1a 201 #define LL_GPIO_AF_5 (0x0000005U) /*!< Select alternate function 5 */
NYX 0:85b3fd62ea1a 202 #define LL_GPIO_AF_6 (0x0000006U) /*!< Select alternate function 6 */
NYX 0:85b3fd62ea1a 203 #define LL_GPIO_AF_7 (0x0000007U) /*!< Select alternate function 7 */
NYX 0:85b3fd62ea1a 204 #define LL_GPIO_AF_8 (0x0000008U) /*!< Select alternate function 8 */
NYX 0:85b3fd62ea1a 205 #define LL_GPIO_AF_9 (0x0000009U) /*!< Select alternate function 9 */
NYX 0:85b3fd62ea1a 206 #define LL_GPIO_AF_10 (0x000000AU) /*!< Select alternate function 10 */
NYX 0:85b3fd62ea1a 207 #define LL_GPIO_AF_11 (0x000000BU) /*!< Select alternate function 11 */
NYX 0:85b3fd62ea1a 208 #define LL_GPIO_AF_12 (0x000000CU) /*!< Select alternate function 12 */
NYX 0:85b3fd62ea1a 209 #define LL_GPIO_AF_13 (0x000000DU) /*!< Select alternate function 13 */
NYX 0:85b3fd62ea1a 210 #define LL_GPIO_AF_14 (0x000000EU) /*!< Select alternate function 14 */
NYX 0:85b3fd62ea1a 211 #define LL_GPIO_AF_15 (0x000000FU) /*!< Select alternate function 15 */
NYX 0:85b3fd62ea1a 212 /**
NYX 0:85b3fd62ea1a 213 * @}
NYX 0:85b3fd62ea1a 214 */
NYX 0:85b3fd62ea1a 215
NYX 0:85b3fd62ea1a 216 /**
NYX 0:85b3fd62ea1a 217 * @}
NYX 0:85b3fd62ea1a 218 */
NYX 0:85b3fd62ea1a 219
NYX 0:85b3fd62ea1a 220 /* Exported macro ------------------------------------------------------------*/
NYX 0:85b3fd62ea1a 221 /** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros
NYX 0:85b3fd62ea1a 222 * @{
NYX 0:85b3fd62ea1a 223 */
NYX 0:85b3fd62ea1a 224
NYX 0:85b3fd62ea1a 225 /** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros
NYX 0:85b3fd62ea1a 226 * @{
NYX 0:85b3fd62ea1a 227 */
NYX 0:85b3fd62ea1a 228
NYX 0:85b3fd62ea1a 229 /**
NYX 0:85b3fd62ea1a 230 * @brief Write a value in GPIO register
NYX 0:85b3fd62ea1a 231 * @param __INSTANCE__ GPIO Instance
NYX 0:85b3fd62ea1a 232 * @param __REG__ Register to be written
NYX 0:85b3fd62ea1a 233 * @param __VALUE__ Value to be written in the register
NYX 0:85b3fd62ea1a 234 * @retval None
NYX 0:85b3fd62ea1a 235 */
NYX 0:85b3fd62ea1a 236 #define LL_GPIO_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
NYX 0:85b3fd62ea1a 237
NYX 0:85b3fd62ea1a 238 /**
NYX 0:85b3fd62ea1a 239 * @brief Read a value in GPIO register
NYX 0:85b3fd62ea1a 240 * @param __INSTANCE__ GPIO Instance
NYX 0:85b3fd62ea1a 241 * @param __REG__ Register to be read
NYX 0:85b3fd62ea1a 242 * @retval Register value
NYX 0:85b3fd62ea1a 243 */
NYX 0:85b3fd62ea1a 244 #define LL_GPIO_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
NYX 0:85b3fd62ea1a 245 /**
NYX 0:85b3fd62ea1a 246 * @}
NYX 0:85b3fd62ea1a 247 */
NYX 0:85b3fd62ea1a 248
NYX 0:85b3fd62ea1a 249 /**
NYX 0:85b3fd62ea1a 250 * @}
NYX 0:85b3fd62ea1a 251 */
NYX 0:85b3fd62ea1a 252
NYX 0:85b3fd62ea1a 253 /* Exported functions --------------------------------------------------------*/
NYX 0:85b3fd62ea1a 254 /** @defgroup GPIO_LL_Exported_Functions GPIO Exported Functions
NYX 0:85b3fd62ea1a 255 * @{
NYX 0:85b3fd62ea1a 256 */
NYX 0:85b3fd62ea1a 257
NYX 0:85b3fd62ea1a 258 /** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration
NYX 0:85b3fd62ea1a 259 * @{
NYX 0:85b3fd62ea1a 260 */
NYX 0:85b3fd62ea1a 261
NYX 0:85b3fd62ea1a 262 /**
NYX 0:85b3fd62ea1a 263 * @brief Configure gpio mode for a dedicated pin on dedicated port.
NYX 0:85b3fd62ea1a 264 * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
NYX 0:85b3fd62ea1a 265 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 266 * @rmtoll MODER MODEy LL_GPIO_SetPinMode
NYX 0:85b3fd62ea1a 267 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 268 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 269 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 270 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 271 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 272 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 273 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 274 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 275 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 276 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 277 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 278 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 279 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 280 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 281 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 282 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 283 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 284 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 285 * @param Mode This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 286 * @arg @ref LL_GPIO_MODE_INPUT
NYX 0:85b3fd62ea1a 287 * @arg @ref LL_GPIO_MODE_OUTPUT
NYX 0:85b3fd62ea1a 288 * @arg @ref LL_GPIO_MODE_ALTERNATE
NYX 0:85b3fd62ea1a 289 * @arg @ref LL_GPIO_MODE_ANALOG
NYX 0:85b3fd62ea1a 290 * @retval None
NYX 0:85b3fd62ea1a 291 */
NYX 0:85b3fd62ea1a 292 __STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
NYX 0:85b3fd62ea1a 293 {
NYX 0:85b3fd62ea1a 294 MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U)));
NYX 0:85b3fd62ea1a 295 }
NYX 0:85b3fd62ea1a 296
NYX 0:85b3fd62ea1a 297 /**
NYX 0:85b3fd62ea1a 298 * @brief Return gpio mode for a dedicated pin on dedicated port.
NYX 0:85b3fd62ea1a 299 * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog.
NYX 0:85b3fd62ea1a 300 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 301 * @rmtoll MODER MODEy LL_GPIO_GetPinMode
NYX 0:85b3fd62ea1a 302 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 303 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 304 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 305 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 306 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 307 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 308 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 309 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 310 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 311 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 312 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 313 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 314 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 315 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 316 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 317 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 318 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 319 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 320 * @retval Returned value can be one of the following values:
NYX 0:85b3fd62ea1a 321 * @arg @ref LL_GPIO_MODE_INPUT
NYX 0:85b3fd62ea1a 322 * @arg @ref LL_GPIO_MODE_OUTPUT
NYX 0:85b3fd62ea1a 323 * @arg @ref LL_GPIO_MODE_ALTERNATE
NYX 0:85b3fd62ea1a 324 * @arg @ref LL_GPIO_MODE_ANALOG
NYX 0:85b3fd62ea1a 325 */
NYX 0:85b3fd62ea1a 326 __STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin)
NYX 0:85b3fd62ea1a 327 {
NYX 0:85b3fd62ea1a 328 return (uint32_t)(READ_BIT(GPIOx->MODER,
NYX 0:85b3fd62ea1a 329 (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U));
NYX 0:85b3fd62ea1a 330 }
NYX 0:85b3fd62ea1a 331
NYX 0:85b3fd62ea1a 332 /**
NYX 0:85b3fd62ea1a 333 * @brief Configure gpio output type for several pins on dedicated port.
NYX 0:85b3fd62ea1a 334 * @note Output type as to be set when gpio pin is in output or
NYX 0:85b3fd62ea1a 335 * alternate modes. Possible type are Push-pull or Open-drain.
NYX 0:85b3fd62ea1a 336 * @rmtoll OTYPER OTy LL_GPIO_SetPinOutputType
NYX 0:85b3fd62ea1a 337 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 338 * @param PinMask This parameter can be a combination of the following values:
NYX 0:85b3fd62ea1a 339 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 340 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 341 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 342 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 343 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 344 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 345 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 346 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 347 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 348 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 349 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 350 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 351 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 352 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 353 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 354 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 355 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 356 * @param OutputType This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 357 * @arg @ref LL_GPIO_OUTPUT_PUSHPULL
NYX 0:85b3fd62ea1a 358 * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
NYX 0:85b3fd62ea1a 359 * @retval None
NYX 0:85b3fd62ea1a 360 */
NYX 0:85b3fd62ea1a 361 __STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType)
NYX 0:85b3fd62ea1a 362 {
NYX 0:85b3fd62ea1a 363 MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType));
NYX 0:85b3fd62ea1a 364 }
NYX 0:85b3fd62ea1a 365
NYX 0:85b3fd62ea1a 366 /**
NYX 0:85b3fd62ea1a 367 * @brief Return gpio output type for several pins on dedicated port.
NYX 0:85b3fd62ea1a 368 * @note Output type as to be set when gpio pin is in output or
NYX 0:85b3fd62ea1a 369 * alternate modes. Possible type are Push-pull or Open-drain.
NYX 0:85b3fd62ea1a 370 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 371 * @rmtoll OTYPER OTy LL_GPIO_GetPinOutputType
NYX 0:85b3fd62ea1a 372 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 373 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 374 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 375 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 376 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 377 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 378 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 379 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 380 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 381 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 382 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 383 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 384 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 385 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 386 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 387 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 388 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 389 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 390 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 391 * @retval Returned value can be one of the following values:
NYX 0:85b3fd62ea1a 392 * @arg @ref LL_GPIO_OUTPUT_PUSHPULL
NYX 0:85b3fd62ea1a 393 * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN
NYX 0:85b3fd62ea1a 394 */
NYX 0:85b3fd62ea1a 395 __STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin)
NYX 0:85b3fd62ea1a 396 {
NYX 0:85b3fd62ea1a 397 return (uint32_t)(READ_BIT(GPIOx->OTYPER, Pin) >> POSITION_VAL(Pin));
NYX 0:85b3fd62ea1a 398 }
NYX 0:85b3fd62ea1a 399
NYX 0:85b3fd62ea1a 400 /**
NYX 0:85b3fd62ea1a 401 * @brief Configure gpio speed for a dedicated pin on dedicated port.
NYX 0:85b3fd62ea1a 402 * @note I/O speed can be Low, Medium, Fast or High speed.
NYX 0:85b3fd62ea1a 403 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 404 * @note Refer to datasheet for frequency specifications and the power
NYX 0:85b3fd62ea1a 405 * supply and load conditions for each speed.
NYX 0:85b3fd62ea1a 406 * @rmtoll OSPEEDR OSPEEDy LL_GPIO_SetPinSpeed
NYX 0:85b3fd62ea1a 407 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 408 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 409 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 410 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 411 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 412 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 413 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 414 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 415 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 416 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 417 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 418 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 419 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 420 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 421 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 422 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 423 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 424 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 425 * @param Speed This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 426 * @arg @ref LL_GPIO_SPEED_FREQ_LOW
NYX 0:85b3fd62ea1a 427 * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
NYX 0:85b3fd62ea1a 428 * @arg @ref LL_GPIO_SPEED_FREQ_HIGH
NYX 0:85b3fd62ea1a 429 * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
NYX 0:85b3fd62ea1a 430 * @retval None
NYX 0:85b3fd62ea1a 431 */
NYX 0:85b3fd62ea1a 432 __STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed)
NYX 0:85b3fd62ea1a 433 {
NYX 0:85b3fd62ea1a 434 MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)),
NYX 0:85b3fd62ea1a 435 (Speed << (POSITION_VAL(Pin) * 2U)));
NYX 0:85b3fd62ea1a 436 }
NYX 0:85b3fd62ea1a 437
NYX 0:85b3fd62ea1a 438 /**
NYX 0:85b3fd62ea1a 439 * @brief Return gpio speed for a dedicated pin on dedicated port.
NYX 0:85b3fd62ea1a 440 * @note I/O speed can be Low, Medium, Fast or High speed.
NYX 0:85b3fd62ea1a 441 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 442 * @note Refer to datasheet for frequency specifications and the power
NYX 0:85b3fd62ea1a 443 * supply and load conditions for each speed.
NYX 0:85b3fd62ea1a 444 * @rmtoll OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed
NYX 0:85b3fd62ea1a 445 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 446 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 447 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 448 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 449 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 450 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 451 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 452 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 453 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 454 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 455 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 456 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 457 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 458 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 459 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 460 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 461 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 462 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 463 * @retval Returned value can be one of the following values:
NYX 0:85b3fd62ea1a 464 * @arg @ref LL_GPIO_SPEED_FREQ_LOW
NYX 0:85b3fd62ea1a 465 * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM
NYX 0:85b3fd62ea1a 466 * @arg @ref LL_GPIO_SPEED_FREQ_HIGH
NYX 0:85b3fd62ea1a 467 * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH
NYX 0:85b3fd62ea1a 468 */
NYX 0:85b3fd62ea1a 469 __STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin)
NYX 0:85b3fd62ea1a 470 {
NYX 0:85b3fd62ea1a 471 return (uint32_t)(READ_BIT(GPIOx->OSPEEDR,
NYX 0:85b3fd62ea1a 472 (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U));
NYX 0:85b3fd62ea1a 473 }
NYX 0:85b3fd62ea1a 474
NYX 0:85b3fd62ea1a 475 /**
NYX 0:85b3fd62ea1a 476 * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port.
NYX 0:85b3fd62ea1a 477 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 478 * @rmtoll PUPDR PUPDy LL_GPIO_SetPinPull
NYX 0:85b3fd62ea1a 479 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 480 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 481 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 482 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 483 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 484 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 485 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 486 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 487 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 488 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 489 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 490 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 491 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 492 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 493 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 494 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 495 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 496 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 497 * @param Pull This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 498 * @arg @ref LL_GPIO_PULL_NO
NYX 0:85b3fd62ea1a 499 * @arg @ref LL_GPIO_PULL_UP
NYX 0:85b3fd62ea1a 500 * @arg @ref LL_GPIO_PULL_DOWN
NYX 0:85b3fd62ea1a 501 * @retval None
NYX 0:85b3fd62ea1a 502 */
NYX 0:85b3fd62ea1a 503 __STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull)
NYX 0:85b3fd62ea1a 504 {
NYX 0:85b3fd62ea1a 505 MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U)));
NYX 0:85b3fd62ea1a 506 }
NYX 0:85b3fd62ea1a 507
NYX 0:85b3fd62ea1a 508 /**
NYX 0:85b3fd62ea1a 509 * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port
NYX 0:85b3fd62ea1a 510 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 511 * @rmtoll PUPDR PUPDy LL_GPIO_GetPinPull
NYX 0:85b3fd62ea1a 512 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 513 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 514 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 515 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 516 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 517 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 518 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 519 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 520 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 521 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 522 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 523 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 524 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 525 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 526 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 527 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 528 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 529 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 530 * @retval Returned value can be one of the following values:
NYX 0:85b3fd62ea1a 531 * @arg @ref LL_GPIO_PULL_NO
NYX 0:85b3fd62ea1a 532 * @arg @ref LL_GPIO_PULL_UP
NYX 0:85b3fd62ea1a 533 * @arg @ref LL_GPIO_PULL_DOWN
NYX 0:85b3fd62ea1a 534 */
NYX 0:85b3fd62ea1a 535 __STATIC_INLINE uint32_t LL_GPIO_GetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin)
NYX 0:85b3fd62ea1a 536 {
NYX 0:85b3fd62ea1a 537 return (uint32_t)(READ_BIT(GPIOx->PUPDR,
NYX 0:85b3fd62ea1a 538 (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U));
NYX 0:85b3fd62ea1a 539 }
NYX 0:85b3fd62ea1a 540
NYX 0:85b3fd62ea1a 541 /**
NYX 0:85b3fd62ea1a 542 * @brief Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
NYX 0:85b3fd62ea1a 543 * @note Possible values are from AF0 to AF15 depending on target.
NYX 0:85b3fd62ea1a 544 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 545 * @rmtoll AFRL AFSELy LL_GPIO_SetAFPin_0_7
NYX 0:85b3fd62ea1a 546 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 547 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 548 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 549 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 550 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 551 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 552 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 553 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 554 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 555 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 556 * @param Alternate This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 557 * @arg @ref LL_GPIO_AF_0
NYX 0:85b3fd62ea1a 558 * @arg @ref LL_GPIO_AF_1
NYX 0:85b3fd62ea1a 559 * @arg @ref LL_GPIO_AF_2
NYX 0:85b3fd62ea1a 560 * @arg @ref LL_GPIO_AF_3
NYX 0:85b3fd62ea1a 561 * @arg @ref LL_GPIO_AF_4
NYX 0:85b3fd62ea1a 562 * @arg @ref LL_GPIO_AF_5
NYX 0:85b3fd62ea1a 563 * @arg @ref LL_GPIO_AF_6
NYX 0:85b3fd62ea1a 564 * @arg @ref LL_GPIO_AF_7
NYX 0:85b3fd62ea1a 565 * @arg @ref LL_GPIO_AF_8
NYX 0:85b3fd62ea1a 566 * @arg @ref LL_GPIO_AF_9
NYX 0:85b3fd62ea1a 567 * @arg @ref LL_GPIO_AF_10
NYX 0:85b3fd62ea1a 568 * @arg @ref LL_GPIO_AF_11
NYX 0:85b3fd62ea1a 569 * @arg @ref LL_GPIO_AF_12
NYX 0:85b3fd62ea1a 570 * @arg @ref LL_GPIO_AF_13
NYX 0:85b3fd62ea1a 571 * @arg @ref LL_GPIO_AF_14
NYX 0:85b3fd62ea1a 572 * @arg @ref LL_GPIO_AF_15
NYX 0:85b3fd62ea1a 573 * @retval None
NYX 0:85b3fd62ea1a 574 */
NYX 0:85b3fd62ea1a 575 __STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
NYX 0:85b3fd62ea1a 576 {
NYX 0:85b3fd62ea1a 577 MODIFY_REG(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U)),
NYX 0:85b3fd62ea1a 578 (Alternate << (POSITION_VAL(Pin) * 4U)));
NYX 0:85b3fd62ea1a 579 }
NYX 0:85b3fd62ea1a 580
NYX 0:85b3fd62ea1a 581 /**
NYX 0:85b3fd62ea1a 582 * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port.
NYX 0:85b3fd62ea1a 583 * @rmtoll AFRL AFSELy LL_GPIO_GetAFPin_0_7
NYX 0:85b3fd62ea1a 584 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 585 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 586 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 587 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 588 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 589 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 590 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 591 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 592 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 593 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 594 * @retval Returned value can be one of the following values:
NYX 0:85b3fd62ea1a 595 * @arg @ref LL_GPIO_AF_0
NYX 0:85b3fd62ea1a 596 * @arg @ref LL_GPIO_AF_1
NYX 0:85b3fd62ea1a 597 * @arg @ref LL_GPIO_AF_2
NYX 0:85b3fd62ea1a 598 * @arg @ref LL_GPIO_AF_3
NYX 0:85b3fd62ea1a 599 * @arg @ref LL_GPIO_AF_4
NYX 0:85b3fd62ea1a 600 * @arg @ref LL_GPIO_AF_5
NYX 0:85b3fd62ea1a 601 * @arg @ref LL_GPIO_AF_6
NYX 0:85b3fd62ea1a 602 * @arg @ref LL_GPIO_AF_7
NYX 0:85b3fd62ea1a 603 * @arg @ref LL_GPIO_AF_8
NYX 0:85b3fd62ea1a 604 * @arg @ref LL_GPIO_AF_9
NYX 0:85b3fd62ea1a 605 * @arg @ref LL_GPIO_AF_10
NYX 0:85b3fd62ea1a 606 * @arg @ref LL_GPIO_AF_11
NYX 0:85b3fd62ea1a 607 * @arg @ref LL_GPIO_AF_12
NYX 0:85b3fd62ea1a 608 * @arg @ref LL_GPIO_AF_13
NYX 0:85b3fd62ea1a 609 * @arg @ref LL_GPIO_AF_14
NYX 0:85b3fd62ea1a 610 * @arg @ref LL_GPIO_AF_15
NYX 0:85b3fd62ea1a 611 */
NYX 0:85b3fd62ea1a 612 __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin)
NYX 0:85b3fd62ea1a 613 {
NYX 0:85b3fd62ea1a 614 return (uint32_t)(READ_BIT(GPIOx->AFR[0],
NYX 0:85b3fd62ea1a 615 (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U))) >> (POSITION_VAL(Pin) * 4U));
NYX 0:85b3fd62ea1a 616 }
NYX 0:85b3fd62ea1a 617
NYX 0:85b3fd62ea1a 618 /**
NYX 0:85b3fd62ea1a 619 * @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
NYX 0:85b3fd62ea1a 620 * @note Possible values are from AF0 to AF15 depending on target.
NYX 0:85b3fd62ea1a 621 * @note Warning: only one pin can be passed as parameter.
NYX 0:85b3fd62ea1a 622 * @rmtoll AFRH AFSELy LL_GPIO_SetAFPin_8_15
NYX 0:85b3fd62ea1a 623 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 624 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 625 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 626 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 627 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 628 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 629 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 630 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 631 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 632 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 633 * @param Alternate This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 634 * @arg @ref LL_GPIO_AF_0
NYX 0:85b3fd62ea1a 635 * @arg @ref LL_GPIO_AF_1
NYX 0:85b3fd62ea1a 636 * @arg @ref LL_GPIO_AF_2
NYX 0:85b3fd62ea1a 637 * @arg @ref LL_GPIO_AF_3
NYX 0:85b3fd62ea1a 638 * @arg @ref LL_GPIO_AF_4
NYX 0:85b3fd62ea1a 639 * @arg @ref LL_GPIO_AF_5
NYX 0:85b3fd62ea1a 640 * @arg @ref LL_GPIO_AF_6
NYX 0:85b3fd62ea1a 641 * @arg @ref LL_GPIO_AF_7
NYX 0:85b3fd62ea1a 642 * @arg @ref LL_GPIO_AF_8
NYX 0:85b3fd62ea1a 643 * @arg @ref LL_GPIO_AF_9
NYX 0:85b3fd62ea1a 644 * @arg @ref LL_GPIO_AF_10
NYX 0:85b3fd62ea1a 645 * @arg @ref LL_GPIO_AF_11
NYX 0:85b3fd62ea1a 646 * @arg @ref LL_GPIO_AF_12
NYX 0:85b3fd62ea1a 647 * @arg @ref LL_GPIO_AF_13
NYX 0:85b3fd62ea1a 648 * @arg @ref LL_GPIO_AF_14
NYX 0:85b3fd62ea1a 649 * @arg @ref LL_GPIO_AF_15
NYX 0:85b3fd62ea1a 650 * @retval None
NYX 0:85b3fd62ea1a 651 */
NYX 0:85b3fd62ea1a 652 __STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate)
NYX 0:85b3fd62ea1a 653 {
NYX 0:85b3fd62ea1a 654 MODIFY_REG(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U)),
NYX 0:85b3fd62ea1a 655 (Alternate << (POSITION_VAL(Pin >> 8U) * 4U)));
NYX 0:85b3fd62ea1a 656 }
NYX 0:85b3fd62ea1a 657
NYX 0:85b3fd62ea1a 658 /**
NYX 0:85b3fd62ea1a 659 * @brief Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port.
NYX 0:85b3fd62ea1a 660 * @note Possible values are from AF0 to AF15 depending on target.
NYX 0:85b3fd62ea1a 661 * @rmtoll AFRH AFSELy LL_GPIO_GetAFPin_8_15
NYX 0:85b3fd62ea1a 662 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 663 * @param Pin This parameter can be one of the following values:
NYX 0:85b3fd62ea1a 664 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 665 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 666 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 667 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 668 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 669 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 670 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 671 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 672 * @retval Returned value can be one of the following values:
NYX 0:85b3fd62ea1a 673 * @arg @ref LL_GPIO_AF_0
NYX 0:85b3fd62ea1a 674 * @arg @ref LL_GPIO_AF_1
NYX 0:85b3fd62ea1a 675 * @arg @ref LL_GPIO_AF_2
NYX 0:85b3fd62ea1a 676 * @arg @ref LL_GPIO_AF_3
NYX 0:85b3fd62ea1a 677 * @arg @ref LL_GPIO_AF_4
NYX 0:85b3fd62ea1a 678 * @arg @ref LL_GPIO_AF_5
NYX 0:85b3fd62ea1a 679 * @arg @ref LL_GPIO_AF_6
NYX 0:85b3fd62ea1a 680 * @arg @ref LL_GPIO_AF_7
NYX 0:85b3fd62ea1a 681 * @arg @ref LL_GPIO_AF_8
NYX 0:85b3fd62ea1a 682 * @arg @ref LL_GPIO_AF_9
NYX 0:85b3fd62ea1a 683 * @arg @ref LL_GPIO_AF_10
NYX 0:85b3fd62ea1a 684 * @arg @ref LL_GPIO_AF_11
NYX 0:85b3fd62ea1a 685 * @arg @ref LL_GPIO_AF_12
NYX 0:85b3fd62ea1a 686 * @arg @ref LL_GPIO_AF_13
NYX 0:85b3fd62ea1a 687 * @arg @ref LL_GPIO_AF_14
NYX 0:85b3fd62ea1a 688 * @arg @ref LL_GPIO_AF_15
NYX 0:85b3fd62ea1a 689 */
NYX 0:85b3fd62ea1a 690 __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin)
NYX 0:85b3fd62ea1a 691 {
NYX 0:85b3fd62ea1a 692 return (uint32_t)(READ_BIT(GPIOx->AFR[1],
NYX 0:85b3fd62ea1a 693 (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U))) >> (POSITION_VAL(Pin >> 8U) * 4U));
NYX 0:85b3fd62ea1a 694 }
NYX 0:85b3fd62ea1a 695
NYX 0:85b3fd62ea1a 696
NYX 0:85b3fd62ea1a 697 /**
NYX 0:85b3fd62ea1a 698 * @brief Lock configuration of several pins for a dedicated port.
NYX 0:85b3fd62ea1a 699 * @note When the lock sequence has been applied on a port bit, the
NYX 0:85b3fd62ea1a 700 * value of this port bit can no longer be modified until the
NYX 0:85b3fd62ea1a 701 * next reset.
NYX 0:85b3fd62ea1a 702 * @note Each lock bit freezes a specific configuration register
NYX 0:85b3fd62ea1a 703 * (control and alternate function registers).
NYX 0:85b3fd62ea1a 704 * @rmtoll LCKR LCKK LL_GPIO_LockPin
NYX 0:85b3fd62ea1a 705 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 706 * @param PinMask This parameter can be a combination of the following values:
NYX 0:85b3fd62ea1a 707 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 708 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 709 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 710 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 711 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 712 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 713 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 714 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 715 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 716 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 717 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 718 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 719 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 720 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 721 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 722 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 723 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 724 * @retval None
NYX 0:85b3fd62ea1a 725 */
NYX 0:85b3fd62ea1a 726 __STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
NYX 0:85b3fd62ea1a 727 {
NYX 0:85b3fd62ea1a 728 __IO uint32_t temp;
NYX 0:85b3fd62ea1a 729 WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
NYX 0:85b3fd62ea1a 730 WRITE_REG(GPIOx->LCKR, PinMask);
NYX 0:85b3fd62ea1a 731 WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask);
NYX 0:85b3fd62ea1a 732 temp = READ_REG(GPIOx->LCKR);
NYX 0:85b3fd62ea1a 733 (void) temp;
NYX 0:85b3fd62ea1a 734 }
NYX 0:85b3fd62ea1a 735
NYX 0:85b3fd62ea1a 736 /**
NYX 0:85b3fd62ea1a 737 * @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0.
NYX 0:85b3fd62ea1a 738 * @rmtoll LCKR LCKy LL_GPIO_IsPinLocked
NYX 0:85b3fd62ea1a 739 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 740 * @param PinMask This parameter can be a combination of the following values:
NYX 0:85b3fd62ea1a 741 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 742 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 743 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 744 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 745 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 746 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 747 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 748 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 749 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 750 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 751 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 752 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 753 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 754 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 755 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 756 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 757 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 758 * @retval State of bit (1 or 0).
NYX 0:85b3fd62ea1a 759 */
NYX 0:85b3fd62ea1a 760 __STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(GPIO_TypeDef *GPIOx, uint32_t PinMask)
NYX 0:85b3fd62ea1a 761 {
NYX 0:85b3fd62ea1a 762 return (READ_BIT(GPIOx->LCKR, PinMask) == (PinMask));
NYX 0:85b3fd62ea1a 763 }
NYX 0:85b3fd62ea1a 764
NYX 0:85b3fd62ea1a 765 /**
NYX 0:85b3fd62ea1a 766 * @brief Return 1 if one of the pin of a dedicated port is locked. else return 0.
NYX 0:85b3fd62ea1a 767 * @rmtoll LCKR LCKK LL_GPIO_IsAnyPinLocked
NYX 0:85b3fd62ea1a 768 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 769 * @retval State of bit (1 or 0).
NYX 0:85b3fd62ea1a 770 */
NYX 0:85b3fd62ea1a 771 __STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(GPIO_TypeDef *GPIOx)
NYX 0:85b3fd62ea1a 772 {
NYX 0:85b3fd62ea1a 773 return (READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK));
NYX 0:85b3fd62ea1a 774 }
NYX 0:85b3fd62ea1a 775
NYX 0:85b3fd62ea1a 776 /**
NYX 0:85b3fd62ea1a 777 * @}
NYX 0:85b3fd62ea1a 778 */
NYX 0:85b3fd62ea1a 779
NYX 0:85b3fd62ea1a 780 /** @defgroup GPIO_LL_EF_Data_Access Data Access
NYX 0:85b3fd62ea1a 781 * @{
NYX 0:85b3fd62ea1a 782 */
NYX 0:85b3fd62ea1a 783
NYX 0:85b3fd62ea1a 784 /**
NYX 0:85b3fd62ea1a 785 * @brief Return full input data register value for a dedicated port.
NYX 0:85b3fd62ea1a 786 * @rmtoll IDR IDy LL_GPIO_ReadInputPort
NYX 0:85b3fd62ea1a 787 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 788 * @retval Input data register value of port
NYX 0:85b3fd62ea1a 789 */
NYX 0:85b3fd62ea1a 790 __STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(GPIO_TypeDef *GPIOx)
NYX 0:85b3fd62ea1a 791 {
NYX 0:85b3fd62ea1a 792 return (uint32_t)(READ_REG(GPIOx->IDR));
NYX 0:85b3fd62ea1a 793 }
NYX 0:85b3fd62ea1a 794
NYX 0:85b3fd62ea1a 795 /**
NYX 0:85b3fd62ea1a 796 * @brief Return if input data level for several pins of dedicated port is high or low.
NYX 0:85b3fd62ea1a 797 * @rmtoll IDR IDy LL_GPIO_IsInputPinSet
NYX 0:85b3fd62ea1a 798 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 799 * @param PinMask This parameter can be a combination of the following values:
NYX 0:85b3fd62ea1a 800 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 801 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 802 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 803 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 804 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 805 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 806 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 807 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 808 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 809 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 810 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 811 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 812 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 813 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 814 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 815 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 816 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 817 * @retval State of bit (1 or 0).
NYX 0:85b3fd62ea1a 818 */
NYX 0:85b3fd62ea1a 819 __STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
NYX 0:85b3fd62ea1a 820 {
NYX 0:85b3fd62ea1a 821 return (READ_BIT(GPIOx->IDR, PinMask) == (PinMask));
NYX 0:85b3fd62ea1a 822 }
NYX 0:85b3fd62ea1a 823
NYX 0:85b3fd62ea1a 824 /**
NYX 0:85b3fd62ea1a 825 * @brief Write output data register for the port.
NYX 0:85b3fd62ea1a 826 * @rmtoll ODR ODy LL_GPIO_WriteOutputPort
NYX 0:85b3fd62ea1a 827 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 828 * @param PortValue Level value for each pin of the port
NYX 0:85b3fd62ea1a 829 * @retval None
NYX 0:85b3fd62ea1a 830 */
NYX 0:85b3fd62ea1a 831 __STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue)
NYX 0:85b3fd62ea1a 832 {
NYX 0:85b3fd62ea1a 833 WRITE_REG(GPIOx->ODR, PortValue);
NYX 0:85b3fd62ea1a 834 }
NYX 0:85b3fd62ea1a 835
NYX 0:85b3fd62ea1a 836 /**
NYX 0:85b3fd62ea1a 837 * @brief Return full output data register value for a dedicated port.
NYX 0:85b3fd62ea1a 838 * @rmtoll ODR ODy LL_GPIO_ReadOutputPort
NYX 0:85b3fd62ea1a 839 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 840 * @retval Output data register value of port
NYX 0:85b3fd62ea1a 841 */
NYX 0:85b3fd62ea1a 842 __STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(GPIO_TypeDef *GPIOx)
NYX 0:85b3fd62ea1a 843 {
NYX 0:85b3fd62ea1a 844 return (uint32_t)(READ_REG(GPIOx->ODR));
NYX 0:85b3fd62ea1a 845 }
NYX 0:85b3fd62ea1a 846
NYX 0:85b3fd62ea1a 847 /**
NYX 0:85b3fd62ea1a 848 * @brief Return if input data level for several pins of dedicated port is high or low.
NYX 0:85b3fd62ea1a 849 * @rmtoll ODR ODy LL_GPIO_IsOutputPinSet
NYX 0:85b3fd62ea1a 850 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 851 * @param PinMask This parameter can be a combination of the following values:
NYX 0:85b3fd62ea1a 852 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 853 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 854 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 855 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 856 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 857 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 858 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 859 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 860 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 861 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 862 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 863 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 864 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 865 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 866 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 867 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 868 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 869 * @retval State of bit (1 or 0).
NYX 0:85b3fd62ea1a 870 */
NYX 0:85b3fd62ea1a 871 __STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask)
NYX 0:85b3fd62ea1a 872 {
NYX 0:85b3fd62ea1a 873 return (READ_BIT(GPIOx->ODR, PinMask) == (PinMask));
NYX 0:85b3fd62ea1a 874 }
NYX 0:85b3fd62ea1a 875
NYX 0:85b3fd62ea1a 876 /**
NYX 0:85b3fd62ea1a 877 * @brief Set several pins to high level on dedicated gpio port.
NYX 0:85b3fd62ea1a 878 * @rmtoll BSRR BSy LL_GPIO_SetOutputPin
NYX 0:85b3fd62ea1a 879 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 880 * @param PinMask This parameter can be a combination of the following values:
NYX 0:85b3fd62ea1a 881 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 882 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 883 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 884 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 885 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 886 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 887 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 888 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 889 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 890 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 891 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 892 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 893 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 894 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 895 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 896 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 897 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 898 * @retval None
NYX 0:85b3fd62ea1a 899 */
NYX 0:85b3fd62ea1a 900 __STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
NYX 0:85b3fd62ea1a 901 {
NYX 0:85b3fd62ea1a 902 WRITE_REG(GPIOx->BSRR, PinMask);
NYX 0:85b3fd62ea1a 903 }
NYX 0:85b3fd62ea1a 904
NYX 0:85b3fd62ea1a 905 /**
NYX 0:85b3fd62ea1a 906 * @brief Set several pins to low level on dedicated gpio port.
NYX 0:85b3fd62ea1a 907 * @rmtoll BSRR BRy LL_GPIO_ResetOutputPin
NYX 0:85b3fd62ea1a 908 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 909 * @param PinMask This parameter can be a combination of the following values:
NYX 0:85b3fd62ea1a 910 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 911 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 912 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 913 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 914 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 915 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 916 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 917 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 918 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 919 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 920 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 921 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 922 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 923 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 924 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 925 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 926 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 927 * @retval None
NYX 0:85b3fd62ea1a 928 */
NYX 0:85b3fd62ea1a 929 __STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
NYX 0:85b3fd62ea1a 930 {
NYX 0:85b3fd62ea1a 931 WRITE_REG(GPIOx->BSRR, (PinMask << 16));
NYX 0:85b3fd62ea1a 932 }
NYX 0:85b3fd62ea1a 933
NYX 0:85b3fd62ea1a 934 /**
NYX 0:85b3fd62ea1a 935 * @brief Toggle data value for several pin of dedicated port.
NYX 0:85b3fd62ea1a 936 * @rmtoll ODR ODy LL_GPIO_TogglePin
NYX 0:85b3fd62ea1a 937 * @param GPIOx GPIO Port
NYX 0:85b3fd62ea1a 938 * @param PinMask This parameter can be a combination of the following values:
NYX 0:85b3fd62ea1a 939 * @arg @ref LL_GPIO_PIN_0
NYX 0:85b3fd62ea1a 940 * @arg @ref LL_GPIO_PIN_1
NYX 0:85b3fd62ea1a 941 * @arg @ref LL_GPIO_PIN_2
NYX 0:85b3fd62ea1a 942 * @arg @ref LL_GPIO_PIN_3
NYX 0:85b3fd62ea1a 943 * @arg @ref LL_GPIO_PIN_4
NYX 0:85b3fd62ea1a 944 * @arg @ref LL_GPIO_PIN_5
NYX 0:85b3fd62ea1a 945 * @arg @ref LL_GPIO_PIN_6
NYX 0:85b3fd62ea1a 946 * @arg @ref LL_GPIO_PIN_7
NYX 0:85b3fd62ea1a 947 * @arg @ref LL_GPIO_PIN_8
NYX 0:85b3fd62ea1a 948 * @arg @ref LL_GPIO_PIN_9
NYX 0:85b3fd62ea1a 949 * @arg @ref LL_GPIO_PIN_10
NYX 0:85b3fd62ea1a 950 * @arg @ref LL_GPIO_PIN_11
NYX 0:85b3fd62ea1a 951 * @arg @ref LL_GPIO_PIN_12
NYX 0:85b3fd62ea1a 952 * @arg @ref LL_GPIO_PIN_13
NYX 0:85b3fd62ea1a 953 * @arg @ref LL_GPIO_PIN_14
NYX 0:85b3fd62ea1a 954 * @arg @ref LL_GPIO_PIN_15
NYX 0:85b3fd62ea1a 955 * @arg @ref LL_GPIO_PIN_ALL
NYX 0:85b3fd62ea1a 956 * @retval None
NYX 0:85b3fd62ea1a 957 */
NYX 0:85b3fd62ea1a 958 __STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask)
NYX 0:85b3fd62ea1a 959 {
NYX 0:85b3fd62ea1a 960 WRITE_REG(GPIOx->ODR, READ_REG(GPIOx->ODR) ^ PinMask);
NYX 0:85b3fd62ea1a 961 }
NYX 0:85b3fd62ea1a 962
NYX 0:85b3fd62ea1a 963 /**
NYX 0:85b3fd62ea1a 964 * @}
NYX 0:85b3fd62ea1a 965 */
NYX 0:85b3fd62ea1a 966
NYX 0:85b3fd62ea1a 967 #if defined(USE_FULL_LL_DRIVER)
NYX 0:85b3fd62ea1a 968 /** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions
NYX 0:85b3fd62ea1a 969 * @{
NYX 0:85b3fd62ea1a 970 */
NYX 0:85b3fd62ea1a 971
NYX 0:85b3fd62ea1a 972 ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx);
NYX 0:85b3fd62ea1a 973 ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct);
NYX 0:85b3fd62ea1a 974 void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct);
NYX 0:85b3fd62ea1a 975
NYX 0:85b3fd62ea1a 976 /**
NYX 0:85b3fd62ea1a 977 * @}
NYX 0:85b3fd62ea1a 978 */
NYX 0:85b3fd62ea1a 979 #endif /* USE_FULL_LL_DRIVER */
NYX 0:85b3fd62ea1a 980
NYX 0:85b3fd62ea1a 981 /**
NYX 0:85b3fd62ea1a 982 * @}
NYX 0:85b3fd62ea1a 983 */
NYX 0:85b3fd62ea1a 984
NYX 0:85b3fd62ea1a 985 /**
NYX 0:85b3fd62ea1a 986 * @}
NYX 0:85b3fd62ea1a 987 */
NYX 0:85b3fd62ea1a 988
NYX 0:85b3fd62ea1a 989 #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || defined (GPIOI) || defined (GPIOJ) || defined (GPIOK) */
NYX 0:85b3fd62ea1a 990 /**
NYX 0:85b3fd62ea1a 991 * @}
NYX 0:85b3fd62ea1a 992 */
NYX 0:85b3fd62ea1a 993
NYX 0:85b3fd62ea1a 994 #ifdef __cplusplus
NYX 0:85b3fd62ea1a 995 }
NYX 0:85b3fd62ea1a 996 #endif
NYX 0:85b3fd62ea1a 997
NYX 0:85b3fd62ea1a 998 #endif /* __STM32F4xx_LL_GPIO_H */
NYX 0:85b3fd62ea1a 999
NYX 0:85b3fd62ea1a 1000 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/