The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

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