Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

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