Hal Drivers for L4

Dependents:   BSP OneHopeOnePrayer FINAL_AUDIO_RECORD AudioDemo

Fork of STM32L4xx_HAL_Driver by Senior Design: Sound Monitor

Committer:
EricLew
Date:
Mon Nov 02 19:37:23 2015 +0000
Revision:
0:80ee8f3b695e
Errors are with definitions of LCD and QSPI functions. I believe all .h and .c files are  uploaded, but there may need to be certain functions called.

Who changed what in which revision?

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