STM32F439xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32f4xx_ll_gpio.h 00004 * @author MCD Application Team 00005 * @brief Header file of GPIO LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> 00010 * 00011 * Redistribution and use in source and binary forms, with or without modification, 00012 * are permitted provided that the following conditions are met: 00013 * 1. Redistributions of source code must retain the above copyright notice, 00014 * this list of conditions and the following disclaimer. 00015 * 2. Redistributions in binary form must reproduce the above copyright notice, 00016 * this list of conditions and the following disclaimer in the documentation 00017 * and/or other materials provided with the distribution. 00018 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00019 * may be used to endorse or promote products derived from this software 00020 * without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00023 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00024 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00025 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00026 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00027 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00028 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00030 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00031 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00032 * 00033 ****************************************************************************** 00034 */ 00035 00036 /* Define to prevent recursive inclusion -------------------------------------*/ 00037 #ifndef __STM32F4xx_LL_GPIO_H 00038 #define __STM32F4xx_LL_GPIO_H 00039 00040 #ifdef __cplusplus 00041 extern "C" { 00042 #endif 00043 00044 /* Includes ------------------------------------------------------------------*/ 00045 #include "stm32f4xx.h" 00046 00047 /** @addtogroup STM32F4xx_LL_Driver 00048 * @{ 00049 */ 00050 00051 #if defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || defined (GPIOI) || defined (GPIOJ) || defined (GPIOK) 00052 00053 /** @defgroup GPIO_LL GPIO 00054 * @{ 00055 */ 00056 00057 /* Private types -------------------------------------------------------------*/ 00058 /* Private variables ---------------------------------------------------------*/ 00059 /* Private constants ---------------------------------------------------------*/ 00060 /* Private macros ------------------------------------------------------------*/ 00061 #if defined(USE_FULL_LL_DRIVER) 00062 /** @defgroup GPIO_LL_Private_Macros GPIO Private Macros 00063 * @{ 00064 */ 00065 00066 /** 00067 * @} 00068 */ 00069 #endif /*USE_FULL_LL_DRIVER*/ 00070 00071 /* Exported types ------------------------------------------------------------*/ 00072 #if defined(USE_FULL_LL_DRIVER) 00073 /** @defgroup GPIO_LL_ES_INIT GPIO Exported Init structures 00074 * @{ 00075 */ 00076 00077 /** 00078 * @brief LL GPIO Init Structure definition 00079 */ 00080 typedef struct 00081 { 00082 uint32_t Pin; /*!< Specifies the GPIO pins to be configured. 00083 This parameter can be any value of @ref GPIO_LL_EC_PIN */ 00084 00085 uint32_t Mode; /*!< Specifies the operating mode for the selected pins. 00086 This parameter can be a value of @ref GPIO_LL_EC_MODE. 00087 00088 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinMode().*/ 00089 00090 uint32_t Speed; /*!< Specifies the speed for the selected pins. 00091 This parameter can be a value of @ref GPIO_LL_EC_SPEED. 00092 00093 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinSpeed().*/ 00094 00095 uint32_t OutputType; /*!< Specifies the operating output type for the selected pins. 00096 This parameter can be a value of @ref GPIO_LL_EC_OUTPUT. 00097 00098 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinOutputType().*/ 00099 00100 uint32_t Pull; /*!< Specifies the operating Pull-up/Pull down for the selected pins. 00101 This parameter can be a value of @ref GPIO_LL_EC_PULL. 00102 00103 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetPinPull().*/ 00104 00105 uint32_t Alternate; /*!< Specifies the Peripheral to be connected to the selected pins. 00106 This parameter can be a value of @ref GPIO_LL_EC_AF. 00107 00108 GPIO HW configuration can be modified afterwards using unitary function @ref LL_GPIO_SetAFPin_0_7() and LL_GPIO_SetAFPin_8_15().*/ 00109 } LL_GPIO_InitTypeDef; 00110 00111 /** 00112 * @} 00113 */ 00114 #endif /* USE_FULL_LL_DRIVER */ 00115 00116 /* Exported constants --------------------------------------------------------*/ 00117 /** @defgroup GPIO_LL_Exported_Constants GPIO Exported Constants 00118 * @{ 00119 */ 00120 00121 /** @defgroup GPIO_LL_EC_PIN PIN 00122 * @{ 00123 */ 00124 #define LL_GPIO_PIN_0 GPIO_BSRR_BS_0 /*!< Select pin 0 */ 00125 #define LL_GPIO_PIN_1 GPIO_BSRR_BS_1 /*!< Select pin 1 */ 00126 #define LL_GPIO_PIN_2 GPIO_BSRR_BS_2 /*!< Select pin 2 */ 00127 #define LL_GPIO_PIN_3 GPIO_BSRR_BS_3 /*!< Select pin 3 */ 00128 #define LL_GPIO_PIN_4 GPIO_BSRR_BS_4 /*!< Select pin 4 */ 00129 #define LL_GPIO_PIN_5 GPIO_BSRR_BS_5 /*!< Select pin 5 */ 00130 #define LL_GPIO_PIN_6 GPIO_BSRR_BS_6 /*!< Select pin 6 */ 00131 #define LL_GPIO_PIN_7 GPIO_BSRR_BS_7 /*!< Select pin 7 */ 00132 #define LL_GPIO_PIN_8 GPIO_BSRR_BS_8 /*!< Select pin 8 */ 00133 #define LL_GPIO_PIN_9 GPIO_BSRR_BS_9 /*!< Select pin 9 */ 00134 #define LL_GPIO_PIN_10 GPIO_BSRR_BS_10 /*!< Select pin 10 */ 00135 #define LL_GPIO_PIN_11 GPIO_BSRR_BS_11 /*!< Select pin 11 */ 00136 #define LL_GPIO_PIN_12 GPIO_BSRR_BS_12 /*!< Select pin 12 */ 00137 #define LL_GPIO_PIN_13 GPIO_BSRR_BS_13 /*!< Select pin 13 */ 00138 #define LL_GPIO_PIN_14 GPIO_BSRR_BS_14 /*!< Select pin 14 */ 00139 #define LL_GPIO_PIN_15 GPIO_BSRR_BS_15 /*!< Select pin 15 */ 00140 #define LL_GPIO_PIN_ALL (GPIO_BSRR_BS_0 | GPIO_BSRR_BS_1 | GPIO_BSRR_BS_2 | \ 00141 GPIO_BSRR_BS_3 | GPIO_BSRR_BS_4 | GPIO_BSRR_BS_5 | \ 00142 GPIO_BSRR_BS_6 | GPIO_BSRR_BS_7 | GPIO_BSRR_BS_8 | \ 00143 GPIO_BSRR_BS_9 | GPIO_BSRR_BS_10 | GPIO_BSRR_BS_11 | \ 00144 GPIO_BSRR_BS_12 | GPIO_BSRR_BS_13 | GPIO_BSRR_BS_14 | \ 00145 GPIO_BSRR_BS_15) /*!< Select all pins */ 00146 /** 00147 * @} 00148 */ 00149 00150 /** @defgroup GPIO_LL_EC_MODE Mode 00151 * @{ 00152 */ 00153 #define LL_GPIO_MODE_INPUT (0x00000000U) /*!< Select input mode */ 00154 #define LL_GPIO_MODE_OUTPUT GPIO_MODER_MODER0_0 /*!< Select output mode */ 00155 #define LL_GPIO_MODE_ALTERNATE GPIO_MODER_MODER0_1 /*!< Select alternate function mode */ 00156 #define LL_GPIO_MODE_ANALOG GPIO_MODER_MODER0 /*!< Select analog mode */ 00157 /** 00158 * @} 00159 */ 00160 00161 /** @defgroup GPIO_LL_EC_OUTPUT Output Type 00162 * @{ 00163 */ 00164 #define LL_GPIO_OUTPUT_PUSHPULL (0x00000000U) /*!< Select push-pull as output type */ 00165 #define LL_GPIO_OUTPUT_OPENDRAIN GPIO_OTYPER_OT_0 /*!< Select open-drain as output type */ 00166 /** 00167 * @} 00168 */ 00169 00170 /** @defgroup GPIO_LL_EC_SPEED Output Speed 00171 * @{ 00172 */ 00173 #define LL_GPIO_SPEED_FREQ_LOW (0x00000000U) /*!< Select I/O low output speed */ 00174 #define LL_GPIO_SPEED_FREQ_MEDIUM GPIO_OSPEEDER_OSPEEDR0_0 /*!< Select I/O medium output speed */ 00175 #define LL_GPIO_SPEED_FREQ_HIGH GPIO_OSPEEDER_OSPEEDR0_1 /*!< Select I/O fast output speed */ 00176 #define LL_GPIO_SPEED_FREQ_VERY_HIGH GPIO_OSPEEDER_OSPEEDR0 /*!< Select I/O high output speed */ 00177 /** 00178 * @} 00179 */ 00180 00181 /** @defgroup GPIO_LL_EC_PULL Pull Up Pull Down 00182 * @{ 00183 */ 00184 #define LL_GPIO_PULL_NO (0x00000000U) /*!< Select I/O no pull */ 00185 #define LL_GPIO_PULL_UP GPIO_PUPDR_PUPDR0_0 /*!< Select I/O pull up */ 00186 #define LL_GPIO_PULL_DOWN GPIO_PUPDR_PUPDR0_1 /*!< Select I/O pull down */ 00187 /** 00188 * @} 00189 */ 00190 00191 /** @defgroup GPIO_LL_EC_AF Alternate Function 00192 * @{ 00193 */ 00194 #define LL_GPIO_AF_0 (0x0000000U) /*!< Select alternate function 0 */ 00195 #define LL_GPIO_AF_1 (0x0000001U) /*!< Select alternate function 1 */ 00196 #define LL_GPIO_AF_2 (0x0000002U) /*!< Select alternate function 2 */ 00197 #define LL_GPIO_AF_3 (0x0000003U) /*!< Select alternate function 3 */ 00198 #define LL_GPIO_AF_4 (0x0000004U) /*!< Select alternate function 4 */ 00199 #define LL_GPIO_AF_5 (0x0000005U) /*!< Select alternate function 5 */ 00200 #define LL_GPIO_AF_6 (0x0000006U) /*!< Select alternate function 6 */ 00201 #define LL_GPIO_AF_7 (0x0000007U) /*!< Select alternate function 7 */ 00202 #define LL_GPIO_AF_8 (0x0000008U) /*!< Select alternate function 8 */ 00203 #define LL_GPIO_AF_9 (0x0000009U) /*!< Select alternate function 9 */ 00204 #define LL_GPIO_AF_10 (0x000000AU) /*!< Select alternate function 10 */ 00205 #define LL_GPIO_AF_11 (0x000000BU) /*!< Select alternate function 11 */ 00206 #define LL_GPIO_AF_12 (0x000000CU) /*!< Select alternate function 12 */ 00207 #define LL_GPIO_AF_13 (0x000000DU) /*!< Select alternate function 13 */ 00208 #define LL_GPIO_AF_14 (0x000000EU) /*!< Select alternate function 14 */ 00209 #define LL_GPIO_AF_15 (0x000000FU) /*!< Select alternate function 15 */ 00210 /** 00211 * @} 00212 */ 00213 00214 /** 00215 * @} 00216 */ 00217 00218 /* Exported macro ------------------------------------------------------------*/ 00219 /** @defgroup GPIO_LL_Exported_Macros GPIO Exported Macros 00220 * @{ 00221 */ 00222 00223 /** @defgroup GPIO_LL_EM_WRITE_READ Common Write and read registers Macros 00224 * @{ 00225 */ 00226 00227 /** 00228 * @brief Write a value in GPIO register 00229 * @param __INSTANCE__ GPIO Instance 00230 * @param __REG__ Register to be written 00231 * @param __VALUE__ Value to be written in the register 00232 * @retval None 00233 */ 00234 #define LL_GPIO_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00235 00236 /** 00237 * @brief Read a value in GPIO register 00238 * @param __INSTANCE__ GPIO Instance 00239 * @param __REG__ Register to be read 00240 * @retval Register value 00241 */ 00242 #define LL_GPIO_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00243 /** 00244 * @} 00245 */ 00246 00247 /** 00248 * @} 00249 */ 00250 00251 /* Exported functions --------------------------------------------------------*/ 00252 /** @defgroup GPIO_LL_Exported_Functions GPIO Exported Functions 00253 * @{ 00254 */ 00255 00256 /** @defgroup GPIO_LL_EF_Port_Configuration Port Configuration 00257 * @{ 00258 */ 00259 00260 /** 00261 * @brief Configure gpio mode for a dedicated pin on dedicated port. 00262 * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog. 00263 * @note Warning: only one pin can be passed as parameter. 00264 * @rmtoll MODER MODEy LL_GPIO_SetPinMode 00265 * @param GPIOx GPIO Port 00266 * @param Pin This parameter can be one of the following values: 00267 * @arg @ref LL_GPIO_PIN_0 00268 * @arg @ref LL_GPIO_PIN_1 00269 * @arg @ref LL_GPIO_PIN_2 00270 * @arg @ref LL_GPIO_PIN_3 00271 * @arg @ref LL_GPIO_PIN_4 00272 * @arg @ref LL_GPIO_PIN_5 00273 * @arg @ref LL_GPIO_PIN_6 00274 * @arg @ref LL_GPIO_PIN_7 00275 * @arg @ref LL_GPIO_PIN_8 00276 * @arg @ref LL_GPIO_PIN_9 00277 * @arg @ref LL_GPIO_PIN_10 00278 * @arg @ref LL_GPIO_PIN_11 00279 * @arg @ref LL_GPIO_PIN_12 00280 * @arg @ref LL_GPIO_PIN_13 00281 * @arg @ref LL_GPIO_PIN_14 00282 * @arg @ref LL_GPIO_PIN_15 00283 * @param Mode This parameter can be one of the following values: 00284 * @arg @ref LL_GPIO_MODE_INPUT 00285 * @arg @ref LL_GPIO_MODE_OUTPUT 00286 * @arg @ref LL_GPIO_MODE_ALTERNATE 00287 * @arg @ref LL_GPIO_MODE_ANALOG 00288 * @retval None 00289 */ 00290 __STATIC_INLINE void LL_GPIO_SetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode) 00291 { 00292 MODIFY_REG(GPIOx->MODER, (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U)), (Mode << (POSITION_VAL(Pin) * 2U))); 00293 } 00294 00295 /** 00296 * @brief Return gpio mode for a dedicated pin on dedicated port. 00297 * @note I/O mode can be Input mode, General purpose output, Alternate function mode or Analog. 00298 * @note Warning: only one pin can be passed as parameter. 00299 * @rmtoll MODER MODEy LL_GPIO_GetPinMode 00300 * @param GPIOx GPIO Port 00301 * @param Pin This parameter can be one of the following values: 00302 * @arg @ref LL_GPIO_PIN_0 00303 * @arg @ref LL_GPIO_PIN_1 00304 * @arg @ref LL_GPIO_PIN_2 00305 * @arg @ref LL_GPIO_PIN_3 00306 * @arg @ref LL_GPIO_PIN_4 00307 * @arg @ref LL_GPIO_PIN_5 00308 * @arg @ref LL_GPIO_PIN_6 00309 * @arg @ref LL_GPIO_PIN_7 00310 * @arg @ref LL_GPIO_PIN_8 00311 * @arg @ref LL_GPIO_PIN_9 00312 * @arg @ref LL_GPIO_PIN_10 00313 * @arg @ref LL_GPIO_PIN_11 00314 * @arg @ref LL_GPIO_PIN_12 00315 * @arg @ref LL_GPIO_PIN_13 00316 * @arg @ref LL_GPIO_PIN_14 00317 * @arg @ref LL_GPIO_PIN_15 00318 * @retval Returned value can be one of the following values: 00319 * @arg @ref LL_GPIO_MODE_INPUT 00320 * @arg @ref LL_GPIO_MODE_OUTPUT 00321 * @arg @ref LL_GPIO_MODE_ALTERNATE 00322 * @arg @ref LL_GPIO_MODE_ANALOG 00323 */ 00324 __STATIC_INLINE uint32_t LL_GPIO_GetPinMode(GPIO_TypeDef *GPIOx, uint32_t Pin) 00325 { 00326 return (uint32_t)(READ_BIT(GPIOx->MODER, 00327 (GPIO_MODER_MODER0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U)); 00328 } 00329 00330 /** 00331 * @brief Configure gpio output type for several pins on dedicated port. 00332 * @note Output type as to be set when gpio pin is in output or 00333 * alternate modes. Possible type are Push-pull or Open-drain. 00334 * @rmtoll OTYPER OTy LL_GPIO_SetPinOutputType 00335 * @param GPIOx GPIO Port 00336 * @param PinMask This parameter can be a combination of the following values: 00337 * @arg @ref LL_GPIO_PIN_0 00338 * @arg @ref LL_GPIO_PIN_1 00339 * @arg @ref LL_GPIO_PIN_2 00340 * @arg @ref LL_GPIO_PIN_3 00341 * @arg @ref LL_GPIO_PIN_4 00342 * @arg @ref LL_GPIO_PIN_5 00343 * @arg @ref LL_GPIO_PIN_6 00344 * @arg @ref LL_GPIO_PIN_7 00345 * @arg @ref LL_GPIO_PIN_8 00346 * @arg @ref LL_GPIO_PIN_9 00347 * @arg @ref LL_GPIO_PIN_10 00348 * @arg @ref LL_GPIO_PIN_11 00349 * @arg @ref LL_GPIO_PIN_12 00350 * @arg @ref LL_GPIO_PIN_13 00351 * @arg @ref LL_GPIO_PIN_14 00352 * @arg @ref LL_GPIO_PIN_15 00353 * @arg @ref LL_GPIO_PIN_ALL 00354 * @param OutputType This parameter can be one of the following values: 00355 * @arg @ref LL_GPIO_OUTPUT_PUSHPULL 00356 * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN 00357 * @retval None 00358 */ 00359 __STATIC_INLINE void LL_GPIO_SetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t PinMask, uint32_t OutputType) 00360 { 00361 MODIFY_REG(GPIOx->OTYPER, PinMask, (PinMask * OutputType)); 00362 } 00363 00364 /** 00365 * @brief Return gpio output type for several pins on dedicated port. 00366 * @note Output type as to be set when gpio pin is in output or 00367 * alternate modes. Possible type are Push-pull or Open-drain. 00368 * @note Warning: only one pin can be passed as parameter. 00369 * @rmtoll OTYPER OTy LL_GPIO_GetPinOutputType 00370 * @param GPIOx GPIO Port 00371 * @param Pin This parameter can be one of the following values: 00372 * @arg @ref LL_GPIO_PIN_0 00373 * @arg @ref LL_GPIO_PIN_1 00374 * @arg @ref LL_GPIO_PIN_2 00375 * @arg @ref LL_GPIO_PIN_3 00376 * @arg @ref LL_GPIO_PIN_4 00377 * @arg @ref LL_GPIO_PIN_5 00378 * @arg @ref LL_GPIO_PIN_6 00379 * @arg @ref LL_GPIO_PIN_7 00380 * @arg @ref LL_GPIO_PIN_8 00381 * @arg @ref LL_GPIO_PIN_9 00382 * @arg @ref LL_GPIO_PIN_10 00383 * @arg @ref LL_GPIO_PIN_11 00384 * @arg @ref LL_GPIO_PIN_12 00385 * @arg @ref LL_GPIO_PIN_13 00386 * @arg @ref LL_GPIO_PIN_14 00387 * @arg @ref LL_GPIO_PIN_15 00388 * @arg @ref LL_GPIO_PIN_ALL 00389 * @retval Returned value can be one of the following values: 00390 * @arg @ref LL_GPIO_OUTPUT_PUSHPULL 00391 * @arg @ref LL_GPIO_OUTPUT_OPENDRAIN 00392 */ 00393 __STATIC_INLINE uint32_t LL_GPIO_GetPinOutputType(GPIO_TypeDef *GPIOx, uint32_t Pin) 00394 { 00395 return (uint32_t)(READ_BIT(GPIOx->OTYPER, Pin) >> POSITION_VAL(Pin)); 00396 } 00397 00398 /** 00399 * @brief Configure gpio speed for a dedicated pin on dedicated port. 00400 * @note I/O speed can be Low, Medium, Fast or High speed. 00401 * @note Warning: only one pin can be passed as parameter. 00402 * @note Refer to datasheet for frequency specifications and the power 00403 * supply and load conditions for each speed. 00404 * @rmtoll OSPEEDR OSPEEDy LL_GPIO_SetPinSpeed 00405 * @param GPIOx GPIO Port 00406 * @param Pin This parameter can be one of the following values: 00407 * @arg @ref LL_GPIO_PIN_0 00408 * @arg @ref LL_GPIO_PIN_1 00409 * @arg @ref LL_GPIO_PIN_2 00410 * @arg @ref LL_GPIO_PIN_3 00411 * @arg @ref LL_GPIO_PIN_4 00412 * @arg @ref LL_GPIO_PIN_5 00413 * @arg @ref LL_GPIO_PIN_6 00414 * @arg @ref LL_GPIO_PIN_7 00415 * @arg @ref LL_GPIO_PIN_8 00416 * @arg @ref LL_GPIO_PIN_9 00417 * @arg @ref LL_GPIO_PIN_10 00418 * @arg @ref LL_GPIO_PIN_11 00419 * @arg @ref LL_GPIO_PIN_12 00420 * @arg @ref LL_GPIO_PIN_13 00421 * @arg @ref LL_GPIO_PIN_14 00422 * @arg @ref LL_GPIO_PIN_15 00423 * @param Speed This parameter can be one of the following values: 00424 * @arg @ref LL_GPIO_SPEED_FREQ_LOW 00425 * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM 00426 * @arg @ref LL_GPIO_SPEED_FREQ_HIGH 00427 * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH 00428 * @retval None 00429 */ 00430 __STATIC_INLINE void LL_GPIO_SetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Speed) 00431 { 00432 MODIFY_REG(GPIOx->OSPEEDR, (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U)), 00433 (Speed << (POSITION_VAL(Pin) * 2U))); 00434 } 00435 00436 /** 00437 * @brief Return gpio speed for a dedicated pin on dedicated port. 00438 * @note I/O speed can be Low, Medium, Fast or High speed. 00439 * @note Warning: only one pin can be passed as parameter. 00440 * @note Refer to datasheet for frequency specifications and the power 00441 * supply and load conditions for each speed. 00442 * @rmtoll OSPEEDR OSPEEDy LL_GPIO_GetPinSpeed 00443 * @param GPIOx GPIO Port 00444 * @param Pin This parameter can be one of the following values: 00445 * @arg @ref LL_GPIO_PIN_0 00446 * @arg @ref LL_GPIO_PIN_1 00447 * @arg @ref LL_GPIO_PIN_2 00448 * @arg @ref LL_GPIO_PIN_3 00449 * @arg @ref LL_GPIO_PIN_4 00450 * @arg @ref LL_GPIO_PIN_5 00451 * @arg @ref LL_GPIO_PIN_6 00452 * @arg @ref LL_GPIO_PIN_7 00453 * @arg @ref LL_GPIO_PIN_8 00454 * @arg @ref LL_GPIO_PIN_9 00455 * @arg @ref LL_GPIO_PIN_10 00456 * @arg @ref LL_GPIO_PIN_11 00457 * @arg @ref LL_GPIO_PIN_12 00458 * @arg @ref LL_GPIO_PIN_13 00459 * @arg @ref LL_GPIO_PIN_14 00460 * @arg @ref LL_GPIO_PIN_15 00461 * @retval Returned value can be one of the following values: 00462 * @arg @ref LL_GPIO_SPEED_FREQ_LOW 00463 * @arg @ref LL_GPIO_SPEED_FREQ_MEDIUM 00464 * @arg @ref LL_GPIO_SPEED_FREQ_HIGH 00465 * @arg @ref LL_GPIO_SPEED_FREQ_VERY_HIGH 00466 */ 00467 __STATIC_INLINE uint32_t LL_GPIO_GetPinSpeed(GPIO_TypeDef *GPIOx, uint32_t Pin) 00468 { 00469 return (uint32_t)(READ_BIT(GPIOx->OSPEEDR, 00470 (GPIO_OSPEEDER_OSPEEDR0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U)); 00471 } 00472 00473 /** 00474 * @brief Configure gpio pull-up or pull-down for a dedicated pin on a dedicated port. 00475 * @note Warning: only one pin can be passed as parameter. 00476 * @rmtoll PUPDR PUPDy LL_GPIO_SetPinPull 00477 * @param GPIOx GPIO Port 00478 * @param Pin This parameter can be one of the following values: 00479 * @arg @ref LL_GPIO_PIN_0 00480 * @arg @ref LL_GPIO_PIN_1 00481 * @arg @ref LL_GPIO_PIN_2 00482 * @arg @ref LL_GPIO_PIN_3 00483 * @arg @ref LL_GPIO_PIN_4 00484 * @arg @ref LL_GPIO_PIN_5 00485 * @arg @ref LL_GPIO_PIN_6 00486 * @arg @ref LL_GPIO_PIN_7 00487 * @arg @ref LL_GPIO_PIN_8 00488 * @arg @ref LL_GPIO_PIN_9 00489 * @arg @ref LL_GPIO_PIN_10 00490 * @arg @ref LL_GPIO_PIN_11 00491 * @arg @ref LL_GPIO_PIN_12 00492 * @arg @ref LL_GPIO_PIN_13 00493 * @arg @ref LL_GPIO_PIN_14 00494 * @arg @ref LL_GPIO_PIN_15 00495 * @param Pull This parameter can be one of the following values: 00496 * @arg @ref LL_GPIO_PULL_NO 00497 * @arg @ref LL_GPIO_PULL_UP 00498 * @arg @ref LL_GPIO_PULL_DOWN 00499 * @retval None 00500 */ 00501 __STATIC_INLINE void LL_GPIO_SetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Pull) 00502 { 00503 MODIFY_REG(GPIOx->PUPDR, (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U)), (Pull << (POSITION_VAL(Pin) * 2U))); 00504 } 00505 00506 /** 00507 * @brief Return gpio pull-up or pull-down for a dedicated pin on a dedicated port 00508 * @note Warning: only one pin can be passed as parameter. 00509 * @rmtoll PUPDR PUPDy LL_GPIO_GetPinPull 00510 * @param GPIOx GPIO Port 00511 * @param Pin This parameter can be one of the following values: 00512 * @arg @ref LL_GPIO_PIN_0 00513 * @arg @ref LL_GPIO_PIN_1 00514 * @arg @ref LL_GPIO_PIN_2 00515 * @arg @ref LL_GPIO_PIN_3 00516 * @arg @ref LL_GPIO_PIN_4 00517 * @arg @ref LL_GPIO_PIN_5 00518 * @arg @ref LL_GPIO_PIN_6 00519 * @arg @ref LL_GPIO_PIN_7 00520 * @arg @ref LL_GPIO_PIN_8 00521 * @arg @ref LL_GPIO_PIN_9 00522 * @arg @ref LL_GPIO_PIN_10 00523 * @arg @ref LL_GPIO_PIN_11 00524 * @arg @ref LL_GPIO_PIN_12 00525 * @arg @ref LL_GPIO_PIN_13 00526 * @arg @ref LL_GPIO_PIN_14 00527 * @arg @ref LL_GPIO_PIN_15 00528 * @retval Returned value can be one of the following values: 00529 * @arg @ref LL_GPIO_PULL_NO 00530 * @arg @ref LL_GPIO_PULL_UP 00531 * @arg @ref LL_GPIO_PULL_DOWN 00532 */ 00533 __STATIC_INLINE uint32_t LL_GPIO_GetPinPull(GPIO_TypeDef *GPIOx, uint32_t Pin) 00534 { 00535 return (uint32_t)(READ_BIT(GPIOx->PUPDR, 00536 (GPIO_PUPDR_PUPDR0 << (POSITION_VAL(Pin) * 2U))) >> (POSITION_VAL(Pin) * 2U)); 00537 } 00538 00539 /** 00540 * @brief Configure gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. 00541 * @note Possible values are from AF0 to AF15 depending on target. 00542 * @note Warning: only one pin can be passed as parameter. 00543 * @rmtoll AFRL AFSELy LL_GPIO_SetAFPin_0_7 00544 * @param GPIOx GPIO Port 00545 * @param Pin This parameter can be one of the following values: 00546 * @arg @ref LL_GPIO_PIN_0 00547 * @arg @ref LL_GPIO_PIN_1 00548 * @arg @ref LL_GPIO_PIN_2 00549 * @arg @ref LL_GPIO_PIN_3 00550 * @arg @ref LL_GPIO_PIN_4 00551 * @arg @ref LL_GPIO_PIN_5 00552 * @arg @ref LL_GPIO_PIN_6 00553 * @arg @ref LL_GPIO_PIN_7 00554 * @param Alternate This parameter can be one of the following values: 00555 * @arg @ref LL_GPIO_AF_0 00556 * @arg @ref LL_GPIO_AF_1 00557 * @arg @ref LL_GPIO_AF_2 00558 * @arg @ref LL_GPIO_AF_3 00559 * @arg @ref LL_GPIO_AF_4 00560 * @arg @ref LL_GPIO_AF_5 00561 * @arg @ref LL_GPIO_AF_6 00562 * @arg @ref LL_GPIO_AF_7 00563 * @arg @ref LL_GPIO_AF_8 00564 * @arg @ref LL_GPIO_AF_9 00565 * @arg @ref LL_GPIO_AF_10 00566 * @arg @ref LL_GPIO_AF_11 00567 * @arg @ref LL_GPIO_AF_12 00568 * @arg @ref LL_GPIO_AF_13 00569 * @arg @ref LL_GPIO_AF_14 00570 * @arg @ref LL_GPIO_AF_15 00571 * @retval None 00572 */ 00573 __STATIC_INLINE void LL_GPIO_SetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) 00574 { 00575 MODIFY_REG(GPIOx->AFR[0], (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U)), 00576 (Alternate << (POSITION_VAL(Pin) * 4U))); 00577 } 00578 00579 /** 00580 * @brief Return gpio alternate function of a dedicated pin from 0 to 7 for a dedicated port. 00581 * @rmtoll AFRL AFSELy LL_GPIO_GetAFPin_0_7 00582 * @param GPIOx GPIO Port 00583 * @param Pin This parameter can be one of the following values: 00584 * @arg @ref LL_GPIO_PIN_0 00585 * @arg @ref LL_GPIO_PIN_1 00586 * @arg @ref LL_GPIO_PIN_2 00587 * @arg @ref LL_GPIO_PIN_3 00588 * @arg @ref LL_GPIO_PIN_4 00589 * @arg @ref LL_GPIO_PIN_5 00590 * @arg @ref LL_GPIO_PIN_6 00591 * @arg @ref LL_GPIO_PIN_7 00592 * @retval Returned value can be one of the following values: 00593 * @arg @ref LL_GPIO_AF_0 00594 * @arg @ref LL_GPIO_AF_1 00595 * @arg @ref LL_GPIO_AF_2 00596 * @arg @ref LL_GPIO_AF_3 00597 * @arg @ref LL_GPIO_AF_4 00598 * @arg @ref LL_GPIO_AF_5 00599 * @arg @ref LL_GPIO_AF_6 00600 * @arg @ref LL_GPIO_AF_7 00601 * @arg @ref LL_GPIO_AF_8 00602 * @arg @ref LL_GPIO_AF_9 00603 * @arg @ref LL_GPIO_AF_10 00604 * @arg @ref LL_GPIO_AF_11 00605 * @arg @ref LL_GPIO_AF_12 00606 * @arg @ref LL_GPIO_AF_13 00607 * @arg @ref LL_GPIO_AF_14 00608 * @arg @ref LL_GPIO_AF_15 00609 */ 00610 __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_0_7(GPIO_TypeDef *GPIOx, uint32_t Pin) 00611 { 00612 return (uint32_t)(READ_BIT(GPIOx->AFR[0], 00613 (GPIO_AFRL_AFSEL0 << (POSITION_VAL(Pin) * 4U))) >> (POSITION_VAL(Pin) * 4U)); 00614 } 00615 00616 /** 00617 * @brief Configure gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port. 00618 * @note Possible values are from AF0 to AF15 depending on target. 00619 * @note Warning: only one pin can be passed as parameter. 00620 * @rmtoll AFRH AFSELy LL_GPIO_SetAFPin_8_15 00621 * @param GPIOx GPIO Port 00622 * @param Pin This parameter can be one of the following values: 00623 * @arg @ref LL_GPIO_PIN_8 00624 * @arg @ref LL_GPIO_PIN_9 00625 * @arg @ref LL_GPIO_PIN_10 00626 * @arg @ref LL_GPIO_PIN_11 00627 * @arg @ref LL_GPIO_PIN_12 00628 * @arg @ref LL_GPIO_PIN_13 00629 * @arg @ref LL_GPIO_PIN_14 00630 * @arg @ref LL_GPIO_PIN_15 00631 * @param Alternate This parameter can be one of the following values: 00632 * @arg @ref LL_GPIO_AF_0 00633 * @arg @ref LL_GPIO_AF_1 00634 * @arg @ref LL_GPIO_AF_2 00635 * @arg @ref LL_GPIO_AF_3 00636 * @arg @ref LL_GPIO_AF_4 00637 * @arg @ref LL_GPIO_AF_5 00638 * @arg @ref LL_GPIO_AF_6 00639 * @arg @ref LL_GPIO_AF_7 00640 * @arg @ref LL_GPIO_AF_8 00641 * @arg @ref LL_GPIO_AF_9 00642 * @arg @ref LL_GPIO_AF_10 00643 * @arg @ref LL_GPIO_AF_11 00644 * @arg @ref LL_GPIO_AF_12 00645 * @arg @ref LL_GPIO_AF_13 00646 * @arg @ref LL_GPIO_AF_14 00647 * @arg @ref LL_GPIO_AF_15 00648 * @retval None 00649 */ 00650 __STATIC_INLINE void LL_GPIO_SetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Alternate) 00651 { 00652 MODIFY_REG(GPIOx->AFR[1], (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U)), 00653 (Alternate << (POSITION_VAL(Pin >> 8U) * 4U))); 00654 } 00655 00656 /** 00657 * @brief Return gpio alternate function of a dedicated pin from 8 to 15 for a dedicated port. 00658 * @note Possible values are from AF0 to AF15 depending on target. 00659 * @rmtoll AFRH AFSELy LL_GPIO_GetAFPin_8_15 00660 * @param GPIOx GPIO Port 00661 * @param Pin This parameter can be one of the following values: 00662 * @arg @ref LL_GPIO_PIN_8 00663 * @arg @ref LL_GPIO_PIN_9 00664 * @arg @ref LL_GPIO_PIN_10 00665 * @arg @ref LL_GPIO_PIN_11 00666 * @arg @ref LL_GPIO_PIN_12 00667 * @arg @ref LL_GPIO_PIN_13 00668 * @arg @ref LL_GPIO_PIN_14 00669 * @arg @ref LL_GPIO_PIN_15 00670 * @retval Returned value can be one of the following values: 00671 * @arg @ref LL_GPIO_AF_0 00672 * @arg @ref LL_GPIO_AF_1 00673 * @arg @ref LL_GPIO_AF_2 00674 * @arg @ref LL_GPIO_AF_3 00675 * @arg @ref LL_GPIO_AF_4 00676 * @arg @ref LL_GPIO_AF_5 00677 * @arg @ref LL_GPIO_AF_6 00678 * @arg @ref LL_GPIO_AF_7 00679 * @arg @ref LL_GPIO_AF_8 00680 * @arg @ref LL_GPIO_AF_9 00681 * @arg @ref LL_GPIO_AF_10 00682 * @arg @ref LL_GPIO_AF_11 00683 * @arg @ref LL_GPIO_AF_12 00684 * @arg @ref LL_GPIO_AF_13 00685 * @arg @ref LL_GPIO_AF_14 00686 * @arg @ref LL_GPIO_AF_15 00687 */ 00688 __STATIC_INLINE uint32_t LL_GPIO_GetAFPin_8_15(GPIO_TypeDef *GPIOx, uint32_t Pin) 00689 { 00690 return (uint32_t)(READ_BIT(GPIOx->AFR[1], 00691 (GPIO_AFRH_AFSEL8 << (POSITION_VAL(Pin >> 8U) * 4U))) >> (POSITION_VAL(Pin >> 8U) * 4U)); 00692 } 00693 00694 00695 /** 00696 * @brief Lock configuration of several pins for a dedicated port. 00697 * @note When the lock sequence has been applied on a port bit, the 00698 * value of this port bit can no longer be modified until the 00699 * next reset. 00700 * @note Each lock bit freezes a specific configuration register 00701 * (control and alternate function registers). 00702 * @rmtoll LCKR LCKK LL_GPIO_LockPin 00703 * @param GPIOx GPIO Port 00704 * @param PinMask This parameter can be a combination of the following values: 00705 * @arg @ref LL_GPIO_PIN_0 00706 * @arg @ref LL_GPIO_PIN_1 00707 * @arg @ref LL_GPIO_PIN_2 00708 * @arg @ref LL_GPIO_PIN_3 00709 * @arg @ref LL_GPIO_PIN_4 00710 * @arg @ref LL_GPIO_PIN_5 00711 * @arg @ref LL_GPIO_PIN_6 00712 * @arg @ref LL_GPIO_PIN_7 00713 * @arg @ref LL_GPIO_PIN_8 00714 * @arg @ref LL_GPIO_PIN_9 00715 * @arg @ref LL_GPIO_PIN_10 00716 * @arg @ref LL_GPIO_PIN_11 00717 * @arg @ref LL_GPIO_PIN_12 00718 * @arg @ref LL_GPIO_PIN_13 00719 * @arg @ref LL_GPIO_PIN_14 00720 * @arg @ref LL_GPIO_PIN_15 00721 * @arg @ref LL_GPIO_PIN_ALL 00722 * @retval None 00723 */ 00724 __STATIC_INLINE void LL_GPIO_LockPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) 00725 { 00726 __IO uint32_t temp; 00727 WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask); 00728 WRITE_REG(GPIOx->LCKR, PinMask); 00729 WRITE_REG(GPIOx->LCKR, GPIO_LCKR_LCKK | PinMask); 00730 temp = READ_REG(GPIOx->LCKR); 00731 (void) temp; 00732 } 00733 00734 /** 00735 * @brief Return 1 if all pins passed as parameter, of a dedicated port, are locked. else Return 0. 00736 * @rmtoll LCKR LCKy LL_GPIO_IsPinLocked 00737 * @param GPIOx GPIO Port 00738 * @param PinMask This parameter can be a combination of the following values: 00739 * @arg @ref LL_GPIO_PIN_0 00740 * @arg @ref LL_GPIO_PIN_1 00741 * @arg @ref LL_GPIO_PIN_2 00742 * @arg @ref LL_GPIO_PIN_3 00743 * @arg @ref LL_GPIO_PIN_4 00744 * @arg @ref LL_GPIO_PIN_5 00745 * @arg @ref LL_GPIO_PIN_6 00746 * @arg @ref LL_GPIO_PIN_7 00747 * @arg @ref LL_GPIO_PIN_8 00748 * @arg @ref LL_GPIO_PIN_9 00749 * @arg @ref LL_GPIO_PIN_10 00750 * @arg @ref LL_GPIO_PIN_11 00751 * @arg @ref LL_GPIO_PIN_12 00752 * @arg @ref LL_GPIO_PIN_13 00753 * @arg @ref LL_GPIO_PIN_14 00754 * @arg @ref LL_GPIO_PIN_15 00755 * @arg @ref LL_GPIO_PIN_ALL 00756 * @retval State of bit (1 or 0). 00757 */ 00758 __STATIC_INLINE uint32_t LL_GPIO_IsPinLocked(GPIO_TypeDef *GPIOx, uint32_t PinMask) 00759 { 00760 return (READ_BIT(GPIOx->LCKR, PinMask) == (PinMask)); 00761 } 00762 00763 /** 00764 * @brief Return 1 if one of the pin of a dedicated port is locked. else return 0. 00765 * @rmtoll LCKR LCKK LL_GPIO_IsAnyPinLocked 00766 * @param GPIOx GPIO Port 00767 * @retval State of bit (1 or 0). 00768 */ 00769 __STATIC_INLINE uint32_t LL_GPIO_IsAnyPinLocked(GPIO_TypeDef *GPIOx) 00770 { 00771 return (READ_BIT(GPIOx->LCKR, GPIO_LCKR_LCKK) == (GPIO_LCKR_LCKK)); 00772 } 00773 00774 /** 00775 * @} 00776 */ 00777 00778 /** @defgroup GPIO_LL_EF_Data_Access Data Access 00779 * @{ 00780 */ 00781 00782 /** 00783 * @brief Return full input data register value for a dedicated port. 00784 * @rmtoll IDR IDy LL_GPIO_ReadInputPort 00785 * @param GPIOx GPIO Port 00786 * @retval Input data register value of port 00787 */ 00788 __STATIC_INLINE uint32_t LL_GPIO_ReadInputPort(GPIO_TypeDef *GPIOx) 00789 { 00790 return (uint32_t)(READ_REG(GPIOx->IDR)); 00791 } 00792 00793 /** 00794 * @brief Return if input data level for several pins of dedicated port is high or low. 00795 * @rmtoll IDR IDy LL_GPIO_IsInputPinSet 00796 * @param GPIOx GPIO Port 00797 * @param PinMask This parameter can be a combination of the following values: 00798 * @arg @ref LL_GPIO_PIN_0 00799 * @arg @ref LL_GPIO_PIN_1 00800 * @arg @ref LL_GPIO_PIN_2 00801 * @arg @ref LL_GPIO_PIN_3 00802 * @arg @ref LL_GPIO_PIN_4 00803 * @arg @ref LL_GPIO_PIN_5 00804 * @arg @ref LL_GPIO_PIN_6 00805 * @arg @ref LL_GPIO_PIN_7 00806 * @arg @ref LL_GPIO_PIN_8 00807 * @arg @ref LL_GPIO_PIN_9 00808 * @arg @ref LL_GPIO_PIN_10 00809 * @arg @ref LL_GPIO_PIN_11 00810 * @arg @ref LL_GPIO_PIN_12 00811 * @arg @ref LL_GPIO_PIN_13 00812 * @arg @ref LL_GPIO_PIN_14 00813 * @arg @ref LL_GPIO_PIN_15 00814 * @arg @ref LL_GPIO_PIN_ALL 00815 * @retval State of bit (1 or 0). 00816 */ 00817 __STATIC_INLINE uint32_t LL_GPIO_IsInputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask) 00818 { 00819 return (READ_BIT(GPIOx->IDR, PinMask) == (PinMask)); 00820 } 00821 00822 /** 00823 * @brief Write output data register for the port. 00824 * @rmtoll ODR ODy LL_GPIO_WriteOutputPort 00825 * @param GPIOx GPIO Port 00826 * @param PortValue Level value for each pin of the port 00827 * @retval None 00828 */ 00829 __STATIC_INLINE void LL_GPIO_WriteOutputPort(GPIO_TypeDef *GPIOx, uint32_t PortValue) 00830 { 00831 WRITE_REG(GPIOx->ODR, PortValue); 00832 } 00833 00834 /** 00835 * @brief Return full output data register value for a dedicated port. 00836 * @rmtoll ODR ODy LL_GPIO_ReadOutputPort 00837 * @param GPIOx GPIO Port 00838 * @retval Output data register value of port 00839 */ 00840 __STATIC_INLINE uint32_t LL_GPIO_ReadOutputPort(GPIO_TypeDef *GPIOx) 00841 { 00842 return (uint32_t)(READ_REG(GPIOx->ODR)); 00843 } 00844 00845 /** 00846 * @brief Return if input data level for several pins of dedicated port is high or low. 00847 * @rmtoll ODR ODy LL_GPIO_IsOutputPinSet 00848 * @param GPIOx GPIO Port 00849 * @param PinMask This parameter can be a combination of the following values: 00850 * @arg @ref LL_GPIO_PIN_0 00851 * @arg @ref LL_GPIO_PIN_1 00852 * @arg @ref LL_GPIO_PIN_2 00853 * @arg @ref LL_GPIO_PIN_3 00854 * @arg @ref LL_GPIO_PIN_4 00855 * @arg @ref LL_GPIO_PIN_5 00856 * @arg @ref LL_GPIO_PIN_6 00857 * @arg @ref LL_GPIO_PIN_7 00858 * @arg @ref LL_GPIO_PIN_8 00859 * @arg @ref LL_GPIO_PIN_9 00860 * @arg @ref LL_GPIO_PIN_10 00861 * @arg @ref LL_GPIO_PIN_11 00862 * @arg @ref LL_GPIO_PIN_12 00863 * @arg @ref LL_GPIO_PIN_13 00864 * @arg @ref LL_GPIO_PIN_14 00865 * @arg @ref LL_GPIO_PIN_15 00866 * @arg @ref LL_GPIO_PIN_ALL 00867 * @retval State of bit (1 or 0). 00868 */ 00869 __STATIC_INLINE uint32_t LL_GPIO_IsOutputPinSet(GPIO_TypeDef *GPIOx, uint32_t PinMask) 00870 { 00871 return (READ_BIT(GPIOx->ODR, PinMask) == (PinMask)); 00872 } 00873 00874 /** 00875 * @brief Set several pins to high level on dedicated gpio port. 00876 * @rmtoll BSRR BSy LL_GPIO_SetOutputPin 00877 * @param GPIOx GPIO Port 00878 * @param PinMask This parameter can be a combination of the following values: 00879 * @arg @ref LL_GPIO_PIN_0 00880 * @arg @ref LL_GPIO_PIN_1 00881 * @arg @ref LL_GPIO_PIN_2 00882 * @arg @ref LL_GPIO_PIN_3 00883 * @arg @ref LL_GPIO_PIN_4 00884 * @arg @ref LL_GPIO_PIN_5 00885 * @arg @ref LL_GPIO_PIN_6 00886 * @arg @ref LL_GPIO_PIN_7 00887 * @arg @ref LL_GPIO_PIN_8 00888 * @arg @ref LL_GPIO_PIN_9 00889 * @arg @ref LL_GPIO_PIN_10 00890 * @arg @ref LL_GPIO_PIN_11 00891 * @arg @ref LL_GPIO_PIN_12 00892 * @arg @ref LL_GPIO_PIN_13 00893 * @arg @ref LL_GPIO_PIN_14 00894 * @arg @ref LL_GPIO_PIN_15 00895 * @arg @ref LL_GPIO_PIN_ALL 00896 * @retval None 00897 */ 00898 __STATIC_INLINE void LL_GPIO_SetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) 00899 { 00900 WRITE_REG(GPIOx->BSRR, PinMask); 00901 } 00902 00903 /** 00904 * @brief Set several pins to low level on dedicated gpio port. 00905 * @rmtoll BSRR BRy LL_GPIO_ResetOutputPin 00906 * @param GPIOx GPIO Port 00907 * @param PinMask This parameter can be a combination of the following values: 00908 * @arg @ref LL_GPIO_PIN_0 00909 * @arg @ref LL_GPIO_PIN_1 00910 * @arg @ref LL_GPIO_PIN_2 00911 * @arg @ref LL_GPIO_PIN_3 00912 * @arg @ref LL_GPIO_PIN_4 00913 * @arg @ref LL_GPIO_PIN_5 00914 * @arg @ref LL_GPIO_PIN_6 00915 * @arg @ref LL_GPIO_PIN_7 00916 * @arg @ref LL_GPIO_PIN_8 00917 * @arg @ref LL_GPIO_PIN_9 00918 * @arg @ref LL_GPIO_PIN_10 00919 * @arg @ref LL_GPIO_PIN_11 00920 * @arg @ref LL_GPIO_PIN_12 00921 * @arg @ref LL_GPIO_PIN_13 00922 * @arg @ref LL_GPIO_PIN_14 00923 * @arg @ref LL_GPIO_PIN_15 00924 * @arg @ref LL_GPIO_PIN_ALL 00925 * @retval None 00926 */ 00927 __STATIC_INLINE void LL_GPIO_ResetOutputPin(GPIO_TypeDef *GPIOx, uint32_t PinMask) 00928 { 00929 WRITE_REG(GPIOx->BSRR, (PinMask << 16)); 00930 } 00931 00932 /** 00933 * @brief Toggle data value for several pin of dedicated port. 00934 * @rmtoll ODR ODy LL_GPIO_TogglePin 00935 * @param GPIOx GPIO Port 00936 * @param PinMask This parameter can be a combination of the following values: 00937 * @arg @ref LL_GPIO_PIN_0 00938 * @arg @ref LL_GPIO_PIN_1 00939 * @arg @ref LL_GPIO_PIN_2 00940 * @arg @ref LL_GPIO_PIN_3 00941 * @arg @ref LL_GPIO_PIN_4 00942 * @arg @ref LL_GPIO_PIN_5 00943 * @arg @ref LL_GPIO_PIN_6 00944 * @arg @ref LL_GPIO_PIN_7 00945 * @arg @ref LL_GPIO_PIN_8 00946 * @arg @ref LL_GPIO_PIN_9 00947 * @arg @ref LL_GPIO_PIN_10 00948 * @arg @ref LL_GPIO_PIN_11 00949 * @arg @ref LL_GPIO_PIN_12 00950 * @arg @ref LL_GPIO_PIN_13 00951 * @arg @ref LL_GPIO_PIN_14 00952 * @arg @ref LL_GPIO_PIN_15 00953 * @arg @ref LL_GPIO_PIN_ALL 00954 * @retval None 00955 */ 00956 __STATIC_INLINE void LL_GPIO_TogglePin(GPIO_TypeDef *GPIOx, uint32_t PinMask) 00957 { 00958 WRITE_REG(GPIOx->ODR, READ_REG(GPIOx->ODR) ^ PinMask); 00959 } 00960 00961 /** 00962 * @} 00963 */ 00964 00965 #if defined(USE_FULL_LL_DRIVER) 00966 /** @defgroup GPIO_LL_EF_Init Initialization and de-initialization functions 00967 * @{ 00968 */ 00969 00970 ErrorStatus LL_GPIO_DeInit(GPIO_TypeDef *GPIOx); 00971 ErrorStatus LL_GPIO_Init(GPIO_TypeDef *GPIOx, LL_GPIO_InitTypeDef *GPIO_InitStruct); 00972 void LL_GPIO_StructInit(LL_GPIO_InitTypeDef *GPIO_InitStruct); 00973 00974 /** 00975 * @} 00976 */ 00977 #endif /* USE_FULL_LL_DRIVER */ 00978 00979 /** 00980 * @} 00981 */ 00982 00983 /** 00984 * @} 00985 */ 00986 00987 #endif /* defined (GPIOA) || defined (GPIOB) || defined (GPIOC) || defined (GPIOD) || defined (GPIOE) || defined (GPIOF) || defined (GPIOG) || defined (GPIOH) || defined (GPIOI) || defined (GPIOJ) || defined (GPIOK) */ 00988 /** 00989 * @} 00990 */ 00991 00992 #ifdef __cplusplus 00993 } 00994 #endif 00995 00996 #endif /* __STM32F4xx_LL_GPIO_H */ 00997 00998 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/