mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

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

Committer:
mbed_official
Date:
Wed Jul 01 09:45:11 2015 +0100
Revision:
579:53297373a894
Parent:
489:119543c9f674
Synchronized with git revision d5b4d2ab9c47edb4dc5776e7177b0c2263459081

Full URL: https://github.com/mbedmicro/mbed/commit/d5b4d2ab9c47edb4dc5776e7177b0c2263459081/

Initial version of drivers for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 376:cb4d9db17537 1 /**
mbed_official 376:cb4d9db17537 2 ******************************************************************************
mbed_official 376:cb4d9db17537 3 * @file stm32l0xx_hal_gpio_ex.h
mbed_official 376:cb4d9db17537 4 * @author MCD Application Team
mbed_official 489:119543c9f674 5 * @version V1.2.0
mbed_official 489:119543c9f674 6 * @date 06-February-2015
mbed_official 376:cb4d9db17537 7 * @brief Header file of GPIO HAL Extension module.
mbed_official 376:cb4d9db17537 8 ******************************************************************************
mbed_official 376:cb4d9db17537 9 * @attention
mbed_official 376:cb4d9db17537 10 *
mbed_official 489:119543c9f674 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
mbed_official 376:cb4d9db17537 12 *
mbed_official 376:cb4d9db17537 13 * Redistribution and use in source and binary forms, with or without modification,
mbed_official 376:cb4d9db17537 14 * are permitted provided that the following conditions are met:
mbed_official 376:cb4d9db17537 15 * 1. Redistributions of source code must retain the above copyright notice,
mbed_official 376:cb4d9db17537 16 * this list of conditions and the following disclaimer.
mbed_official 376:cb4d9db17537 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mbed_official 376:cb4d9db17537 18 * this list of conditions and the following disclaimer in the documentation
mbed_official 376:cb4d9db17537 19 * and/or other materials provided with the distribution.
mbed_official 376:cb4d9db17537 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mbed_official 376:cb4d9db17537 21 * may be used to endorse or promote products derived from this software
mbed_official 376:cb4d9db17537 22 * without specific prior written permission.
mbed_official 376:cb4d9db17537 23 *
mbed_official 376:cb4d9db17537 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 376:cb4d9db17537 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mbed_official 376:cb4d9db17537 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mbed_official 376:cb4d9db17537 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mbed_official 376:cb4d9db17537 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mbed_official 376:cb4d9db17537 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mbed_official 376:cb4d9db17537 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mbed_official 376:cb4d9db17537 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mbed_official 376:cb4d9db17537 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mbed_official 376:cb4d9db17537 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mbed_official 376:cb4d9db17537 34 *
mbed_official 376:cb4d9db17537 35 ******************************************************************************
mbed_official 376:cb4d9db17537 36 */
mbed_official 376:cb4d9db17537 37
mbed_official 376:cb4d9db17537 38 /* Define to prevent recursive inclusion -------------------------------------*/
mbed_official 376:cb4d9db17537 39 #ifndef __STM32L0xx_HAL_GPIO_EX_H
mbed_official 376:cb4d9db17537 40 #define __STM32L0xx_HAL_GPIO_EX_H
mbed_official 376:cb4d9db17537 41
mbed_official 376:cb4d9db17537 42 #ifdef __cplusplus
mbed_official 376:cb4d9db17537 43 extern "C" {
mbed_official 376:cb4d9db17537 44 #endif
mbed_official 376:cb4d9db17537 45
mbed_official 376:cb4d9db17537 46 /* Includes ------------------------------------------------------------------*/
mbed_official 376:cb4d9db17537 47 #include "stm32l0xx_hal_def.h"
mbed_official 376:cb4d9db17537 48
mbed_official 376:cb4d9db17537 49 /** @addtogroup STM32L0xx_HAL_Driver
mbed_official 376:cb4d9db17537 50 * @{
mbed_official 376:cb4d9db17537 51 */
mbed_official 376:cb4d9db17537 52
mbed_official 489:119543c9f674 53 /** @defgroup GPIOEx GPIOx
mbed_official 376:cb4d9db17537 54 * @{
mbed_official 489:119543c9f674 55 */
mbed_official 376:cb4d9db17537 56
mbed_official 376:cb4d9db17537 57 /* Exported types ------------------------------------------------------------*/
mbed_official 376:cb4d9db17537 58
mbed_official 376:cb4d9db17537 59 /* Exported constants --------------------------------------------------------*/
mbed_official 376:cb4d9db17537 60
mbed_official 489:119543c9f674 61 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
mbed_official 376:cb4d9db17537 62 * @{
mbed_official 376:cb4d9db17537 63 */
mbed_official 376:cb4d9db17537 64
mbed_official 489:119543c9f674 65
mbed_official 489:119543c9f674 66 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 67 /*------------------------- STM32L083xx/STM32L073xx---------------------------*/
mbed_official 489:119543c9f674 68 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 69
mbed_official 489:119543c9f674 70 #if defined (STM32L083xx) || defined (STM32L073xx)
mbed_official 489:119543c9f674 71
mbed_official 489:119543c9f674 72 /* The table below gives an overview of the different alternate functions per port.
mbed_official 489:119543c9f674 73 * For more details refer yourself to the product data sheet.
mbed_official 489:119543c9f674 74 *
mbed_official 489:119543c9f674 75 */
mbed_official 489:119543c9f674 76
mbed_official 489:119543c9f674 77 /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
mbed_official 489:119543c9f674 78 *______________________________________________________________________________
mbed_official 489:119543c9f674 79 * PA0 | | |TIM2_C1 |TSC |USART2 |TIM2_TR |USART4 |COMP1 |
mbed_official 489:119543c9f674 80 * PA1 |EVENTOUT|LCD |TIM2_C2 |TSC |USART2 |TIM21_TR|USART4 | |
mbed_official 489:119543c9f674 81 * PA2 |TIM21_C1|LCD |TIM2_C3 |TSC |USART2 | |LPUART1 |COMP2 |
mbed_official 489:119543c9f674 82 * PA3 |TIM21_C2|LCD |TIM2_C4 |TSC |USART2 | |LPUART1 | |
mbed_official 489:119543c9f674 83 * PA4 |SPI1 | | |TSC |USART2 |TIM22_TR| | |
mbed_official 489:119543c9f674 84 * PA5 |SPI1 | |TIM2_TR |TSC | |TIM2_C1 | | |
mbed_official 489:119543c9f674 85 * PA6 |SPI1 |LCD |TIM3_C1 |TSC |LPUART1 |TIM22_C1|EVENTOUT|COMP1 |
mbed_official 489:119543c9f674 86 * PA7 |SPI1 |LCD |TIM3_C2 |TSC | |TIM22_C2|EVENTOUT|COMP2 |
mbed_official 489:119543c9f674 87 * PA8 |MCO |LCD |USB |EVENTOUT|USART1 | | |I2C3 |
mbed_official 489:119543c9f674 88 * PA9 |MCO |LCD | |TSC |USART1 | |I2C1 |I2C3 |
mbed_official 489:119543c9f674 89 * PA10| |LCD | |TSC |USART1 | |I2C1 | |
mbed_official 489:119543c9f674 90 * PA11|SPI1 | |EVENTOUT|TSC |USART1 | |I2C2 |COMP1 |
mbed_official 489:119543c9f674 91 * PA12|SPI1 | |EVENTOUT|TSC |USART1 | |I2C2 |COMP2 |
mbed_official 489:119543c9f674 92 * PA13|SWDIO | |USB | | | |LPUART1 | |
mbed_official 489:119543c9f674 93 * PA14|SWCLK | | | |USART2 | |LPUART1 | |
mbed_official 489:119543c9f674 94 * PA15|SPI1 |LCD |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 |USART4 | |
mbed_official 489:119543c9f674 95 *______________________________________________________________________________
mbed_official 489:119543c9f674 96 * PB0 |EVENTOUT|LCD |TIM3_C3 |TSC | | | | |
mbed_official 489:119543c9f674 97 * PB1 | |LCD |TIM3_C4 |TSC |LPUART1 | | | |
mbed_official 489:119543c9f674 98 * PB2 | | |LPTIM1_O|TSC | | | |I2C3 |
mbed_official 489:119543c9f674 99 * PB3 |SPI1 |LCD |TIM2_C2 |TSC |EVENTOUT|USART1 |USART5 | |
mbed_official 489:119543c9f674 100 * PB4 |SPI1 |LCD |TIM3_C1 |TSC |TIM22_C1|USART1 |USART5 |I2C3 |
mbed_official 489:119543c9f674 101 * PB5 |SPI1 |LCD |LPTIM1_I|I2C1 |TIM3_C2 |USART1 |USART5 | |
mbed_official 489:119543c9f674 102 * | | | | |TIM22_C2| | | |
mbed_official 489:119543c9f674 103 * PB6 |USART1 |I2C1 |LPTIM1_T|TSC | | | | |
mbed_official 489:119543c9f674 104 * PB7 |USART1 |I2C1 |LPTIM1_I|TSC | | |USART4 | |
mbed_official 489:119543c9f674 105 * PB8 | |LCD | |TSC |I2C1 | | | |
mbed_official 489:119543c9f674 106 * PB9 | |LCD |EVENTOUT| |I2C1 |SPI2 | | |
mbed_official 489:119543c9f674 107 * PB10| |LCD |TIM2_C3 |TSC |LPUART1 |SPI2 |I2C2 |LPUART1 |
mbed_official 489:119543c9f674 108 * PB11|EVENTOUT|LCD |TIM2_C4 |TSC |LPUART1 | |I2C2 |LPUART1 |
mbed_official 489:119543c9f674 109 * PB12|SPI2 |LCD |LPUART1 |TSC | |I2C2 |EVENTOUT| |
mbed_official 489:119543c9f674 110 * PB13|SPI2 |LCD |MCO |TSC |LPUART1 |I2C2 |TIM21_C1| |
mbed_official 489:119543c9f674 111 * PB14|SPI2 |LCD |RTC |TSC |LPUART1 |I2C2 |TIM21_C2| |
mbed_official 489:119543c9f674 112 * PB15|SPI2 |LCD |RTC | | | | | |
mbed_official 489:119543c9f674 113 *______________________________________________________________________________
mbed_official 489:119543c9f674 114 * PC0 |LPTIM1_I|LCD |EVENTOUT|TSC | | |LPUART1 |I2C3 |
mbed_official 489:119543c9f674 115 * PC1 |LPTIM1_O|LCD |EVENTOUT|TSC | | |LPUART1 |I2C3 |
mbed_official 489:119543c9f674 116 * PC2 |LPTIM1_I|LCD |SPI2 |TSC | | | | |
mbed_official 489:119543c9f674 117 * PC3 |LPTIM1_T|LCD |SPI2 |TSC | | | | |
mbed_official 489:119543c9f674 118 * PC4 |EVENTOUT|LCD |LPUART1 | | | | | |
mbed_official 489:119543c9f674 119 * PC5 | |LCD |LPUART1 |TSC | | | | |
mbed_official 489:119543c9f674 120 * PC6 |TIM22_C1|LCD |TIM3_C1 |TSC | | | | |
mbed_official 489:119543c9f674 121 * PC7 |TIM22_C2|LCD |TIM3_C2 |TSC | | | | |
mbed_official 489:119543c9f674 122 * PC8 |TIM22_TR|LCD |TIM3_C3 |TSC | | | | |
mbed_official 489:119543c9f674 123 * PC9 |TIM21_TR|LCD |USB |TSC | | | |I2C3 |
mbed_official 489:119543c9f674 124 * | | |TIM3_C4 | | | | | |
mbed_official 489:119543c9f674 125 * PC10|LPUART1 |LCD | | | | |USART4 | |
mbed_official 489:119543c9f674 126 * PC11|LPUART1 |LCD | | | | |USART4 | |
mbed_official 489:119543c9f674 127 * PC12| |LCD |USART5 | | | |USART4 | |
mbed_official 489:119543c9f674 128 * PC13| | | | | | | | |
mbed_official 489:119543c9f674 129 * PC14| | | | | | | | |
mbed_official 489:119543c9f674 130 * PC15| | | | | | | | |
mbed_official 489:119543c9f674 131 *______________________________________________________________________________
mbed_official 489:119543c9f674 132 * PD0 |TIM21_C1|SPI2 | | | | | | |
mbed_official 489:119543c9f674 133 * PD1 | |SPI2 | | | | | | |
mbed_official 489:119543c9f674 134 * PD2 |LPUART1 |LCD |TIM3_TR | | | |USART5 | |
mbed_official 489:119543c9f674 135 * PD3 |USART2 |LCD |SPI2 | | | | | |
mbed_official 489:119543c9f674 136 * PD4 |USART2 |SPI2 | | | | | | |
mbed_official 489:119543c9f674 137 * PD5 |USART2 | | | | | | | |
mbed_official 489:119543c9f674 138 * PD6 |USART2 | | | | | | | |
mbed_official 489:119543c9f674 139 * PD7 |USART2 |TIM21_C2| | | | | | |
mbed_official 489:119543c9f674 140 * PD8 |LPUART1 |LCD | | | | | | |
mbed_official 489:119543c9f674 141 * PD9 |LPUART1 |LCD | | | | | | |
mbed_official 489:119543c9f674 142 * PD10| |LCD | | | | | | |
mbed_official 489:119543c9f674 143 * PD11|LPUART1 |LCD | | | | | | |
mbed_official 489:119543c9f674 144 * PD12|LPUART1 |LCD | | | | | | |
mbed_official 489:119543c9f674 145 * PD13| |LCD | | | | | | |
mbed_official 489:119543c9f674 146 * PD14| |LCD | | | | | | |
mbed_official 489:119543c9f674 147 * PD15|USB |LCD | | | | | | |
mbed_official 489:119543c9f674 148 *______________________________________________________________________________
mbed_official 489:119543c9f674 149 * PE0 | |LCD |EVENTOUT| | | | | |
mbed_official 489:119543c9f674 150 * PE1 | |LCD |EVENTOUT| | | | | |
mbed_official 489:119543c9f674 151 * PE2 | |LCD |TIM3_TR | | | | | |
mbed_official 489:119543c9f674 152 * PE3 |TIM22_C1|LCD |TIM3_C1 | | | | | |
mbed_official 489:119543c9f674 153 * PE4 |TIM22_C2| |TIM3_C2 | | | | | |
mbed_official 489:119543c9f674 154 * PE5 |TIM21_C1| |TIM3_C3 | | | | | |
mbed_official 489:119543c9f674 155 * PE6 |TIM21_C2| |TIM3_C4 | | | | | |
mbed_official 489:119543c9f674 156 * PE7 | |LCD | | | | |USART5 | |
mbed_official 489:119543c9f674 157 * PE8 | |LCD | | | | |USART4 | |
mbed_official 489:119543c9f674 158 * PE9 |TIM2_C1 |LCD |TIM2_TR | | | |USART4 | |
mbed_official 489:119543c9f674 159 * PE10|TIM2_C2 |LCD | | | | |USART5 | |
mbed_official 489:119543c9f674 160 * PE11|TIM2_C3 | | | | | |USART5 | |
mbed_official 489:119543c9f674 161 * PE12|TIM2_C4 | |SPI1 | | | | | |
mbed_official 489:119543c9f674 162 * PE13| |LCD |SPI1 | | | | | |
mbed_official 489:119543c9f674 163 * PE14| |LCD |SPI1 | | | | | |
mbed_official 489:119543c9f674 164 * PE15| |LCD |SPI1 | | | | | |
mbed_official 489:119543c9f674 165 *______________________________________________________________________________
mbed_official 489:119543c9f674 166 * PH0 |USB | | | | | | | |
mbed_official 489:119543c9f674 167 * PH1 | | | | | | | | |
mbed_official 489:119543c9f674 168 * PH9 | | | | | | | | |
mbed_official 489:119543c9f674 169 * PH10| | | | | | | | |
mbed_official 489:119543c9f674 170 *
mbed_official 489:119543c9f674 171 */
mbed_official 489:119543c9f674 172
mbed_official 489:119543c9f674 173 /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
mbed_official 489:119543c9f674 174 * @{
mbed_official 489:119543c9f674 175 */
mbed_official 489:119543c9f674 176
mbed_official 489:119543c9f674 177 /** @defgroup GPIOEx_Alternate_function_AF0 Alternate function AF0
mbed_official 489:119543c9f674 178 * @{
mbed_official 489:119543c9f674 179 */
mbed_official 489:119543c9f674 180 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 181 #define GPIO_AF0_TIM21 ((uint8_t)0x00) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 182 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 183 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 184 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /* SWDIO Alternate Function mapping */
mbed_official 489:119543c9f674 185 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /* SWCLK Alternate Function mapping */
mbed_official 489:119543c9f674 186 #define GPIO_AF0_USART1 ((uint8_t)0x00) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 187 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 188 #define GPIO_AF0_LPTIM1 ((uint8_t)0x00) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 189 #define GPIO_AF0_TIM22 ((uint8_t)0x00) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 190 #define GPIO_AF0_LPUART1 ((uint8_t)0x00) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 191 #define GPIO_AF0_USART2 ((uint8_t)0x00) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 192 #define GPIO_AF0_TIM2 ((uint8_t)0x00) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 193 #define GPIO_AF0_USB ((uint8_t)0x00) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 194 /**
mbed_official 489:119543c9f674 195 * @}
mbed_official 489:119543c9f674 196 */
mbed_official 489:119543c9f674 197
mbed_official 489:119543c9f674 198 /** @defgroup GPIOEx_Alternate_function_AF1 Alternate function AF1
mbed_official 489:119543c9f674 199 * @{
mbed_official 489:119543c9f674 200 */
mbed_official 489:119543c9f674 201 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 202 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 203 #define GPIO_AF1_TIM21 ((uint8_t)0x01) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 204 #define GPIO_AF1_LCD ((uint8_t)0x01) /* LCD Alternate Function mapping */
mbed_official 489:119543c9f674 205 /**
mbed_official 489:119543c9f674 206 * @}
mbed_official 489:119543c9f674 207 */
mbed_official 489:119543c9f674 208
mbed_official 489:119543c9f674 209 /** @defgroup GPIOEx_Alternate_function_AF2 Alternate function AF2
mbed_official 489:119543c9f674 210 * @{
mbed_official 489:119543c9f674 211 */
mbed_official 489:119543c9f674 212 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 213 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
mbed_official 489:119543c9f674 214 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 215 #define GPIO_AF2_LPTIM1 ((uint8_t)0x02) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 216 #define GPIO_AF2_LPUART1 ((uint8_t)0x02) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 217 #define GPIO_AF2_MCO ((uint8_t)0x02) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 218 #define GPIO_AF2_RTC ((uint8_t)0x02) /* RTC_OUT Alternate Function mapping */
mbed_official 489:119543c9f674 219 #define GPIO_AF2_SPI2 ((uint8_t)0x02) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 220 #define GPIO_AF2_USART5 ((uint8_t)0x02) /* USART5 Alternate Function mapping */
mbed_official 489:119543c9f674 221 #define GPIO_AF2_SPI1 ((uint8_t)0x02) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 222 #define GPIO_AF2_USB ((uint8_t)0x00) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 223 /**
mbed_official 489:119543c9f674 224 * @}
mbed_official 489:119543c9f674 225 */
mbed_official 489:119543c9f674 226
mbed_official 489:119543c9f674 227 /** @defgroup GPIOEx_Alternate_function_AF3 Alternate function AF3
mbed_official 489:119543c9f674 228 * @{
mbed_official 489:119543c9f674 229 */
mbed_official 489:119543c9f674 230 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 231 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 232 #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */
mbed_official 489:119543c9f674 233 /**
mbed_official 489:119543c9f674 234 * @}
mbed_official 489:119543c9f674 235 */
mbed_official 489:119543c9f674 236
mbed_official 489:119543c9f674 237 /** @defgroup GPIOEx_Alternate_function_AF4 Alternate function AF4
mbed_official 489:119543c9f674 238 * @{
mbed_official 489:119543c9f674 239 */
mbed_official 489:119543c9f674 240 #define GPIO_AF4_USART2 ((uint8_t)0x04) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 241 #define GPIO_AF4_LPUART1 ((uint8_t)0x04) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 242 #define GPIO_AF4_USART1 ((uint8_t)0x04) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 243 #define GPIO_AF4_EVENTOUT ((uint8_t)0x04) /* EVENTOUT Alternate Function mapping*/
mbed_official 489:119543c9f674 244 #define GPIO_AF4_TIM22 ((uint8_t)0x04) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 245 #define GPIO_AF4_TIM3 ((uint8_t)0x04) /* TIM3 Alternate Function mapping */
mbed_official 489:119543c9f674 246 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 247 /**
mbed_official 489:119543c9f674 248 * @}
mbed_official 489:119543c9f674 249 */
mbed_official 489:119543c9f674 250
mbed_official 489:119543c9f674 251 /** @defgroup GPIOEx_Alternate_function_AF5 Alternate function AF5
mbed_official 489:119543c9f674 252 * @{
mbed_official 489:119543c9f674 253 */
mbed_official 489:119543c9f674 254 #define GPIO_AF5_TIM2 ((uint8_t)0x05) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 255 #define GPIO_AF5_TIM21 ((uint8_t)0x05) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 256 #define GPIO_AF5_TIM22 ((uint8_t)0x05) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 257 #define GPIO_AF5_USART1 ((uint8_t)0x05) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 258 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 259 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /* I2C2 Alternate Function mapping */
mbed_official 489:119543c9f674 260 /**
mbed_official 489:119543c9f674 261 * @}
mbed_official 489:119543c9f674 262 */
mbed_official 489:119543c9f674 263
mbed_official 489:119543c9f674 264 /** @defgroup GPIOEx_Alternate_function_AF6 Alternate function AF6
mbed_official 489:119543c9f674 265 * @{
mbed_official 489:119543c9f674 266 */
mbed_official 489:119543c9f674 267
mbed_official 489:119543c9f674 268 #define GPIO_AF6_USART4 ((uint8_t)0x06) /* USART4 Alternate Function mapping */
mbed_official 489:119543c9f674 269 #define GPIO_AF6_LPUART1 ((uint8_t)0x06) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 270 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 271 #define GPIO_AF6_I2C1 ((uint8_t)0x06) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 272 #define GPIO_AF6_I2C2 ((uint8_t)0x06) /* I2C2 Alternate Function mapping */
mbed_official 489:119543c9f674 273 #define GPIO_AF6_USART5 ((uint8_t)0x06) /* USART5 Alternate Function mapping */
mbed_official 489:119543c9f674 274 #define GPIO_AF6_TIM21 ((uint8_t)0x06) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 275 /**
mbed_official 489:119543c9f674 276 * @}
mbed_official 489:119543c9f674 277 */
mbed_official 489:119543c9f674 278
mbed_official 489:119543c9f674 279 /** @defgroup GPIOEx_Alternate_function_AF7 Alternate function AF7
mbed_official 489:119543c9f674 280 * @{
mbed_official 489:119543c9f674 281 */
mbed_official 489:119543c9f674 282 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /* COMP1 Alternate Function mapping */
mbed_official 489:119543c9f674 283 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /* COMP2 Alternate Function mapping */
mbed_official 489:119543c9f674 284 #define GPIO_AF7_I2C3 ((uint8_t)0x07) /* I2C3 Alternate Function mapping */
mbed_official 489:119543c9f674 285 #define GPIO_AF7_LPUART1 ((uint8_t)0x07) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 286 /**
mbed_official 489:119543c9f674 287 * @}
mbed_official 489:119543c9f674 288 */
mbed_official 489:119543c9f674 289
mbed_official 489:119543c9f674 290 /**
mbed_official 489:119543c9f674 291 * @}
mbed_official 489:119543c9f674 292 */
mbed_official 489:119543c9f674 293
mbed_official 489:119543c9f674 294 /**
mbed_official 489:119543c9f674 295 * @brief IS_GPIO_AF macro definition
mbed_official 489:119543c9f674 296 */
mbed_official 489:119543c9f674 297 #define IS_GPIO_AF(__AF__) (((__AF__) == GPIO_AF0_EVENTOUT) || ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 298 ((__AF__) == GPIO_AF0_SPI1) || ((__AF__) == GPIO_AF1_I2C1) || \
mbed_official 489:119543c9f674 299 ((__AF__) == GPIO_AF0_TIM21) || ((__AF__) == GPIO_AF1_SPI2) || \
mbed_official 489:119543c9f674 300 ((__AF__) == GPIO_AF0_MCO) || ((__AF__) == GPIO_AF1_TIM21) || \
mbed_official 489:119543c9f674 301 ((__AF__) == GPIO_AF0_SWDIO) || ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 302 ((__AF__) == GPIO_AF0_SWCLK) || ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 303 ((__AF__) == GPIO_AF0_USART1) || ((__AF__) == GPIO_AF2_USB) || \
mbed_official 489:119543c9f674 304 ((__AF__) == GPIO_AF0_SPI2) || ((__AF__) == GPIO_AF2_EVENTOUT) || \
mbed_official 489:119543c9f674 305 ((__AF__) == GPIO_AF0_LPTIM1) || ((__AF__) == GPIO_AF2_LPTIM1) || \
mbed_official 489:119543c9f674 306 ((__AF__) == GPIO_AF0_TIM2) || ((__AF__) == GPIO_AF2_LPUART1) || \
mbed_official 489:119543c9f674 307 ((__AF__) == GPIO_AF0_LPUART1) || ((__AF__) == GPIO_AF2_MCO) || \
mbed_official 489:119543c9f674 308 ((__AF__) == GPIO_AF0_USART2) || ((__AF__) == GPIO_AF2_RTC) || \
mbed_official 489:119543c9f674 309 ((__AF__) == GPIO_AF0_USB) || ((__AF__) == GPIO_AF2_SPI2) || \
mbed_official 489:119543c9f674 310 ((__AF__) == GPIO_AF0_TIM2) || ((__AF__) == GPIO_AF2_USART5) || \
mbed_official 489:119543c9f674 311 ((__AF__) == GPIO_AF3_TSC) || ((__AF__) == GPIO_AF2_SPI1) || \
mbed_official 489:119543c9f674 312 ((__AF__) == GPIO_AF3_EVENTOUT) || ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 313 ((__AF__) == GPIO_AF3_I2C1) || ((__AF__) == GPIO_AF4_LPUART1) || \
mbed_official 489:119543c9f674 314 ((__AF__) == GPIO_AF5_TIM21) || ((__AF__) == GPIO_AF4_EVENTOUT) || \
mbed_official 489:119543c9f674 315 ((__AF__) == GPIO_AF5_TIM2) || ((__AF__) == GPIO_AF4_USART1) || \
mbed_official 489:119543c9f674 316 ((__AF__) == GPIO_AF5_USART1) || ((__AF__) == GPIO_AF4_TIM22) || \
mbed_official 489:119543c9f674 317 ((__AF__) == GPIO_AF5_TIM22) || ((__AF__) == GPIO_AF4_TIM3) || \
mbed_official 489:119543c9f674 318 ((__AF__) == GPIO_AF5_SPI2) || ((__AF__) == GPIO_AF4_I2C1) || \
mbed_official 489:119543c9f674 319 ((__AF__) == GPIO_AF5_I2C2) || ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 320 ((__AF__) == GPIO_AF7_COMP2) || ((__AF__) == GPIO_AF6_LPUART1) || \
mbed_official 489:119543c9f674 321 ((__AF__) == GPIO_AF7_COMP1) || ((__AF__) == GPIO_AF6_I2C1) || \
mbed_official 489:119543c9f674 322 ((__AF__) == GPIO_AF7_I2C3) || ((__AF__) == GPIO_AF6_EVENTOUT) || \
mbed_official 489:119543c9f674 323 ((__AF__) == GPIO_AF7_LPUART1) || ((__AF__) == GPIO_AF6_I2C2) || \
mbed_official 489:119543c9f674 324 ((__AF__) == GPIO_AF6_USART5) || ((__AF__) == GPIO_AF6_TIM21))
mbed_official 489:119543c9f674 325
mbed_official 489:119543c9f674 326
mbed_official 489:119543c9f674 327 #define IS_GPIO_AF_AVAILABLE(__INSTANCE__,__AF__) \
mbed_official 489:119543c9f674 328 ((((__INSTANCE__) == GPIOA) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 329 ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 330 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 331 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 332 ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 333 ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 334 ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 335 ((__AF__) == GPIO_AF7_I2C3))) || \
mbed_official 489:119543c9f674 336 (((__INSTANCE__) == GPIOB) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 337 ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 338 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 339 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 340 ((__AF__) == GPIO_AF4_TIM3) || \
mbed_official 489:119543c9f674 341 ((__AF__) == GPIO_AF5_I2C2) || \
mbed_official 489:119543c9f674 342 ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 343 ((__AF__) == GPIO_AF7_LPUART1))) || \
mbed_official 489:119543c9f674 344 (((__INSTANCE__) == GPIOC) && (((__AF__) == GPIO_AF0_LPTIM1) || \
mbed_official 489:119543c9f674 345 ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 346 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 347 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 348 ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 349 ((__AF__) == GPIO_AF7_I2C3))) || \
mbed_official 489:119543c9f674 350 (((__INSTANCE__) == GPIOD) && (((__AF__) == GPIO_AF0_LPUART1) || \
mbed_official 489:119543c9f674 351 ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 352 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 353 ((__AF__) == GPIO_AF6_USART5))) || \
mbed_official 489:119543c9f674 354 (((__INSTANCE__) == GPIOE) && (((__AF__) == GPIO_AF0_TIM22) || \
mbed_official 489:119543c9f674 355 ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 356 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 357 ((__AF__) == GPIO_AF6_USART4))) || \
mbed_official 489:119543c9f674 358 (((__INSTANCE__) == GPIOH) && (((__AF__) == GPIO_AF0_USB))))
mbed_official 489:119543c9f674 359
mbed_official 489:119543c9f674 360 #endif /* (STM32L083xx) || (STM32L073xx) */
mbed_official 489:119543c9f674 361
mbed_official 489:119543c9f674 362 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 363 /*------------------------- STM32L082xx and STM32L072xx-----------------------*/
mbed_official 489:119543c9f674 364 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 365 #if defined (STM32L082xx) || defined (STM32L072xx)
mbed_official 489:119543c9f674 366
mbed_official 489:119543c9f674 367 /* The table below gives an overview of the different alternate functions per port.
mbed_official 489:119543c9f674 368 * For more details refer yourself to the product data sheet.
mbed_official 489:119543c9f674 369 */
mbed_official 489:119543c9f674 370
mbed_official 489:119543c9f674 371
mbed_official 489:119543c9f674 372 /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
mbed_official 489:119543c9f674 373 *______________________________________________________________________________
mbed_official 489:119543c9f674 374 * PA0 | | |TIM2_C1 |TSC |USART2 |TIM2_TR |USART4 |COMP1 |
mbed_official 489:119543c9f674 375 * PA1 |EVENTOUT| |TIM2_C2 |TSC |USART2 |TIM21_TR|USART4 | |
mbed_official 489:119543c9f674 376 * PA2 |TIM21_C1| |TIM2_C3 |TSC |USART2 | |LPUART1 |COMP2 |
mbed_official 489:119543c9f674 377 * PA3 |TIM21_C2| |TIM2_C4 |TSC |USART2 | |LPUART1 | |
mbed_official 489:119543c9f674 378 * PA4 |SPI1 | | |TSC |USART2 |TIM22_TR| | |
mbed_official 489:119543c9f674 379 * PA5 |SPI1 | |TIM2_TR |TSC | |TIM2_C1 | | |
mbed_official 489:119543c9f674 380 * PA6 |SPI1 | |TIM3_C1 |TSC |LPUART1 |TIM22_C1|EVENTOUT|COMP1 |
mbed_official 489:119543c9f674 381 * PA7 |SPI1 | |TIM3_C2 |TSC | |TIM22_C2|EVENTOUT|COMP2 |
mbed_official 489:119543c9f674 382 * PA8 |MCO | |USB |EVENTOUT|USART1 | | |I2C3 |
mbed_official 489:119543c9f674 383 * PA9 |MCO | | |TSC |USART1 | |I2C1 |I2C3 |
mbed_official 489:119543c9f674 384 * PA10| | | |TSC |USART1 | |I2C1 | |
mbed_official 489:119543c9f674 385 * PA11|SPI1 | |EVENTOUT|TSC |USART1 | |I2C2 |COMP1 |
mbed_official 489:119543c9f674 386 * PA12|SPI1 | |EVENTOUT|TSC |USART1 | |I2C2 |COMP2 |
mbed_official 489:119543c9f674 387 * PA13|SWDIO | |USB | | | |LPUART1 | |
mbed_official 489:119543c9f674 388 * PA14|SWCLK | | | |USART2 | |LPUART1 | |
mbed_official 489:119543c9f674 389 * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 |USART4 | |
mbed_official 489:119543c9f674 390 *______________________________________________________________________________
mbed_official 489:119543c9f674 391 * PB0 |EVENTOUT| |TIM3_C3 |TSC | | | | |
mbed_official 489:119543c9f674 392 * PB1 | | |TIM3_C4 |TSC |LPUART1 | | | |
mbed_official 489:119543c9f674 393 * PB2 | | |LPTIM1_O|TSC | | | |I2C3 |
mbed_official 489:119543c9f674 394 * PB3 |SPI1 | |TIM2_C2 |TSC |EVENTOUT|USART1 |USART5 | |
mbed_official 489:119543c9f674 395 * PB4 |SPI1 | |TIM3_C1 |TSC |TIM22_C1|USART1 |USART5 |I2C3 |
mbed_official 489:119543c9f674 396 * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM3_C2 |USART1 |USART5 | |
mbed_official 489:119543c9f674 397 * | | | | |TIM22_C2| | | |
mbed_official 489:119543c9f674 398 * PB6 |USART1 |I2C1 |LPTIM1_T|TSC | | | | |
mbed_official 489:119543c9f674 399 * PB7 |USART1 |I2C1 |LPTIM1_I|TSC | | |USART4 | |
mbed_official 489:119543c9f674 400 * PB8 | | | |TSC |I2C1 | | | |
mbed_official 489:119543c9f674 401 * PB9 | | |EVENTOUT| |I2C1 |SPI2 | | |
mbed_official 489:119543c9f674 402 * PB10| | |TIM2_C3 |TSC |LPUART1 |SPI2 |I2C2 |LPUART1 |
mbed_official 489:119543c9f674 403 * PB11|EVENTOUT| |TIM2_C4 |TSC |LPUART1 | |I2C2 |LPUART1 |
mbed_official 489:119543c9f674 404 * PB12|SPI2 | |LPUART1 |TSC | |I2C2 |EVENTOUT| |
mbed_official 489:119543c9f674 405 * PB13|SPI2 | |MCO |TSC |LPUART1 |I2C2 |TIM21_C1| |
mbed_official 489:119543c9f674 406 * PB14|SPI2 | |RTC |TSC |LPUART1 |I2C2 |TIM21_C2| |
mbed_official 489:119543c9f674 407 * PB15|SPI2 | |RTC | | | | | |
mbed_official 489:119543c9f674 408 *______________________________________________________________________________
mbed_official 489:119543c9f674 409 * PC0 |LPTIM1_I| |EVENTOUT|TSC | | |LPUART1 |I2C3 |
mbed_official 489:119543c9f674 410 * PC1 |LPTIM1_O| |EVENTOUT|TSC | | |LPUART1 |I2C3 |
mbed_official 489:119543c9f674 411 * PC2 |LPTIM1_I| |SPI2 |TSC | | | | |
mbed_official 489:119543c9f674 412 * PC3 |LPTIM1_T| |SPI2 |TSC | | | | |
mbed_official 489:119543c9f674 413 * PC4 |EVENTOUT| |LPUART1 | | | | | |
mbed_official 489:119543c9f674 414 * PC5 | | |LPUART1 |TSC | | | | |
mbed_official 489:119543c9f674 415 * PC6 |TIM22_C1| |TIM3_C1 |TSC | | | | |
mbed_official 489:119543c9f674 416 * PC7 |TIM22_C2| |TIM3_C2 |TSC | | | | |
mbed_official 489:119543c9f674 417 * PC8 |TIM22_TR| |TIM3_C3 |TSC | | | | |
mbed_official 489:119543c9f674 418 * PC9 |TIM21_TR| |USB |TSC | | | |I2C3 |
mbed_official 489:119543c9f674 419 * | | |TIM3_C4 | | | | | |
mbed_official 489:119543c9f674 420 * PC10|LPUART1 | | | | | |USART4 | |
mbed_official 489:119543c9f674 421 * PC11|LPUART1 | | | | | |USART4 | |
mbed_official 489:119543c9f674 422 * PC12| | |USART5 | | | |USART4 | |
mbed_official 489:119543c9f674 423 * PC13| | | | | | | | |
mbed_official 489:119543c9f674 424 * PC14| | | | | | | | |
mbed_official 489:119543c9f674 425 * PC15| | | | | | | | |
mbed_official 489:119543c9f674 426 *______________________________________________________________________________
mbed_official 489:119543c9f674 427 * PD0 |TIM21_C1|SPI2 | | | | | | |
mbed_official 489:119543c9f674 428 * PD1 | |SPI2 | | | | | | |
mbed_official 489:119543c9f674 429 * PD2 |LPUART1 | |TIM3_TR | | | |USART5 | |
mbed_official 489:119543c9f674 430 * PD3 |USART2 | |SPI2 | | | | | |
mbed_official 489:119543c9f674 431 * PD4 |USART2 |SPI2 | | | | | | |
mbed_official 489:119543c9f674 432 * PD5 |USART2 | | | | | | | |
mbed_official 489:119543c9f674 433 * PD6 |USART2 | | | | | | | |
mbed_official 489:119543c9f674 434 * PD7 |USART2 |TIM21_C2| | | | | | |
mbed_official 489:119543c9f674 435 * PD8 |LPUART1 | | | | | | | |
mbed_official 489:119543c9f674 436 * PD9 |LPUART1 | | | | | | | |
mbed_official 489:119543c9f674 437 * PD10| | | | | | | | |
mbed_official 489:119543c9f674 438 * PD11|LPUART1 | | | | | | | |
mbed_official 489:119543c9f674 439 * PD12|LPUART1 | | | | | | | |
mbed_official 489:119543c9f674 440 * PD13| | | | | | | | |
mbed_official 489:119543c9f674 441 * PD14| | | | | | | | |
mbed_official 489:119543c9f674 442 * PD15|USB | | | | | | | |
mbed_official 489:119543c9f674 443 *______________________________________________________________________________
mbed_official 489:119543c9f674 444 * PE0 | | |EVENTOUT| | | | | |
mbed_official 489:119543c9f674 445 * PE1 | | |EVENTOUT| | | | | |
mbed_official 489:119543c9f674 446 * PE2 | | |TIM3_TR | | | | | |
mbed_official 489:119543c9f674 447 * PE3 |TIM22_C1| |TIM3_C1 | | | | | |
mbed_official 489:119543c9f674 448 * PE4 |TIM22_C2| |TIM3_C2 | | | | | |
mbed_official 489:119543c9f674 449 * PE5 |TIM21_C1| |TIM3_C3 | | | | | |
mbed_official 489:119543c9f674 450 * PE6 |TIM21_C2| |TIM3_C4 | | | | | |
mbed_official 489:119543c9f674 451 * PE7 | | | | | | |USART5 | |
mbed_official 489:119543c9f674 452 * PE8 | | | | | | |USART4 | |
mbed_official 489:119543c9f674 453 * PE9 |TIM2_C1 | |TIM2_TR | | | |USART4 | |
mbed_official 489:119543c9f674 454 * PE10|TIM2_C2 | | | | | |USART5 | |
mbed_official 489:119543c9f674 455 * PE11|TIM2_C3 | | | | | |USART5 | |
mbed_official 489:119543c9f674 456 * PE12|TIM2_C4 | |SPI1 | | | | | |
mbed_official 489:119543c9f674 457 * PE13| | |SPI1 | | | | | |
mbed_official 489:119543c9f674 458 * PE14| | |SPI1 | | | | | |
mbed_official 489:119543c9f674 459 * PE15| | |SPI1 | | | | | |
mbed_official 489:119543c9f674 460 *______________________________________________________________________________
mbed_official 489:119543c9f674 461 * PH0 |USB | | | | | | | |
mbed_official 489:119543c9f674 462 * PH1 | | | | | | | | |
mbed_official 489:119543c9f674 463 * PH9 | | | | | | | | |
mbed_official 489:119543c9f674 464 * PH10| | | | | | | | |
mbed_official 489:119543c9f674 465 *
mbed_official 489:119543c9f674 466 */
mbed_official 489:119543c9f674 467
mbed_official 489:119543c9f674 468 /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
mbed_official 489:119543c9f674 469 * @{
mbed_official 489:119543c9f674 470 */
mbed_official 489:119543c9f674 471
mbed_official 489:119543c9f674 472 /** @defgroup GPIOEx_Alternate_function_AF1 Alternate function AF1
mbed_official 489:119543c9f674 473 * @{
mbed_official 489:119543c9f674 474 */
mbed_official 489:119543c9f674 475 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 476 #define GPIO_AF0_TIM21 ((uint8_t)0x00) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 477 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 478 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 479 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /* SWDIO Alternate Function mapping */
mbed_official 489:119543c9f674 480 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /* SWCLK Alternate Function mapping */
mbed_official 489:119543c9f674 481 #define GPIO_AF0_USART1 ((uint8_t)0x00) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 482 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 483 #define GPIO_AF0_LPTIM1 ((uint8_t)0x00) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 484 #define GPIO_AF0_TIM22 ((uint8_t)0x00) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 485 #define GPIO_AF0_LPUART1 ((uint8_t)0x00) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 486 #define GPIO_AF0_USART2 ((uint8_t)0x00) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 487 #define GPIO_AF0_TIM2 ((uint8_t)0x00) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 488 #define GPIO_AF0_USB ((uint8_t)0x00) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 489 /**
mbed_official 489:119543c9f674 490 * @}
mbed_official 489:119543c9f674 491 */
mbed_official 489:119543c9f674 492
mbed_official 489:119543c9f674 493 /** @defgroup GPIOEx_Alternate_function_AF0 Alternate function AF0
mbed_official 489:119543c9f674 494 * @{
mbed_official 489:119543c9f674 495 */
mbed_official 489:119543c9f674 496 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 497 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 498 #define GPIO_AF1_TIM21 ((uint8_t)0x01) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 499 /**
mbed_official 489:119543c9f674 500 * @}
mbed_official 489:119543c9f674 501 */
mbed_official 489:119543c9f674 502
mbed_official 489:119543c9f674 503 /** @defgroup GPIOEx_Alternate_function_AF2 Alternate function AF2
mbed_official 489:119543c9f674 504 * @{
mbed_official 489:119543c9f674 505 */
mbed_official 489:119543c9f674 506 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 507 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
mbed_official 489:119543c9f674 508 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 509 #define GPIO_AF2_LPTIM1 ((uint8_t)0x02) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 510 #define GPIO_AF2_LPUART1 ((uint8_t)0x02) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 511 #define GPIO_AF2_MCO ((uint8_t)0x02) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 512 #define GPIO_AF2_RTC ((uint8_t)0x02) /* RTC_OUT Alternate Function mapping */
mbed_official 489:119543c9f674 513 #define GPIO_AF2_SPI2 ((uint8_t)0x02) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 514 #define GPIO_AF2_USART5 ((uint8_t)0x02) /* USART5 Alternate Function mapping */
mbed_official 489:119543c9f674 515 #define GPIO_AF2_SPI1 ((uint8_t)0x02) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 516 #define GPIO_AF2_USB ((uint8_t)0x00) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 517 /**
mbed_official 489:119543c9f674 518 * @}
mbed_official 489:119543c9f674 519 */
mbed_official 489:119543c9f674 520
mbed_official 489:119543c9f674 521 /** @defgroup GPIOEx_Alternate_function_AF3 Alternate function AF3
mbed_official 489:119543c9f674 522 * @{
mbed_official 489:119543c9f674 523 */
mbed_official 489:119543c9f674 524 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 525 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 526 #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */
mbed_official 489:119543c9f674 527 /**
mbed_official 489:119543c9f674 528 * @}
mbed_official 376:cb4d9db17537 529 */
mbed_official 489:119543c9f674 530
mbed_official 489:119543c9f674 531 /** @defgroup GPIOEx_Alternate_function_AF4 Alternate function AF4
mbed_official 489:119543c9f674 532 * @{
mbed_official 489:119543c9f674 533 */
mbed_official 489:119543c9f674 534 #define GPIO_AF4_USART2 ((uint8_t)0x04) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 535 #define GPIO_AF4_LPUART1 ((uint8_t)0x04) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 536 #define GPIO_AF4_USART1 ((uint8_t)0x04) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 537 #define GPIO_AF4_EVENTOUT ((uint8_t)0x04) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 538 #define GPIO_AF4_TIM22 ((uint8_t)0x04) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 539 #define GPIO_AF4_TIM3 ((uint8_t)0x04) /* TIM3 Alternate Function mapping */
mbed_official 489:119543c9f674 540 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 541 /**
mbed_official 489:119543c9f674 542 * @}
mbed_official 489:119543c9f674 543 */
mbed_official 489:119543c9f674 544
mbed_official 489:119543c9f674 545 /** @defgroup GPIOEx_Alternate_function_AF5 Alternate function AF5
mbed_official 489:119543c9f674 546 * @{
mbed_official 489:119543c9f674 547 */
mbed_official 489:119543c9f674 548 #define GPIO_AF5_TIM2 ((uint8_t)0x05) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 549 #define GPIO_AF5_TIM21 ((uint8_t)0x05) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 550 #define GPIO_AF5_TIM22 ((uint8_t)0x05) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 551 #define GPIO_AF5_USART1 ((uint8_t)0x05) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 552 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 553 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /* I2C2 Alternate Function mapping */
mbed_official 489:119543c9f674 554 /**
mbed_official 489:119543c9f674 555 * @}
mbed_official 489:119543c9f674 556 */
mbed_official 489:119543c9f674 557
mbed_official 489:119543c9f674 558 /** @defgroup GPIOEx_Alternate_function_AF6 Alternate function AF6
mbed_official 489:119543c9f674 559 * @{
mbed_official 489:119543c9f674 560 */
mbed_official 489:119543c9f674 561 #define GPIO_AF6_USART4 ((uint8_t)0x06) /* USART4 Alternate Function mapping */
mbed_official 489:119543c9f674 562 #define GPIO_AF6_LPUART1 ((uint8_t)0x06) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 563 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 564 #define GPIO_AF6_I2C1 ((uint8_t)0x06) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 565 #define GPIO_AF6_I2C2 ((uint8_t)0x06) /* I2C2 Alternate Function mapping */
mbed_official 489:119543c9f674 566 #define GPIO_AF6_USART5 ((uint8_t)0x06) /* USART5 Alternate Function mapping */
mbed_official 489:119543c9f674 567 #define GPIO_AF6_TIM21 ((uint8_t)0x06) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 568 /**
mbed_official 489:119543c9f674 569 * @}
mbed_official 489:119543c9f674 570 */
mbed_official 489:119543c9f674 571
mbed_official 489:119543c9f674 572 /** @defgroup GPIOEx_Alternate_function_AF7 Alternate function AF7
mbed_official 489:119543c9f674 573 * @{
mbed_official 489:119543c9f674 574 */
mbed_official 489:119543c9f674 575 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /* COMP1 Alternate Function mapping */
mbed_official 489:119543c9f674 576 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /* COMP2 Alternate Function mapping */
mbed_official 489:119543c9f674 577 #define GPIO_AF7_I2C3 ((uint8_t)0x07) /* I2C3 Alternate Function mapping */
mbed_official 489:119543c9f674 578 #define GPIO_AF7_LPUART1 ((uint8_t)0x07) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 579 /**
mbed_official 489:119543c9f674 580 * @}
mbed_official 489:119543c9f674 581 */
mbed_official 489:119543c9f674 582
mbed_official 489:119543c9f674 583 /**
mbed_official 489:119543c9f674 584 * @}
mbed_official 489:119543c9f674 585 */
mbed_official 489:119543c9f674 586
mbed_official 489:119543c9f674 587 /**
mbed_official 489:119543c9f674 588 * IS_GPIO_AF macro definition
mbed_official 489:119543c9f674 589 */
mbed_official 489:119543c9f674 590 #define IS_GPIO_AF(__AF__) (((__AF__) == GPIO_AF0_EVENTOUT) || ((__AF__) == GPIO_AF6_TIM21) || \
mbed_official 489:119543c9f674 591 ((__AF__) == GPIO_AF0_SPI1) || ((__AF__) == GPIO_AF1_I2C1) || \
mbed_official 489:119543c9f674 592 ((__AF__) == GPIO_AF0_TIM21) || ((__AF__) == GPIO_AF1_SPI2) || \
mbed_official 489:119543c9f674 593 ((__AF__) == GPIO_AF0_MCO) || ((__AF__) == GPIO_AF1_TIM21) || \
mbed_official 489:119543c9f674 594 ((__AF__) == GPIO_AF0_SWDIO) || ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 595 ((__AF__) == GPIO_AF0_SWCLK) || ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 596 ((__AF__) == GPIO_AF0_USART1) || ((__AF__) == GPIO_AF2_USB) || \
mbed_official 489:119543c9f674 597 ((__AF__) == GPIO_AF0_SPI2) || ((__AF__) == GPIO_AF2_EVENTOUT) || \
mbed_official 489:119543c9f674 598 ((__AF__) == GPIO_AF0_LPTIM1) || ((__AF__) == GPIO_AF2_LPTIM1) || \
mbed_official 489:119543c9f674 599 ((__AF__) == GPIO_AF0_TIM2) || ((__AF__) == GPIO_AF2_LPUART1) || \
mbed_official 489:119543c9f674 600 ((__AF__) == GPIO_AF0_LPUART1) || ((__AF__) == GPIO_AF2_MCO) || \
mbed_official 489:119543c9f674 601 ((__AF__) == GPIO_AF0_USART2) || ((__AF__) == GPIO_AF2_RTC) || \
mbed_official 489:119543c9f674 602 ((__AF__) == GPIO_AF0_USB) || ((__AF__) == GPIO_AF2_SPI2) || \
mbed_official 489:119543c9f674 603 ((__AF__) == GPIO_AF0_TIM2) || ((__AF__) == GPIO_AF2_USART5) || \
mbed_official 489:119543c9f674 604 ((__AF__) == GPIO_AF3_TSC) || ((__AF__) == GPIO_AF2_SPI1) || \
mbed_official 489:119543c9f674 605 ((__AF__) == GPIO_AF3_EVENTOUT) || ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 606 ((__AF__) == GPIO_AF3_I2C1) || ((__AF__) == GPIO_AF4_LPUART1) || \
mbed_official 489:119543c9f674 607 ((__AF__) == GPIO_AF5_TIM21) || ((__AF__) == GPIO_AF4_EVENTOUT) || \
mbed_official 489:119543c9f674 608 ((__AF__) == GPIO_AF5_TIM2) || ((__AF__) == GPIO_AF4_USART1) || \
mbed_official 489:119543c9f674 609 ((__AF__) == GPIO_AF5_USART1) || ((__AF__) == GPIO_AF4_TIM22) || \
mbed_official 489:119543c9f674 610 ((__AF__) == GPIO_AF5_TIM22) || ((__AF__) == GPIO_AF4_TIM3) || \
mbed_official 489:119543c9f674 611 ((__AF__) == GPIO_AF5_SPI2) || ((__AF__) == GPIO_AF4_I2C1) || \
mbed_official 489:119543c9f674 612 ((__AF__) == GPIO_AF5_I2C2) || ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 613 ((__AF__) == GPIO_AF7_COMP2) || ((__AF__) == GPIO_AF6_LPUART1) || \
mbed_official 489:119543c9f674 614 ((__AF__) == GPIO_AF7_COMP1) || ((__AF__) == GPIO_AF6_I2C1) || \
mbed_official 489:119543c9f674 615 ((__AF__) == GPIO_AF7_I2C3) || ((__AF__) == GPIO_AF6_EVENTOUT) || \
mbed_official 489:119543c9f674 616 ((__AF__) == GPIO_AF7_LPUART1) || ((__AF__) == GPIO_AF6_I2C2) || \
mbed_official 489:119543c9f674 617 ((__AF__) == GPIO_AF6_USART5))
mbed_official 489:119543c9f674 618
mbed_official 489:119543c9f674 619 #define IS_GPIO_AF_AVAILABLE(__INSTANCE__,__AF__) \
mbed_official 489:119543c9f674 620 ((((__INSTANCE__) == GPIOA) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 621 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 622 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 623 ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 624 ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 625 ((__AF__) == GPIO_AF6_EVENTOUT) || \
mbed_official 489:119543c9f674 626 ((__AF__) == GPIO_AF7_COMP1))) || \
mbed_official 489:119543c9f674 627 (((__INSTANCE__) == GPIOB) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 628 ((__AF__) == GPIO_AF1_I2C1) || \
mbed_official 489:119543c9f674 629 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 630 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 631 ((__AF__) == GPIO_AF4_TIM22) || \
mbed_official 489:119543c9f674 632 ((__AF__) == GPIO_AF5_I2C2) || \
mbed_official 489:119543c9f674 633 ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 634 ((__AF__) == GPIO_AF7_LPUART1))) || \
mbed_official 489:119543c9f674 635 (((__INSTANCE__) == GPIOC) && (((__AF__) == GPIO_AF0_TIM22) || \
mbed_official 489:119543c9f674 636 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 637 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 638 ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 639 ((__AF__) == GPIO_AF7_I2C3))) || \
mbed_official 489:119543c9f674 640 (((__INSTANCE__) == GPIOD) && (((__AF__) == GPIO_AF0_TIM21) || \
mbed_official 489:119543c9f674 641 ((__AF__) == GPIO_AF1_TIM21) || \
mbed_official 489:119543c9f674 642 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 643 ((__AF__) == GPIO_AF6_USART5))) || \
mbed_official 489:119543c9f674 644 (((__INSTANCE__) == GPIOE) && (((__AF__) == GPIO_AF0_TIM22) || \
mbed_official 489:119543c9f674 645 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 646 ((__AF__) == GPIO_AF6_USART4))) || \
mbed_official 489:119543c9f674 647 (((__INSTANCE__) == GPIOH) && (((__AF__) == GPIO_AF0_USB))))
mbed_official 489:119543c9f674 648
mbed_official 489:119543c9f674 649
mbed_official 489:119543c9f674 650 #endif /* (STM32L082xx) || (STM32L072xx) */
mbed_official 489:119543c9f674 651
mbed_official 489:119543c9f674 652
mbed_official 489:119543c9f674 653 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 654 /*------------------------- STM32L081xx and STM32L071xx-----------------------*/
mbed_official 489:119543c9f674 655 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 656 #if defined (STM32L081xx) || defined (STM32L071xx)
mbed_official 489:119543c9f674 657
mbed_official 489:119543c9f674 658 /* The table below gives an overview of the different alternate functions per port.
mbed_official 489:119543c9f674 659 * For more details refer yourself to the product data sheet.
mbed_official 489:119543c9f674 660 *
mbed_official 489:119543c9f674 661 */
mbed_official 489:119543c9f674 662
mbed_official 489:119543c9f674 663
mbed_official 489:119543c9f674 664 /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
mbed_official 489:119543c9f674 665 *______________________________________________________________________________
mbed_official 489:119543c9f674 666 * PA0 | | |TIM2_C1 | |USART2 |TIM2_TR |USART4 |COMP1 |
mbed_official 489:119543c9f674 667 * PA1 |EVENTOUT| |TIM2_C2 | |USART2 |TIM21_TR|USART4 | |
mbed_official 489:119543c9f674 668 * PA2 |TIM21_C1| |TIM2_C3 | |USART2 | |LPUART1 |COMP2 |
mbed_official 489:119543c9f674 669 * PA3 |TIM21_C2| |TIM2_C4 | |USART2 | |LPUART1 | |
mbed_official 489:119543c9f674 670 * PA4 |SPI1 | | | |USART2 |TIM22_TR| | |
mbed_official 489:119543c9f674 671 * PA5 |SPI1 | |TIM2_TR | | |TIM2_C1 | | |
mbed_official 489:119543c9f674 672 * PA6 |SPI1 | |TIM3_C1 | |LPUART1 |TIM22_C1|EVENTOUT|COMP1 |
mbed_official 489:119543c9f674 673 * PA7 |SPI1 | |TIM3_C2 | | |TIM22_C2|EVENTOUT|COMP2 |
mbed_official 489:119543c9f674 674 * PA8 |MCO | | |EVENTOUT|USART1 | | |I2C3 |
mbed_official 489:119543c9f674 675 * PA9 |MCO | | | |USART1 | |I2C1 |I2C3 |
mbed_official 489:119543c9f674 676 * PA10| | | | |USART1 | |I2C1 | |
mbed_official 489:119543c9f674 677 * PA11|SPI1 | |EVENTOUT| |USART1 | |I2C2 |COMP1 |
mbed_official 489:119543c9f674 678 * PA12|SPI1 | |EVENTOUT| |USART1 | |I2C2 |COMP2 |
mbed_official 489:119543c9f674 679 * PA13|SWDIO | | | | | |LPUART1 | |
mbed_official 489:119543c9f674 680 * PA14|SWCLK | | | |USART2 | |LPUART1 | |
mbed_official 489:119543c9f674 681 * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 |USART4 | |
mbed_official 489:119543c9f674 682 *______________________________________________________________________________
mbed_official 489:119543c9f674 683 * PB0 |EVENTOUT| |TIM3_C3 | | | | | |
mbed_official 489:119543c9f674 684 * PB1 | | |TIM3_C4 | |LPUART1 | | | |
mbed_official 489:119543c9f674 685 * PB2 | | |LPTIM1_O| | | | |I2C3 |
mbed_official 489:119543c9f674 686 * PB3 |SPI1 | |TIM2_C2 | |EVENTOUT|USART1 |USART5 | |
mbed_official 489:119543c9f674 687 * PB4 |SPI1 | |TIM3_C1 | |TIM22_C1|USART1 |USART5 |I2C3 |
mbed_official 489:119543c9f674 688 * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM3_C2 |USART1 |USART5 | |
mbed_official 489:119543c9f674 689 * | | | | |TIM22_C2| | | |
mbed_official 489:119543c9f674 690 * PB6 |USART1 |I2C1 |LPTIM1_T| | | | | |
mbed_official 489:119543c9f674 691 * PB7 |USART1 |I2C1 |LPTIM1_I| | | |USART4 | |
mbed_official 489:119543c9f674 692 * PB8 | | | | |I2C1 | | | |
mbed_official 489:119543c9f674 693 * PB9 | | |EVENTOUT| |I2C1 |SPI2 | | |
mbed_official 489:119543c9f674 694 * PB10| | |TIM2_C3 | |LPUART1 |SPI2 |I2C2 |LPUART1 |
mbed_official 489:119543c9f674 695 * PB11|EVENTOUT| |TIM2_C4 | |LPUART1 | |I2C2 |LPUART1 |
mbed_official 489:119543c9f674 696 * PB12|SPI2 | |LPUART1 | | |I2C2 |EVENTOUT| |
mbed_official 489:119543c9f674 697 * PB13|SPI2 | |MCO | |LPUART1 |I2C2 |TIM21_C1| |
mbed_official 489:119543c9f674 698 * PB14|SPI2 | |RTC | |LPUART1 |I2C2 |TIM21_C2| |
mbed_official 489:119543c9f674 699 * PB15|SPI2 | |RTC | | | | | |
mbed_official 489:119543c9f674 700 *______________________________________________________________________________
mbed_official 489:119543c9f674 701 * PC0 |LPTIM1_I| |EVENTOUT| | | |LPUART1 |I2C3 |
mbed_official 489:119543c9f674 702 * PC1 |LPTIM1_O| |EVENTOUT| | | |LPUART1 |I2C3 |
mbed_official 489:119543c9f674 703 * PC2 |LPTIM1_I| |SPI2 | | | | | |
mbed_official 489:119543c9f674 704 * PC3 |LPTIM1_T| |SPI2 | | | | | |
mbed_official 489:119543c9f674 705 * PC4 |EVENTOUT| |LPUART1 | | | | | |
mbed_official 489:119543c9f674 706 * PC5 | | |LPUART1 | | | | | |
mbed_official 489:119543c9f674 707 * PC6 |TIM22_C1| |TIM3_C1 | | | | | |
mbed_official 489:119543c9f674 708 * PC7 |TIM22_C2| |TIM3_C2 | | | | | |
mbed_official 489:119543c9f674 709 * PC8 |TIM22_TR| |TIM3_C3 | | | | | |
mbed_official 489:119543c9f674 710 * PC9 |TIM21_TR| | | | | | |I2C3 |
mbed_official 489:119543c9f674 711 * | | |TIM3_C4 | | | | | |
mbed_official 489:119543c9f674 712 * PC10|LPUART1 | | | | | |USART4 | |
mbed_official 489:119543c9f674 713 * PC11|LPUART1 | | | | | |USART4 | |
mbed_official 489:119543c9f674 714 * PC12| | |USART5 | | | |USART4 | |
mbed_official 489:119543c9f674 715 * PC13| | | | | | | | |
mbed_official 489:119543c9f674 716 * PC14| | | | | | | | |
mbed_official 489:119543c9f674 717 * PC15| | | | | | | | |
mbed_official 489:119543c9f674 718 *______________________________________________________________________________
mbed_official 489:119543c9f674 719 * PD0 |TIM21_C1|SPI2 | | | | | | |
mbed_official 489:119543c9f674 720 * PD1 | |SPI2 | | | | | | |
mbed_official 489:119543c9f674 721 * PD2 |LPUART1 | |TIM3_TR | | | |USART5 | |
mbed_official 489:119543c9f674 722 * PD3 |USART2 | |SPI2 | | | | | |
mbed_official 489:119543c9f674 723 * PD4 |USART2 |SPI2 | | | | | | |
mbed_official 489:119543c9f674 724 * PD5 |USART2 | | | | | | | |
mbed_official 489:119543c9f674 725 * PD6 |USART2 | | | | | | | |
mbed_official 489:119543c9f674 726 * PD7 |USART2 |TIM21_C2| | | | | | |
mbed_official 489:119543c9f674 727 * PD8 |LPUART1 | | | | | | | |
mbed_official 489:119543c9f674 728 * PD9 |LPUART1 | | | | | | | |
mbed_official 489:119543c9f674 729 * PD10| | | | | | | | |
mbed_official 489:119543c9f674 730 * PD11|LPUART1 | | | | | | | |
mbed_official 489:119543c9f674 731 * PD12|LPUART1 | | | | | | | |
mbed_official 489:119543c9f674 732 * PD13| | | | | | | | |
mbed_official 489:119543c9f674 733 * PD14| | | | | | | | |
mbed_official 489:119543c9f674 734 * PD15| | | | | | | | |
mbed_official 489:119543c9f674 735 *______________________________________________________________________________
mbed_official 489:119543c9f674 736 * PE0 | | |EVENTOUT| | | | | |
mbed_official 489:119543c9f674 737 * PE1 | | |EVENTOUT| | | | | |
mbed_official 489:119543c9f674 738 * PE2 | | |TIM3_TR | | | | | |
mbed_official 489:119543c9f674 739 * PE3 |TIM22_C1| |TIM3_C1 | | | | | |
mbed_official 489:119543c9f674 740 * PE4 |TIM22_C2| |TIM3_C2 | | | | | |
mbed_official 489:119543c9f674 741 * PE5 |TIM21_C1| |TIM3_C3 | | | | | |
mbed_official 489:119543c9f674 742 * PE6 |TIM21_C2| |TIM3_C4 | | | | | |
mbed_official 489:119543c9f674 743 * PE7 | | | | | | |USART5 | |
mbed_official 489:119543c9f674 744 * PE8 | | | | | | |USART4 | |
mbed_official 489:119543c9f674 745 * PE9 |TIM2_C1 | |TIM2_TR | | | |USART4 | |
mbed_official 489:119543c9f674 746 * PE10|TIM2_C2 | | | | | |USART5 | |
mbed_official 489:119543c9f674 747 * PE11|TIM2_C3 | | | | | |USART5 | |
mbed_official 489:119543c9f674 748 * PE12|TIM2_C4 | |SPI1 | | | | | |
mbed_official 489:119543c9f674 749 * PE13| | |SPI1 | | | | | |
mbed_official 489:119543c9f674 750 * PE14| | |SPI1 | | | | | |
mbed_official 489:119543c9f674 751 * PE15| | |SPI1 | | | | | |
mbed_official 489:119543c9f674 752 *______________________________________________________________________________
mbed_official 489:119543c9f674 753 * PH0 | | | | | | | | |
mbed_official 489:119543c9f674 754 * PH1 | | | | | | | | |
mbed_official 489:119543c9f674 755 * PH9 | | | | | | | | |
mbed_official 489:119543c9f674 756 * PH10| | | | | | | | |
mbed_official 489:119543c9f674 757 *
mbed_official 489:119543c9f674 758 */
mbed_official 489:119543c9f674 759
mbed_official 489:119543c9f674 760 /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
mbed_official 489:119543c9f674 761 * @{
mbed_official 489:119543c9f674 762 */
mbed_official 489:119543c9f674 763
mbed_official 489:119543c9f674 764 /** @defgroup GPIOEx_Alternate_function_AF0 Alternate function AF0
mbed_official 489:119543c9f674 765 * @{
mbed_official 489:119543c9f674 766 */
mbed_official 489:119543c9f674 767 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 768 #define GPIO_AF0_TIM21 ((uint8_t)0x00) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 769 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 770 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 771 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /* SWDIO Alternate Function mapping */
mbed_official 489:119543c9f674 772 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /* SWCLK Alternate Function mapping */
mbed_official 489:119543c9f674 773 #define GPIO_AF0_USART1 ((uint8_t)0x00) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 774 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 775 #define GPIO_AF0_LPTIM1 ((uint8_t)0x00) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 776 #define GPIO_AF0_TIM22 ((uint8_t)0x00) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 777 #define GPIO_AF0_LPUART1 ((uint8_t)0x00) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 778 #define GPIO_AF0_USART2 ((uint8_t)0x00) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 779 #define GPIO_AF0_TIM2 ((uint8_t)0x00) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 780 /**
mbed_official 489:119543c9f674 781 * @}
mbed_official 489:119543c9f674 782 */
mbed_official 489:119543c9f674 783
mbed_official 489:119543c9f674 784 /** @defgroup GPIOEx_Alternate_function_AF1 Alternate function AF1
mbed_official 489:119543c9f674 785 * @{
mbed_official 489:119543c9f674 786 */
mbed_official 489:119543c9f674 787 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 788 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 789 #define GPIO_AF1_TIM21 ((uint8_t)0x01) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 790 /**
mbed_official 489:119543c9f674 791 * @}
mbed_official 489:119543c9f674 792 */
mbed_official 489:119543c9f674 793
mbed_official 489:119543c9f674 794 /** @defgroup GPIOEx_Alternate_function_AF2 Alternate function AF2
mbed_official 489:119543c9f674 795 * @{
mbed_official 489:119543c9f674 796 */
mbed_official 489:119543c9f674 797 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 798 #define GPIO_AF2_TIM3 ((uint8_t)0x02) /* TIM3 Alternate Function mapping */
mbed_official 489:119543c9f674 799 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 800 #define GPIO_AF2_LPTIM1 ((uint8_t)0x02) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 801 #define GPIO_AF2_LPUART1 ((uint8_t)0x02) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 802 #define GPIO_AF2_MCO ((uint8_t)0x02) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 803 #define GPIO_AF2_RTC ((uint8_t)0x02) /* RTC_OUT Alternate Function mapping */
mbed_official 489:119543c9f674 804 #define GPIO_AF2_SPI2 ((uint8_t)0x02) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 805 #define GPIO_AF2_USART5 ((uint8_t)0x02) /* USART5 Alternate Function mapping */
mbed_official 489:119543c9f674 806 #define GPIO_AF2_SPI1 ((uint8_t)0x02) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 807 /**
mbed_official 489:119543c9f674 808 * @}
mbed_official 489:119543c9f674 809 */
mbed_official 489:119543c9f674 810
mbed_official 489:119543c9f674 811 /** @defgroup GPIOEx_Alternate_function_AF3 Alternate function AF3
mbed_official 489:119543c9f674 812 * @{
mbed_official 489:119543c9f674 813 */
mbed_official 489:119543c9f674 814 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 815 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 816 /**
mbed_official 489:119543c9f674 817 * @}
mbed_official 489:119543c9f674 818 */
mbed_official 489:119543c9f674 819
mbed_official 489:119543c9f674 820 /** @defgroup GPIOEx_Alternate_function_AF4 Alternate function AF4
mbed_official 489:119543c9f674 821 * @{
mbed_official 489:119543c9f674 822 */
mbed_official 489:119543c9f674 823 #define GPIO_AF4_USART2 ((uint8_t)0x04) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 824 #define GPIO_AF4_LPUART1 ((uint8_t)0x04) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 825 #define GPIO_AF4_USART1 ((uint8_t)0x04) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 826 #define GPIO_AF4_EVENTOUT ((uint8_t)0x04) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 827 #define GPIO_AF4_TIM22 ((uint8_t)0x04) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 828 #define GPIO_AF4_TIM3 ((uint8_t)0x04) /* TIM3 Alternate Function mapping */
mbed_official 489:119543c9f674 829 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 830 /**
mbed_official 489:119543c9f674 831 * @}
mbed_official 489:119543c9f674 832 */
mbed_official 489:119543c9f674 833
mbed_official 489:119543c9f674 834 /** @defgroup GPIOEx_Alternate_function_AF5 Alternate function AF5
mbed_official 489:119543c9f674 835 * @{
mbed_official 489:119543c9f674 836 */
mbed_official 489:119543c9f674 837 #define GPIO_AF5_TIM2 ((uint8_t)0x05) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 838 #define GPIO_AF5_TIM21 ((uint8_t)0x05) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 839 #define GPIO_AF5_TIM22 ((uint8_t)0x05) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 840 #define GPIO_AF5_USART1 ((uint8_t)0x05) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 841 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 842 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /* I2C2 Alternate Function mapping */
mbed_official 489:119543c9f674 843 /**
mbed_official 489:119543c9f674 844 * @}
mbed_official 489:119543c9f674 845 */
mbed_official 489:119543c9f674 846
mbed_official 489:119543c9f674 847 /** @defgroup GPIOEx_Alternate_function_AF6 Alternate function AF6
mbed_official 489:119543c9f674 848 * @{
mbed_official 489:119543c9f674 849 */
mbed_official 489:119543c9f674 850 #define GPIO_AF6_USART4 ((uint8_t)0x06) /* USART4 Alternate Function mapping */
mbed_official 489:119543c9f674 851 #define GPIO_AF6_LPUART1 ((uint8_t)0x06) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 852 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 853 #define GPIO_AF6_I2C1 ((uint8_t)0x06) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 854 #define GPIO_AF6_I2C2 ((uint8_t)0x06) /* I2C2 Alternate Function mapping */
mbed_official 489:119543c9f674 855 #define GPIO_AF6_USART5 ((uint8_t)0x06) /* USART5 Alternate Function mapping */
mbed_official 489:119543c9f674 856 #define GPIO_AF6_TIM21 ((uint8_t)0x06) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 857 /**
mbed_official 489:119543c9f674 858 * @}
mbed_official 489:119543c9f674 859 */
mbed_official 489:119543c9f674 860
mbed_official 489:119543c9f674 861 /** @defgroup GPIOEx_Alternate_function_AF7 Alternate function AF7
mbed_official 489:119543c9f674 862 * @{
mbed_official 489:119543c9f674 863 */
mbed_official 489:119543c9f674 864 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /* COMP1 Alternate Function mapping */
mbed_official 489:119543c9f674 865 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /* COMP2 Alternate Function mapping */
mbed_official 489:119543c9f674 866 #define GPIO_AF7_I2C3 ((uint8_t)0x07) /* I2C3 Alternate Function mapping */
mbed_official 489:119543c9f674 867 #define GPIO_AF7_LPUART1 ((uint8_t)0x07) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 868 /**
mbed_official 489:119543c9f674 869 * @}
mbed_official 489:119543c9f674 870 */
mbed_official 489:119543c9f674 871
mbed_official 489:119543c9f674 872 /**
mbed_official 489:119543c9f674 873 * @}
mbed_official 489:119543c9f674 874 */
mbed_official 489:119543c9f674 875
mbed_official 489:119543c9f674 876 /**
mbed_official 489:119543c9f674 877 * IS_GPIO_AF macro definition
mbed_official 489:119543c9f674 878 */
mbed_official 489:119543c9f674 879 #define IS_GPIO_AF(__AF__) (((__AF__) == GPIO_AF0_EVENTOUT) || ((__AF__) == GPIO_AF7_LPUART1) || \
mbed_official 489:119543c9f674 880 ((__AF__) == GPIO_AF0_SPI1) || ((__AF__) == GPIO_AF1_I2C1) || \
mbed_official 489:119543c9f674 881 ((__AF__) == GPIO_AF0_TIM21) || ((__AF__) == GPIO_AF1_SPI2) || \
mbed_official 489:119543c9f674 882 ((__AF__) == GPIO_AF0_MCO) || ((__AF__) == GPIO_AF1_TIM21) || \
mbed_official 489:119543c9f674 883 ((__AF__) == GPIO_AF0_SWDIO) || ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 884 ((__AF__) == GPIO_AF0_SWCLK) || ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 885 ((__AF__) == GPIO_AF0_USART1) || ((__AF__) == GPIO_AF6_TIM21) || \
mbed_official 489:119543c9f674 886 ((__AF__) == GPIO_AF0_SPI2) || ((__AF__) == GPIO_AF2_EVENTOUT) || \
mbed_official 489:119543c9f674 887 ((__AF__) == GPIO_AF0_LPTIM1) || ((__AF__) == GPIO_AF2_LPTIM1) || \
mbed_official 489:119543c9f674 888 ((__AF__) == GPIO_AF0_TIM2) || ((__AF__) == GPIO_AF2_LPUART1) || \
mbed_official 489:119543c9f674 889 ((__AF__) == GPIO_AF0_LPUART1) || ((__AF__) == GPIO_AF2_MCO) || \
mbed_official 489:119543c9f674 890 ((__AF__) == GPIO_AF0_USART2) || ((__AF__) == GPIO_AF2_RTC) || \
mbed_official 489:119543c9f674 891 ((__AF__) == GPIO_AF2_SPI2) || ((__AF__) == GPIO_AF6_USART5) || \
mbed_official 489:119543c9f674 892 ((__AF__) == GPIO_AF0_TIM2) || ((__AF__) == GPIO_AF2_USART5) || \
mbed_official 489:119543c9f674 893 ((__AF__) == GPIO_AF2_SPI1) || ((__AF__) == GPIO_AF6_I2C2) || \
mbed_official 489:119543c9f674 894 ((__AF__) == GPIO_AF3_EVENTOUT) || ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 895 ((__AF__) == GPIO_AF3_I2C1) || ((__AF__) == GPIO_AF4_LPUART1) || \
mbed_official 489:119543c9f674 896 ((__AF__) == GPIO_AF5_TIM21) || ((__AF__) == GPIO_AF4_EVENTOUT) || \
mbed_official 489:119543c9f674 897 ((__AF__) == GPIO_AF5_TIM2) || ((__AF__) == GPIO_AF4_USART1) || \
mbed_official 489:119543c9f674 898 ((__AF__) == GPIO_AF5_USART1) || ((__AF__) == GPIO_AF4_TIM22) || \
mbed_official 489:119543c9f674 899 ((__AF__) == GPIO_AF5_TIM22) || ((__AF__) == GPIO_AF4_TIM3) || \
mbed_official 489:119543c9f674 900 ((__AF__) == GPIO_AF5_SPI2) || ((__AF__) == GPIO_AF4_I2C1) || \
mbed_official 489:119543c9f674 901 ((__AF__) == GPIO_AF5_I2C2) || ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 902 ((__AF__) == GPIO_AF7_COMP2) || ((__AF__) == GPIO_AF6_LPUART1) || \
mbed_official 489:119543c9f674 903 ((__AF__) == GPIO_AF7_COMP1) || ((__AF__) == GPIO_AF6_I2C1) || \
mbed_official 489:119543c9f674 904 ((__AF__) == GPIO_AF7_I2C3) || ((__AF__) == GPIO_AF6_EVENTOUT))
mbed_official 489:119543c9f674 905
mbed_official 489:119543c9f674 906
mbed_official 489:119543c9f674 907 #define IS_GPIO_AF_AVAILABLE(__INSTANCE__,__AF__) \
mbed_official 489:119543c9f674 908 ((((__INSTANCE__) == GPIOA) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 909 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 910 ((__AF__) == GPIO_AF3_EVENTOUT) || \
mbed_official 489:119543c9f674 911 ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 912 ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 913 ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 914 ((__AF__) == GPIO_AF7_COMP1))) || \
mbed_official 489:119543c9f674 915 (((__INSTANCE__) == GPIOB) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 916 ((__AF__) == GPIO_AF1_I2C1) || \
mbed_official 489:119543c9f674 917 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 918 ((__AF__) == GPIO_AF3_I2C1) || \
mbed_official 489:119543c9f674 919 ((__AF__) == GPIO_AF4_I2C1) || \
mbed_official 489:119543c9f674 920 ((__AF__) == GPIO_AF5_I2C2) || \
mbed_official 489:119543c9f674 921 ((__AF__) == GPIO_AF6_USART4) || \
mbed_official 489:119543c9f674 922 ((__AF__) == GPIO_AF7_LPUART1))) || \
mbed_official 489:119543c9f674 923 (((__INSTANCE__) == GPIOC) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 924 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 925 ((__AF__) == GPIO_AF6_LPUART1) || \
mbed_official 489:119543c9f674 926 ((__AF__) == GPIO_AF7_I2C3))) || \
mbed_official 489:119543c9f674 927 (((__INSTANCE__) == GPIOD) && (((__AF__) == GPIO_AF0_LPUART1) || \
mbed_official 489:119543c9f674 928 ((__AF__) == GPIO_AF1_SPI2) || \
mbed_official 489:119543c9f674 929 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 930 ((__AF__) == GPIO_AF6_USART5))) || \
mbed_official 489:119543c9f674 931 (((__INSTANCE__) == GPIOE) && (((__AF__) == GPIO_AF0_TIM22) || \
mbed_official 489:119543c9f674 932 ((__AF__) == GPIO_AF2_TIM3) || \
mbed_official 489:119543c9f674 933 ((__AF__) == GPIO_AF6_USART4))))
mbed_official 489:119543c9f674 934
mbed_official 489:119543c9f674 935
mbed_official 489:119543c9f674 936 #endif /* (STM32L081xx) || (STM32L071xx) */
mbed_official 489:119543c9f674 937
mbed_official 489:119543c9f674 938 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 939 /*------------------------- STM32L053xx/STM32L063xx---------------------------*/
mbed_official 489:119543c9f674 940 /*----------------------------------------------------------------------------*/
mbed_official 376:cb4d9db17537 941 #if defined (STM32L053xx) || defined (STM32L063xx)
mbed_official 489:119543c9f674 942
mbed_official 489:119543c9f674 943 /* The table below gives an overview of the different alternate functions per port.
mbed_official 489:119543c9f674 944 * For more details refer yourself to the product data sheet.
mbed_official 489:119543c9f674 945 *
mbed_official 489:119543c9f674 946 */
mbed_official 489:119543c9f674 947 /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
mbed_official 489:119543c9f674 948 *______________________________________________________________________________
mbed_official 489:119543c9f674 949 * PA0 | | |TIM2_C1 |TSC |USART2 |TIM2_TR | |COMP1 |
mbed_official 489:119543c9f674 950 * PA1 |EVENTOUT|LCD |TIM2_C2 |TSC |USART2 |TIM21_TR| | |
mbed_official 489:119543c9f674 951 * PA2 |TIM21_C1|LCD |TIM2_C3 |TSC |USART2 | | |COMP2 |
mbed_official 489:119543c9f674 952 * PA3 |TIM21_C2|LCD |TIM2_C4 |TSC |USART2 | | | |
mbed_official 489:119543c9f674 953 * PA4 |SPI1 | | |TSC |USART2 |TIM22_TR| | |
mbed_official 489:119543c9f674 954 * PA5 |SPI1 | |TIM2_TR |TSC | |TIM2_C1 | | |
mbed_official 489:119543c9f674 955 * PA6 |SPI1 |LCD | |TSC |LPUART |TIM22_C1|EVENTOUT|COMP1 |
mbed_official 489:119543c9f674 956 * PA7 |SPI1 |LCD | |TSC | |TIM22_C2|EVENTOUT|COMP2 |
mbed_official 489:119543c9f674 957 * PA8 |MCO |LCD |USB |EVENTOUT|USART1 | | | |
mbed_official 489:119543c9f674 958 * PA9 |MCO |LCD | |TSC |USART1 | | | |
mbed_official 489:119543c9f674 959 * PA10| |LCD | |TSC |USART1 | | | |
mbed_official 489:119543c9f674 960 * PA11|SPI1 | |EVENTOUT|TSC |USART1 | | |COMP1 |
mbed_official 489:119543c9f674 961 * PA12|SPI1 | |EVENTOUT|TSC |USART1 | | |COMP2 |
mbed_official 489:119543c9f674 962 * PA13|SWDIO | |USB | | | | | |
mbed_official 489:119543c9f674 963 * PA14|SWCLK | | | |USART2 | | | |
mbed_official 489:119543c9f674 964 * PA15|SPI1 |LCD |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 | | |
mbed_official 489:119543c9f674 965 *______________________________________________________________________________
mbed_official 489:119543c9f674 966 * PB0 |EVENTOUT|LCD | |TSC | | | | |
mbed_official 489:119543c9f674 967 * PB1 | |LCD | |TSC |LPUART1 | | | |
mbed_official 489:119543c9f674 968 * PB2 | | |LPTIM1_O|TSC | | | | |
mbed_official 489:119543c9f674 969 * PB3 |SPI1 |LCD |TIM2_C2 |TSC |EVENTOUT| | | |
mbed_official 489:119543c9f674 970 * PB4 |SPI1 |LCD |EVENTOUT|TSC |TIM22_C1| | | |
mbed_official 489:119543c9f674 971 * PB5 |SPI1 |LCD |LPTIM1_I|I2C1 |TIM22_C2| | | |
mbed_official 489:119543c9f674 972 * PB6 |USART1 |I2C1 |LPTIM1_T|TSC | | | | |
mbed_official 489:119543c9f674 973 * PB7 |USART1 |I2C1 |LPTIM1_I|TSC | | | | |
mbed_official 489:119543c9f674 974 * PB8 | |LCD | |TSC |I2C1 | | | |
mbed_official 489:119543c9f674 975 * PB9 | |LCD |EVENTOUT| |I2C1 |SPI2 | | |
mbed_official 489:119543c9f674 976 * PB10| |LCD |TIM2_C3 |TSC |LPUART1 |SPI2 |I2C2 | |
mbed_official 489:119543c9f674 977 * PB11|EVENTOUT|LCD |TIM2_C4 |TSC |LPUART1 | |I2C2 | |
mbed_official 489:119543c9f674 978 * PB12|SPI2 |LCD |LPUART1 |TSC | |I2C2 |EVENTOUT| |
mbed_official 489:119543c9f674 979 * PB13|SPI2 |LCD | |TSC |LPUART1 |I2C2 |TIM21_C1| |
mbed_official 489:119543c9f674 980 * PB14|SPI2 |LCD |RTC |TSC |LPUART1 |I2C2 |TIM21_C2| |
mbed_official 489:119543c9f674 981 * PB15|SPI2 |LCD |RTC | | | | | |
mbed_official 489:119543c9f674 982 *______________________________________________________________________________
mbed_official 489:119543c9f674 983 * PC0 |LPTIM1_I|LCD |EVENTOUT|TSC | | | | |
mbed_official 489:119543c9f674 984 * PC1 |LPTIM1_O|LCD |EVENTOUT|TSC | | | | |
mbed_official 489:119543c9f674 985 * PC2 |LPTIM1_I|LCD |SPI2 |TSC | | | | |
mbed_official 489:119543c9f674 986 * PC3 |LPTIM1_T|LCD |SPI2 |TSC | | | | |
mbed_official 489:119543c9f674 987 * PC4 |EVENTOUT|LCD |LPUART | | | | | |
mbed_official 489:119543c9f674 988 * PC5 | |LCD |LPUART |TSC | | | | |
mbed_official 489:119543c9f674 989 * PC6 |TIM22_C1|LCD | |TSC | | | | |
mbed_official 489:119543c9f674 990 * PC7 |TIM22_C2|LCD | |TSC | | | | |
mbed_official 489:119543c9f674 991 * PC8 |TIM22_TR|LCD | |TSC | | | | |
mbed_official 489:119543c9f674 992 * PC9 |TIM21_TR|LCD |USB |TSC | | | | |
mbed_official 489:119543c9f674 993 * PC10|LPUART |LCD | | | | | | |
mbed_official 489:119543c9f674 994 * PC11|LPUART |LCD | | | | | | |
mbed_official 489:119543c9f674 995 * PC12| |LCD | | | | | | |
mbed_official 489:119543c9f674 996 * PC13| | | | | | | | |
mbed_official 489:119543c9f674 997 * PC14| | | | | | | | |
mbed_official 489:119543c9f674 998 * PC15| | | | | | | | |
mbed_official 489:119543c9f674 999 *______________________________________________________________________________
mbed_official 489:119543c9f674 1000 * PD2 |LPUART |LCD | | | | | | |
mbed_official 489:119543c9f674 1001 *______________________________________________________________________________
mbed_official 489:119543c9f674 1002 * PH0 |USB | | | | | | | |
mbed_official 489:119543c9f674 1003 * PH1 | | | | | | | | |
mbed_official 489:119543c9f674 1004 * *
mbed_official 489:119543c9f674 1005 */
mbed_official 489:119543c9f674 1006
mbed_official 489:119543c9f674 1007 /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
mbed_official 489:119543c9f674 1008 * @{
mbed_official 489:119543c9f674 1009 */
mbed_official 489:119543c9f674 1010
mbed_official 489:119543c9f674 1011 /** @defgroup GPIOEx_Alternate_function_AF0 Alternate function AF0
mbed_official 489:119543c9f674 1012 * @{
mbed_official 489:119543c9f674 1013 */
mbed_official 376:cb4d9db17537 1014 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /* SPI1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1015 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /* SPI2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1016 #define GPIO_AF0_USART1 ((uint8_t)0x00) /* USART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1017 #define GPIO_AF0_USART2 ((uint8_t)0x00) /* USART2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1018 #define GPIO_AF0_LPUART1 ((uint8_t)0x00) /* LPUART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1019 #define GPIO_AF0_USB ((uint8_t)0x00) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 1020 #define GPIO_AF0_LPTIM1 ((uint8_t)0x00) /* LPTIM1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1021 #define GPIO_AF0_TSC ((uint8_t)0x00) /* TSC Alternate Function mapping */
mbed_official 376:cb4d9db17537 1022 #define GPIO_AF0_TIM2 ((uint8_t)0x00) /* TIM2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1023 #define GPIO_AF0_TIM21 ((uint8_t)0x00) /* TIM21 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1024 #define GPIO_AF0_TIM22 ((uint8_t)0x00) /* TIM22 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1025 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /* EVENTOUT Alternate Function mapping */
mbed_official 376:cb4d9db17537 1026 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO Alternate Function mapping */
mbed_official 376:cb4d9db17537 1027 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /* SWDIO Alternate Function mapping */
mbed_official 376:cb4d9db17537 1028 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /* SWCLK Alternate Function mapping */
mbed_official 489:119543c9f674 1029 /**
mbed_official 489:119543c9f674 1030 * @}
mbed_official 489:119543c9f674 1031 */
mbed_official 376:cb4d9db17537 1032
mbed_official 489:119543c9f674 1033 /** @defgroup GPIOEx_Alternate_function_AF1 Alternate function AF1
mbed_official 489:119543c9f674 1034 * @{
mbed_official 489:119543c9f674 1035 */
mbed_official 376:cb4d9db17537 1036 #define GPIO_AF1_SPI1 ((uint8_t)0x01) /* SPI1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1037 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /* SPI2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1038 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /* I2C1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1039 #define GPIO_AF1_LCD ((uint8_t)0x01) /* LCD Alternate Function mapping */
mbed_official 489:119543c9f674 1040 /**
mbed_official 489:119543c9f674 1041 * @}
mbed_official 489:119543c9f674 1042 */
mbed_official 489:119543c9f674 1043
mbed_official 489:119543c9f674 1044 /** @defgroup GPIOEx_Alternate_function_AF2 Alternate function AF2
mbed_official 489:119543c9f674 1045 * @{
mbed_official 489:119543c9f674 1046 */
mbed_official 376:cb4d9db17537 1047 #define GPIO_AF2_SPI2 ((uint8_t)0x02) /* SPI2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1048 #define GPIO_AF2_LPUART1 ((uint8_t)0x02) /* LPUART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1049 #define GPIO_AF2_USB ((uint8_t)0x02) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 1050 #define GPIO_AF2_LPTIM1 ((uint8_t)0x02) /* LPTIM1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1051 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1052 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1053 #define GPIO_AF2_RTC ((uint8_t)0x02) /* RTC_OUT Alternate Function mapping */
mbed_official 489:119543c9f674 1054 /**
mbed_official 489:119543c9f674 1055 * @}
mbed_official 489:119543c9f674 1056 */
mbed_official 376:cb4d9db17537 1057
mbed_official 489:119543c9f674 1058 /** @defgroup GPIOEx_Alternate_function_AF3 Alternate function AF3
mbed_official 489:119543c9f674 1059 * @{
mbed_official 489:119543c9f674 1060 */
mbed_official 376:cb4d9db17537 1061 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /* I2C1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1062 #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */
mbed_official 376:cb4d9db17537 1063 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1064 /**
mbed_official 489:119543c9f674 1065 * @}
mbed_official 489:119543c9f674 1066 */
mbed_official 376:cb4d9db17537 1067
mbed_official 489:119543c9f674 1068 /** @defgroup GPIOEx_Alternate_function_AF4 Alternate function AF4
mbed_official 489:119543c9f674 1069 * @{
mbed_official 489:119543c9f674 1070 */
mbed_official 376:cb4d9db17537 1071 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1072 #define GPIO_AF4_USART1 ((uint8_t)0x04) /* USART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1073 #define GPIO_AF4_USART2 ((uint8_t)0x04) /* USART2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1074 #define GPIO_AF4_LPUART1 ((uint8_t)0x04) /* LPUART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1075 #define GPIO_AF4_TIM22 ((uint8_t)0x04) /* TIM22 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1076 #define GPIO_AF4_EVENTOUT ((uint8_t)0x04) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1077 /**
mbed_official 489:119543c9f674 1078 * @}
mbed_official 489:119543c9f674 1079 */
mbed_official 376:cb4d9db17537 1080
mbed_official 489:119543c9f674 1081 /** @defgroup GPIOEx_Alternate_function_AF5 Alternate function AF5
mbed_official 489:119543c9f674 1082 * @{
mbed_official 489:119543c9f674 1083 */
mbed_official 376:cb4d9db17537 1084 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1085 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /* I2C2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1086 #define GPIO_AF5_TIM2 ((uint8_t)0x05) /* TIM2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1087 #define GPIO_AF5_TIM21 ((uint8_t)0x05) /* TIM21 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1088 #define GPIO_AF5_TIM22 ((uint8_t)0x05) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 1089 /**
mbed_official 489:119543c9f674 1090 * @}
mbed_official 489:119543c9f674 1091 */
mbed_official 376:cb4d9db17537 1092
mbed_official 489:119543c9f674 1093 /** @defgroup GPIOEx_Alternate_function_AF6 Alternate function AF6
mbed_official 489:119543c9f674 1094 * @{
mbed_official 489:119543c9f674 1095 */
mbed_official 376:cb4d9db17537 1096 #define GPIO_AF6_I2C2 ((uint8_t)0x06) /* I2C2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1097 #define GPIO_AF6_TIM21 ((uint8_t)0x06) /* TIM21 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1098 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1099 /**
mbed_official 489:119543c9f674 1100 * @}
mbed_official 489:119543c9f674 1101 */
mbed_official 376:cb4d9db17537 1102
mbed_official 489:119543c9f674 1103 /** @defgroup GPIOEx_Alternate_function_AF7 Alternate function AF7
mbed_official 489:119543c9f674 1104 * @{
mbed_official 489:119543c9f674 1105 */
mbed_official 376:cb4d9db17537 1106 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /* COMP1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1107 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /* COMP2 Alternate Function mapping */
mbed_official 489:119543c9f674 1108 /**
mbed_official 489:119543c9f674 1109 * @}
mbed_official 489:119543c9f674 1110 */
mbed_official 489:119543c9f674 1111
mbed_official 489:119543c9f674 1112 /**
mbed_official 489:119543c9f674 1113 * @}
mbed_official 489:119543c9f674 1114 */
mbed_official 489:119543c9f674 1115
mbed_official 376:cb4d9db17537 1116
mbed_official 376:cb4d9db17537 1117
mbed_official 489:119543c9f674 1118 #define IS_GPIO_AF(__AF__) (((__AF__) == GPIO_AF0_SPI1) || ((__AF__) == GPIO_AF2_SPI2) || \
mbed_official 489:119543c9f674 1119 ((__AF__) == GPIO_AF0_SPI2) || ((__AF__) == GPIO_AF2_LPUART1) || \
mbed_official 489:119543c9f674 1120 ((__AF__) == GPIO_AF0_USART1) || ((__AF__) == GPIO_AF2_USB) || \
mbed_official 489:119543c9f674 1121 ((__AF__) == GPIO_AF0_USART2) || ((__AF__) == GPIO_AF2_LPTIM1) || \
mbed_official 489:119543c9f674 1122 ((__AF__) == GPIO_AF0_LPUART1) || ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1123 ((__AF__) == GPIO_AF0_USB) || ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 1124 ((__AF__) == GPIO_AF0_LPTIM1) || ((__AF__) == GPIO_AF2_EVENTOUT) || \
mbed_official 489:119543c9f674 1125 ((__AF__) == GPIO_AF0_TSC) || ((__AF__) == GPIO_AF2_RTC) || \
mbed_official 489:119543c9f674 1126 ((__AF__) == GPIO_AF3_I2C1) || ((__AF__) == GPIO_AF7_COMP2) || \
mbed_official 489:119543c9f674 1127 ((__AF__) == GPIO_AF0_TIM22) || ((__AF__) == GPIO_AF3_EVENTOUT) || \
mbed_official 489:119543c9f674 1128 ((__AF__) == GPIO_AF0_EVENTOUT) || ((__AF__) == GPIO_AF4_I2C1) || \
mbed_official 489:119543c9f674 1129 ((__AF__) == GPIO_AF0_MCO) || ((__AF__) == GPIO_AF4_USART1) || \
mbed_official 489:119543c9f674 1130 ((__AF__) == GPIO_AF0_SWDIO) || ((__AF__) == GPIO_AF0_SWCLK) || \
mbed_official 489:119543c9f674 1131 ((__AF__) == GPIO_AF1_SPI1) || ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 1132 ((__AF__) == GPIO_AF1_SPI2) || ((__AF__) == GPIO_AF4_LPUART1) || \
mbed_official 489:119543c9f674 1133 ((__AF__) == GPIO_AF7_COMP2) || ((__AF__) == GPIO_AF4_TIM22) || \
mbed_official 489:119543c9f674 1134 ((__AF__) == GPIO_AF1_I2C1) || ((__AF__) == GPIO_AF4_EVENTOUT) || \
mbed_official 489:119543c9f674 1135 ((__AF__) == GPIO_AF1_LCD) || ((__AF__) == GPIO_AF5_SPI2) || \
mbed_official 489:119543c9f674 1136 ((__AF__) == GPIO_AF5_I2C2) || ((__AF__) == GPIO_AF5_TIM2) || \
mbed_official 489:119543c9f674 1137 ((__AF__) == GPIO_AF5_TIM21) || ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 1138 ((__AF__) == GPIO_AF6_I2C2) || ((__AF__) == GPIO_AF6_TIM21) || \
mbed_official 489:119543c9f674 1139 ((__AF__) == GPIO_AF6_EVENTOUT) || ((__AF__) == GPIO_AF7_COMP1))
mbed_official 489:119543c9f674 1140
mbed_official 489:119543c9f674 1141
mbed_official 489:119543c9f674 1142
mbed_official 489:119543c9f674 1143 #define IS_GPIO_AF_AVAILABLE(__INSTANCE__,__AF__) \
mbed_official 489:119543c9f674 1144 ((((__INSTANCE__) == GPIOA) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1145 ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 1146 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1147 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 1148 ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 1149 ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 1150 ((__AF__) == GPIO_AF6_EVENTOUT) || \
mbed_official 489:119543c9f674 1151 ((__AF__) == GPIO_AF7_COMP1))) || \
mbed_official 489:119543c9f674 1152 (((__INSTANCE__) == GPIOB) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1153 ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 1154 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1155 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 1156 ((__AF__) == GPIO_AF4_EVENTOUT) || \
mbed_official 489:119543c9f674 1157 ((__AF__) == GPIO_AF5_I2C2) || \
mbed_official 489:119543c9f674 1158 ((__AF__) == GPIO_AF6_TIM21))) || \
mbed_official 489:119543c9f674 1159 (((__INSTANCE__) == GPIOC) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1160 ((__AF__) == GPIO_AF1_LCD) || \
mbed_official 489:119543c9f674 1161 ((__AF__) == GPIO_AF2_EVENTOUT) || \
mbed_official 489:119543c9f674 1162 ((__AF__) == GPIO_AF3_TSC))) || \
mbed_official 489:119543c9f674 1163 (((__INSTANCE__) == GPIOD) && (((__AF__) == GPIO_AF0_LPUART1) || \
mbed_official 489:119543c9f674 1164 ((__AF__) == GPIO_AF1_LCD))) || \
mbed_official 489:119543c9f674 1165 (((__INSTANCE__) == GPIOH) && (((__AF__) == GPIO_AF0_USB))))
mbed_official 489:119543c9f674 1166
mbed_official 376:cb4d9db17537 1167
mbed_official 376:cb4d9db17537 1168 #endif /* STM32L053xx || STM32L063xx */
mbed_official 376:cb4d9db17537 1169 /*------------------------------------------------------------------------------------------*/
mbed_official 376:cb4d9db17537 1170
mbed_official 489:119543c9f674 1171 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 1172 /*------------------------- STM32L052xx/STM32L062xx---------------------------*/
mbed_official 489:119543c9f674 1173 /*----------------------------------------------------------------------------*/
mbed_official 376:cb4d9db17537 1174 #if defined (STM32L052xx) || defined (STM32L062xx)
mbed_official 376:cb4d9db17537 1175
mbed_official 489:119543c9f674 1176 /* The table below gives an overview of the different alternate functions per port.
mbed_official 489:119543c9f674 1177 * For more details refer yourself to the product data sheet.
mbed_official 489:119543c9f674 1178 *
mbed_official 489:119543c9f674 1179 */
mbed_official 489:119543c9f674 1180 /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
mbed_official 489:119543c9f674 1181 *______________________________________________________________________________
mbed_official 489:119543c9f674 1182 * PA0 | | |TIM2_C1 |TSC |USART2 |TIM2_TR | |COMP1 |
mbed_official 489:119543c9f674 1183 * PA1 |EVENTOUT| |TIM2_C2 |TSC |USART2 |TIM21_TR| | |
mbed_official 489:119543c9f674 1184 * PA2 |TIM21_C1| |TIM2_C3 |TSC |USART2 | | |COMP2 |
mbed_official 489:119543c9f674 1185 * PA3 |TIM21_C2| |TIM2_C4 |TSC |USART2 | | | |
mbed_official 489:119543c9f674 1186 * PA4 |SPI1 | | |TSC |USART2 |TIM22_TR| | |
mbed_official 489:119543c9f674 1187 * PA5 |SPI1 | |TIM2_TR |TSC | |TIM2_C1 | | |
mbed_official 489:119543c9f674 1188 * PA6 |SPI1 | | |TSC |LPUART |TIM22_C1|EVENTOUT|COMP1 |
mbed_official 489:119543c9f674 1189 * PA7 |SPI1 | | |TSC | |TIM22_C2|EVENTOUT|COMP2 |
mbed_official 489:119543c9f674 1190 * PA8 |MCO | |USB |EVENTOUT|USART1 | | | |
mbed_official 489:119543c9f674 1191 * PA9 |MCO | | |TSC |USART1 | | | |
mbed_official 489:119543c9f674 1192 * PA10| | | |TSC |USART1 | | | |
mbed_official 489:119543c9f674 1193 * PA11|SPI1 | |EVENTOUT|TSC |USART1 | | |COMP1 |
mbed_official 489:119543c9f674 1194 * PA12|SPI1 | |EVENTOUT|TSC |USART1 | | |COMP2 |
mbed_official 489:119543c9f674 1195 * PA13|SWDIO | |USB | | | | | |
mbed_official 489:119543c9f674 1196 * PA14|SWCLK | | | |USART2 | | | |
mbed_official 489:119543c9f674 1197 * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 | | |
mbed_official 489:119543c9f674 1198 *______________________________________________________________________________
mbed_official 489:119543c9f674 1199 * PB0 |EVENTOUT| | |TSC | | | | |
mbed_official 489:119543c9f674 1200 * PB1 | | | |TSC |LPUART1 | | | |
mbed_official 489:119543c9f674 1201 * PB2 | | |LPTIM1_O|TSC | | | | |
mbed_official 489:119543c9f674 1202 * PB3 |SPI1 | |TIM2_C2 |TSC |EVENTOUT| | | |
mbed_official 489:119543c9f674 1203 * PB4 |SPI1 | |EVENTOUT|TSC |TIM22_C1| | | |
mbed_official 489:119543c9f674 1204 * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM22_C2| | | |
mbed_official 489:119543c9f674 1205 * PB6 |USART1 |I2C1 |LPTIM1_T|TSC | | | | |
mbed_official 489:119543c9f674 1206 * PB7 |USART1 |I2C1 |LPTIM1_I|TSC | | | | |
mbed_official 489:119543c9f674 1207 * PB8 | | | |TSC |I2C1 | | | |
mbed_official 489:119543c9f674 1208 * PB9 | | |EVENTOUT| |I2C1 |SPI2 | | |
mbed_official 489:119543c9f674 1209 * PB10| | |TIM2_C3 |TSC |LPUART1 |SPI2 |I2C2 | |
mbed_official 489:119543c9f674 1210 * PB11|EVENTOUT| |TIM2_C4 |TSC |LPUART1 | |I2C2 | |
mbed_official 489:119543c9f674 1211 * PB12|SPI2 | |LPUART1 |TSC | |I2C2 |EVENTOUT| |
mbed_official 489:119543c9f674 1212 * PB13|SPI2 | | |TSC |LPUART1 |I2C2 |TIM21_C1| |
mbed_official 489:119543c9f674 1213 * PB14|SPI2 | |RTC |TSC |LPUART1 |I2C2 |TIM21_C2| |
mbed_official 489:119543c9f674 1214 * PB15|SPI2 | |RTC | | | | | |
mbed_official 489:119543c9f674 1215 *______________________________________________________________________________
mbed_official 489:119543c9f674 1216 * PC0 |LPTIM1_I| |EVENTOUT|TSC | | | | |
mbed_official 489:119543c9f674 1217 * PC1 |LPTIM1_O| |EVENTOUT|TSC | | | | |
mbed_official 489:119543c9f674 1218 * PC2 |LPTIM1_I| |SPI2 |TSC | | | | |
mbed_official 489:119543c9f674 1219 * PC3 |LPTIM1_T| |SPI2 |TSC | | | | |
mbed_official 489:119543c9f674 1220 * PC4 |EVENTOUT| |LPUART | | | | | |
mbed_official 489:119543c9f674 1221 * PC5 | | |LPUART |TSC | | | | |
mbed_official 489:119543c9f674 1222 * PC6 |TIM22_C1| | |TSC | | | | |
mbed_official 489:119543c9f674 1223 * PC7 |TIM22_C2| | |TSC | | | | |
mbed_official 489:119543c9f674 1224 * PC8 |TIM22_TR| | |TSC | | | | |
mbed_official 489:119543c9f674 1225 * PC9 |TIM21_TR| |USB |TSC | | | | |
mbed_official 489:119543c9f674 1226 * PC10|LPUART | | | | | | | |
mbed_official 489:119543c9f674 1227 * PC11|LPUART | | | | | | | |
mbed_official 489:119543c9f674 1228 * PC12| | | | | | | | |
mbed_official 489:119543c9f674 1229 * PC13| | | | | | | | |
mbed_official 489:119543c9f674 1230 * PC14| | | | | | | | |
mbed_official 489:119543c9f674 1231 * PC15| | | | | | | | |
mbed_official 489:119543c9f674 1232 *______________________________________________________________________________
mbed_official 489:119543c9f674 1233 * PD2 |LPUART | | | | | | | |
mbed_official 489:119543c9f674 1234 *______________________________________________________________________________
mbed_official 489:119543c9f674 1235 * PH0 |USB | | | | | | | |
mbed_official 489:119543c9f674 1236 * PH1 | | | | | | | | |
mbed_official 489:119543c9f674 1237 * *
mbed_official 489:119543c9f674 1238 */
mbed_official 376:cb4d9db17537 1239
mbed_official 489:119543c9f674 1240 /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
mbed_official 489:119543c9f674 1241 * @{
mbed_official 489:119543c9f674 1242 */
mbed_official 489:119543c9f674 1243
mbed_official 489:119543c9f674 1244 /** @defgroup GPIOEx_Alternate_function_AF0 Alternate function AF0
mbed_official 489:119543c9f674 1245 * @{
mbed_official 489:119543c9f674 1246 */
mbed_official 489:119543c9f674 1247 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 1248 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 1249 #define GPIO_AF0_USART1 ((uint8_t)0x00) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 1250 #define GPIO_AF0_USART2 ((uint8_t)0x00) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 1251 #define GPIO_AF0_LPUART1 ((uint8_t)0x00) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 1252 #define GPIO_AF0_USB ((uint8_t)0x00) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 1253 #define GPIO_AF0_LPTIM1 ((uint8_t)0x00) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 1254 #define GPIO_AF0_TSC ((uint8_t)0x00) /* TSC Alternate Function mapping */
mbed_official 489:119543c9f674 1255 #define GPIO_AF0_TIM2 ((uint8_t)0x00) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 1256 #define GPIO_AF0_TIM21 ((uint8_t)0x00) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 1257 #define GPIO_AF0_TIM22 ((uint8_t)0x00) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 1258 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1259 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 1260 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /* SWDIO Alternate Function mapping */
mbed_official 489:119543c9f674 1261 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /* SWCLK Alternate Function mapping */
mbed_official 489:119543c9f674 1262 /**
mbed_official 489:119543c9f674 1263 * @}
mbed_official 489:119543c9f674 1264 */
mbed_official 489:119543c9f674 1265
mbed_official 489:119543c9f674 1266 /** @defgroup GPIOEx_Alternate_function_AF1 Alternate function AF1
mbed_official 489:119543c9f674 1267 * @{
mbed_official 489:119543c9f674 1268 */
mbed_official 489:119543c9f674 1269 #define GPIO_AF1_SPI1 ((uint8_t)0x01) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 1270 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 1271 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 1272 /**
mbed_official 489:119543c9f674 1273 * @}
mbed_official 489:119543c9f674 1274 */
mbed_official 489:119543c9f674 1275
mbed_official 489:119543c9f674 1276 /** @defgroup GPIOEx_Alternate_function_AF2 Alternate function AF2
mbed_official 489:119543c9f674 1277 * @{
mbed_official 489:119543c9f674 1278 */
mbed_official 489:119543c9f674 1279 #define GPIO_AF2_SPI2 ((uint8_t)0x02) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 1280 #define GPIO_AF2_LPUART1 ((uint8_t)0x02) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 1281 #define GPIO_AF2_USB ((uint8_t)0x02) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 1282 #define GPIO_AF2_LPTIM1 ((uint8_t)0x02) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 1283 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 1284 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1285 #define GPIO_AF2_RTC ((uint8_t)0x02) /* RTC_OUT Alternate Function mapping */
mbed_official 489:119543c9f674 1286 /**
mbed_official 489:119543c9f674 1287 * @}
mbed_official 489:119543c9f674 1288 */
mbed_official 489:119543c9f674 1289
mbed_official 489:119543c9f674 1290 /** @defgroup GPIOEx_Alternate_function_AF3 Alternate function AF3
mbed_official 489:119543c9f674 1291 * @{
mbed_official 489:119543c9f674 1292 */
mbed_official 376:cb4d9db17537 1293 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /* I2C1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1294 #define GPIO_AF3_TSC ((uint8_t)0x03) /* TSC Alternate Function mapping */
mbed_official 376:cb4d9db17537 1295 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1296 /**
mbed_official 489:119543c9f674 1297 * @}
mbed_official 489:119543c9f674 1298 */
mbed_official 376:cb4d9db17537 1299
mbed_official 489:119543c9f674 1300 /** @defgroup GPIOEx_Alternate_function_AF4 Alternate function AF4
mbed_official 489:119543c9f674 1301 * @{
mbed_official 489:119543c9f674 1302 */
mbed_official 376:cb4d9db17537 1303 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1304 #define GPIO_AF4_USART1 ((uint8_t)0x04) /* USART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1305 #define GPIO_AF4_USART2 ((uint8_t)0x04) /* USART2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1306 #define GPIO_AF4_LPUART1 ((uint8_t)0x04) /* LPUART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1307 #define GPIO_AF4_TIM22 ((uint8_t)0x04) /* TIM22 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1308 #define GPIO_AF4_EVENTOUT ((uint8_t)0x04) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1309 /**
mbed_official 489:119543c9f674 1310 * @}
mbed_official 489:119543c9f674 1311 */
mbed_official 376:cb4d9db17537 1312
mbed_official 489:119543c9f674 1313 /** @defgroup GPIOEx_Alternate_function_AF5 Alternate function AF5
mbed_official 489:119543c9f674 1314 * @{
mbed_official 489:119543c9f674 1315 */
mbed_official 376:cb4d9db17537 1316 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1317 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /* I2C2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1318 #define GPIO_AF5_TIM2 ((uint8_t)0x05) /* TIM2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1319 #define GPIO_AF5_TIM21 ((uint8_t)0x05) /* TIM21 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1320 #define GPIO_AF5_TIM22 ((uint8_t)0x05) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 1321 /**
mbed_official 489:119543c9f674 1322 * @}
mbed_official 489:119543c9f674 1323 */
mbed_official 376:cb4d9db17537 1324
mbed_official 489:119543c9f674 1325 /** @defgroup GPIOEx_Alternate_function_AF6 Alternate function AF6
mbed_official 489:119543c9f674 1326 * @{
mbed_official 489:119543c9f674 1327 */
mbed_official 376:cb4d9db17537 1328 #define GPIO_AF6_I2C2 ((uint8_t)0x06) /* I2C2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1329 #define GPIO_AF6_TIM21 ((uint8_t)0x06) /* TIM21 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1330 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1331 /**
mbed_official 489:119543c9f674 1332 * @}
mbed_official 489:119543c9f674 1333 */
mbed_official 376:cb4d9db17537 1334
mbed_official 489:119543c9f674 1335 /** @defgroup GPIOEx_Alternate_function_AF7 Alternate function AF7
mbed_official 489:119543c9f674 1336 * @{
mbed_official 489:119543c9f674 1337 */
mbed_official 376:cb4d9db17537 1338 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /* COMP1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1339 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /* COMP2 Alternate Function mapping */
mbed_official 489:119543c9f674 1340 /**
mbed_official 489:119543c9f674 1341 * @}
mbed_official 489:119543c9f674 1342 */
mbed_official 489:119543c9f674 1343
mbed_official 489:119543c9f674 1344 /**
mbed_official 489:119543c9f674 1345 * @}
mbed_official 489:119543c9f674 1346 */
mbed_official 376:cb4d9db17537 1347
mbed_official 376:cb4d9db17537 1348
mbed_official 489:119543c9f674 1349 #define IS_GPIO_AF(__AF__) (((__AF__) == GPIO_AF0_SPI1) || ((__AF__) == GPIO_AF2_SPI2) || \
mbed_official 489:119543c9f674 1350 ((__AF__) == GPIO_AF0_SPI2) || ((__AF__) == GPIO_AF2_LPUART1) || \
mbed_official 489:119543c9f674 1351 ((__AF__) == GPIO_AF0_USART1) || ((__AF__) == GPIO_AF2_USB) || \
mbed_official 489:119543c9f674 1352 ((__AF__) == GPIO_AF0_USART2) || ((__AF__) == GPIO_AF2_LPTIM1) || \
mbed_official 489:119543c9f674 1353 ((__AF__) == GPIO_AF0_LPUART1) || ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1354 ((__AF__) == GPIO_AF0_USB) || ((__AF__) == GPIO_AF4_TIM22) || \
mbed_official 489:119543c9f674 1355 ((__AF__) == GPIO_AF0_LPTIM1) || ((__AF__) == GPIO_AF2_EVENTOUT) || \
mbed_official 489:119543c9f674 1356 ((__AF__) == GPIO_AF0_TSC) || ((__AF__) == GPIO_AF2_RTC) || \
mbed_official 489:119543c9f674 1357 ((__AF__) == GPIO_AF0_TIM2) || ((__AF__) == GPIO_AF3_I2C1) || \
mbed_official 489:119543c9f674 1358 ((__AF__) == GPIO_AF0_TIM21) || ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 1359 ((__AF__) == GPIO_AF0_TIM22) || ((__AF__) == GPIO_AF3_EVENTOUT) || \
mbed_official 489:119543c9f674 1360 ((__AF__) == GPIO_AF0_EVENTOUT) || ((__AF__) == GPIO_AF4_I2C1) || \
mbed_official 489:119543c9f674 1361 ((__AF__) == GPIO_AF0_MCO) || ((__AF__) == GPIO_AF4_USART1) || \
mbed_official 489:119543c9f674 1362 ((__AF__) == GPIO_AF0_SWDIO) || ((__AF__) == GPIO_AF0_SWCLK) || \
mbed_official 489:119543c9f674 1363 ((__AF__) == GPIO_AF1_SPI1) || ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 1364 ((__AF__) == GPIO_AF1_SPI2) || ((__AF__) == GPIO_AF4_LPUART1) || \
mbed_official 489:119543c9f674 1365 ((__AF__) == GPIO_AF1_I2C1) || ((__AF__) == GPIO_AF4_EVENTOUT) || \
mbed_official 489:119543c9f674 1366 ((__AF__) == GPIO_AF6_EVENTOUT) || ((__AF__) == GPIO_AF5_SPI2) || \
mbed_official 489:119543c9f674 1367 ((__AF__) == GPIO_AF5_I2C2) || ((__AF__) == GPIO_AF5_TIM2) || \
mbed_official 489:119543c9f674 1368 ((__AF__) == GPIO_AF5_TIM21) || ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 1369 ((__AF__) == GPIO_AF6_I2C2) || ((__AF__) == GPIO_AF6_TIM21) || \
mbed_official 489:119543c9f674 1370 ((__AF__) == GPIO_AF7_COMP2) || ((__AF__) == GPIO_AF7_COMP1))
mbed_official 489:119543c9f674 1371
mbed_official 489:119543c9f674 1372
mbed_official 489:119543c9f674 1373 #define IS_GPIO_AF_AVAILABLE(__INSTANCE__,__AF__) \
mbed_official 489:119543c9f674 1374 ((((__INSTANCE__) == GPIOA) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1375 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1376 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 1377 ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 1378 ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 1379 ((__AF__) == GPIO_AF6_EVENTOUT) || \
mbed_official 489:119543c9f674 1380 ((__AF__) == GPIO_AF7_COMP1))) || \
mbed_official 489:119543c9f674 1381 (((__INSTANCE__) == GPIOB) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1382 ((__AF__) == GPIO_AF1_I2C1) || \
mbed_official 489:119543c9f674 1383 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1384 ((__AF__) == GPIO_AF3_TSC) || \
mbed_official 489:119543c9f674 1385 ((__AF__) == GPIO_AF4_LPUART1) || \
mbed_official 489:119543c9f674 1386 ((__AF__) == GPIO_AF5_I2C2) || \
mbed_official 489:119543c9f674 1387 ((__AF__) == GPIO_AF6_EVENTOUT))) || \
mbed_official 489:119543c9f674 1388 (((__INSTANCE__) == GPIOC) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1389 ((__AF__) == GPIO_AF2_EVENTOUT) || \
mbed_official 489:119543c9f674 1390 ((__AF__) == GPIO_AF3_TSC))) || \
mbed_official 489:119543c9f674 1391 (((__INSTANCE__) == GPIOD) && (((__AF__) == GPIO_AF0_LPUART1))) || \
mbed_official 489:119543c9f674 1392 (((__INSTANCE__) == GPIOH) && (((__AF__) == GPIO_AF0_USB))))
mbed_official 489:119543c9f674 1393
mbed_official 376:cb4d9db17537 1394
mbed_official 376:cb4d9db17537 1395 #endif /* STM32L052xx || STM32L062xx */
mbed_official 376:cb4d9db17537 1396 /*------------------------------------------------------------------------------------------*/
mbed_official 376:cb4d9db17537 1397
mbed_official 489:119543c9f674 1398 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 1399 /*------------------------- STM32L051xx/STM32L061xx---------------------------*/
mbed_official 489:119543c9f674 1400 /*----------------------------------------------------------------------------*/
mbed_official 376:cb4d9db17537 1401 #if defined (STM32L051xx)|| defined (STM32L061xx)
mbed_official 489:119543c9f674 1402 /* The table below gives an overview of the different alternate functions per port.
mbed_official 489:119543c9f674 1403 * For more details refer yourself to the product data sheet.
mbed_official 489:119543c9f674 1404 *
mbed_official 489:119543c9f674 1405 */
mbed_official 489:119543c9f674 1406 /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
mbed_official 489:119543c9f674 1407 *______________________________________________________________________________
mbed_official 489:119543c9f674 1408 * PA0 | | |TIM2_C1 | |USART2 |TIM2_TR | |COMP1 |
mbed_official 489:119543c9f674 1409 * PA1 |EVENTOUT| |TIM2_C2 | |USART2 |TIM21_TR| | |
mbed_official 489:119543c9f674 1410 * PA2 |TIM21_C1| |TIM2_C3 | |USART2 | | |COMP2 |
mbed_official 489:119543c9f674 1411 * PA3 |TIM21_C2| |TIM2_C4 | |USART2 | | | |
mbed_official 489:119543c9f674 1412 * PA4 |SPI1 | | | |USART2 |TIM22_TR| | |
mbed_official 489:119543c9f674 1413 * PA5 |SPI1 | |TIM2_TR | | |TIM2_C1 | | |
mbed_official 489:119543c9f674 1414 * PA6 |SPI1 | | | |LPUART |TIM22_C1|EVENTOUT|COMP1 |
mbed_official 489:119543c9f674 1415 * PA7 |SPI1 | | | | |TIM22_C2|EVENTOUT|COMP2 |
mbed_official 489:119543c9f674 1416 * PA8 |MCO | | |EVENTOUT|USART1 | | | |
mbed_official 489:119543c9f674 1417 * PA9 |MCO | | | |USART1 | | | |
mbed_official 489:119543c9f674 1418 * PA10| | | | |USART1 | | | |
mbed_official 489:119543c9f674 1419 * PA11|SPI1 | |EVENTOUT| |USART1 | | |COMP1 |
mbed_official 489:119543c9f674 1420 * PA12|SPI1 | |EVENTOUT| |USART1 | | |COMP2 |
mbed_official 489:119543c9f674 1421 * PA13|SWDIO | | | | | | | |
mbed_official 489:119543c9f674 1422 * PA14|SWCLK | | | |USART2 | | | |
mbed_official 489:119543c9f674 1423 * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 | | |
mbed_official 489:119543c9f674 1424 *______________________________________________________________________________
mbed_official 489:119543c9f674 1425 * PB0 |EVENTOUT| | | | | | | |
mbed_official 489:119543c9f674 1426 * PB1 | | | | |LPUART1 | | | |
mbed_official 489:119543c9f674 1427 * PB2 | | |LPTIM1_O| | | | | |
mbed_official 489:119543c9f674 1428 * PB3 |SPI1 | |TIM2_C2 | |EVENTOUT| | | |
mbed_official 489:119543c9f674 1429 * PB4 |SPI1 | |EVENTOUT| |TIM22_C1| | | |
mbed_official 489:119543c9f674 1430 * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM22_C2| | | |
mbed_official 489:119543c9f674 1431 * PB6 |USART1 |I2C1 |LPTIM1_T| | | | | |
mbed_official 489:119543c9f674 1432 * PB7 |USART1 |I2C1 |LPTIM1_I| | | | | |
mbed_official 489:119543c9f674 1433 * PB8 | | | | |I2C1 | | | |
mbed_official 489:119543c9f674 1434 * PB9 | | |EVENTOUT| |I2C1 |SPI2 | | |
mbed_official 489:119543c9f674 1435 * PB10| | |TIM2_C3 | |LPUART1 |SPI2 |I2C2 | |
mbed_official 489:119543c9f674 1436 * PB11|EVENTOUT| |TIM2_C4 | |LPUART1 | |I2C2 | |
mbed_official 489:119543c9f674 1437 * PB12|SPI2 | |LPUART1 | | |I2C2 |EVENTOUT| |
mbed_official 489:119543c9f674 1438 * PB13|SPI2 | | | |LPUART1 |I2C2 |TIM21_C1| |
mbed_official 489:119543c9f674 1439 * PB14|SPI2 | |RTC | |LPUART1 |I2C2 |TIM21_C2| |
mbed_official 489:119543c9f674 1440 * PB15|SPI2 | |RTC | | | | | |
mbed_official 489:119543c9f674 1441 *______________________________________________________________________________
mbed_official 489:119543c9f674 1442 * PC0 |LPTIM1_I| |EVENTOUT| | | | | |
mbed_official 489:119543c9f674 1443 * PC1 |LPTIM1_O| |EVENTOUT| | | | | |
mbed_official 489:119543c9f674 1444 * PC2 |LPTIM1_I| |SPI2 | | | | | |
mbed_official 489:119543c9f674 1445 * PC3 |LPTIM1_T| |SPI2 | | | | | |
mbed_official 489:119543c9f674 1446 * PC4 |EVENTOUT| |LPUART | | | | | |
mbed_official 489:119543c9f674 1447 * PC5 | | |LPUART | | | | | |
mbed_official 489:119543c9f674 1448 * PC6 |TIM22_C1| | | | | | | |
mbed_official 489:119543c9f674 1449 * PC7 |TIM22_C2| | | | | | | |
mbed_official 489:119543c9f674 1450 * PC8 |TIM22_TR| | | | | | | |
mbed_official 489:119543c9f674 1451 * PC9 |TIM21_TR| | | | | | | |
mbed_official 489:119543c9f674 1452 * PC10|LPUART | | | | | | | |
mbed_official 489:119543c9f674 1453 * PC11|LPUART | | | | | | | |
mbed_official 489:119543c9f674 1454 * PC12| | | | | | | | |
mbed_official 489:119543c9f674 1455 * PC13| | | | | | | | |
mbed_official 489:119543c9f674 1456 * PC14| | | | | | | | |
mbed_official 489:119543c9f674 1457 * PC15| | | | | | | | |
mbed_official 489:119543c9f674 1458 *______________________________________________________________________________
mbed_official 489:119543c9f674 1459 * PD2 |LPUART | | | | | | | |
mbed_official 489:119543c9f674 1460 *______________________________________________________________________________
mbed_official 489:119543c9f674 1461 * PH0 | | | | | | | | |
mbed_official 489:119543c9f674 1462 * PH1 | | | | | | | | |
mbed_official 489:119543c9f674 1463 * *
mbed_official 489:119543c9f674 1464 */
mbed_official 376:cb4d9db17537 1465
mbed_official 489:119543c9f674 1466 /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
mbed_official 489:119543c9f674 1467 * @{
mbed_official 489:119543c9f674 1468 */
mbed_official 489:119543c9f674 1469
mbed_official 489:119543c9f674 1470 /** @defgroup GPIOEx_Alternate_function_AF0 Alternate function AF0
mbed_official 489:119543c9f674 1471 * @{
mbed_official 489:119543c9f674 1472 */
mbed_official 489:119543c9f674 1473 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 1474 #define GPIO_AF0_SPI2 ((uint8_t)0x00) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 1475 #define GPIO_AF0_USART1 ((uint8_t)0x00) /* USART1 Alternate Function mapping */
mbed_official 489:119543c9f674 1476 #define GPIO_AF0_USART2 ((uint8_t)0x00) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 1477 #define GPIO_AF0_LPUART1 ((uint8_t)0x00) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 1478 #define GPIO_AF0_LPTIM1 ((uint8_t)0x00) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 1479 #define GPIO_AF0_TIM2 ((uint8_t)0x00) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 1480 #define GPIO_AF0_TIM21 ((uint8_t)0x00) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 1481 #define GPIO_AF0_TIM22 ((uint8_t)0x00) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 1482 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1483 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 1484 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /* SWDIO Alternate Function mapping */
mbed_official 489:119543c9f674 1485 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /* SWCLK Alternate Function mapping */
mbed_official 489:119543c9f674 1486 /**
mbed_official 489:119543c9f674 1487 * @}
mbed_official 489:119543c9f674 1488 */
mbed_official 376:cb4d9db17537 1489
mbed_official 489:119543c9f674 1490 /** @defgroup GPIOEx_Alternate_function_AF1 Alternate function AF1
mbed_official 489:119543c9f674 1491 * @{
mbed_official 489:119543c9f674 1492 */
mbed_official 489:119543c9f674 1493 #define GPIO_AF1_SPI1 ((uint8_t)0x01) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 1494 #define GPIO_AF1_SPI2 ((uint8_t)0x01) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 1495 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 1496 /**
mbed_official 489:119543c9f674 1497 * @}
mbed_official 489:119543c9f674 1498 */
mbed_official 489:119543c9f674 1499
mbed_official 489:119543c9f674 1500 /** @defgroup GPIOEx_Alternate_function_AF2 Alternate function AF2
mbed_official 489:119543c9f674 1501 * @{
mbed_official 489:119543c9f674 1502 */
mbed_official 489:119543c9f674 1503 #define GPIO_AF2_SPI2 ((uint8_t)0x02) /* SPI2 Alternate Function mapping */
mbed_official 489:119543c9f674 1504 #define GPIO_AF2_LPUART1 ((uint8_t)0x02) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 1505 #define GPIO_AF2_USB ((uint8_t)0x02) /* USB Alternate Function mapping */
mbed_official 489:119543c9f674 1506 #define GPIO_AF2_LPTIM1 ((uint8_t)0x02) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 1507 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 1508 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1509 #define GPIO_AF2_RTC ((uint8_t)0x02) /* RTC_OUT Alternate Function mapping */
mbed_official 489:119543c9f674 1510 /**
mbed_official 489:119543c9f674 1511 * @}
mbed_official 489:119543c9f674 1512 */
mbed_official 489:119543c9f674 1513
mbed_official 489:119543c9f674 1514 /** @defgroup GPIOEx_Alternate_function_AF3 Alternate function AF3
mbed_official 489:119543c9f674 1515 * @{
mbed_official 489:119543c9f674 1516 */
mbed_official 376:cb4d9db17537 1517 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /* I2C1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1518 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1519 /**
mbed_official 489:119543c9f674 1520 * @}
mbed_official 489:119543c9f674 1521 */
mbed_official 376:cb4d9db17537 1522
mbed_official 489:119543c9f674 1523 /** @defgroup GPIOEx_Alternate_function_AF4 Alternate function AF4
mbed_official 489:119543c9f674 1524 * @{
mbed_official 489:119543c9f674 1525 */
mbed_official 376:cb4d9db17537 1526 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1527 #define GPIO_AF4_USART1 ((uint8_t)0x04) /* USART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1528 #define GPIO_AF4_USART2 ((uint8_t)0x04) /* USART2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1529 #define GPIO_AF4_LPUART1 ((uint8_t)0x04) /* LPUART1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1530 #define GPIO_AF4_TIM22 ((uint8_t)0x04) /* TIM22 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1531 #define GPIO_AF4_EVENTOUT ((uint8_t)0x04) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1532 /**
mbed_official 489:119543c9f674 1533 * @}
mbed_official 489:119543c9f674 1534 */
mbed_official 376:cb4d9db17537 1535
mbed_official 489:119543c9f674 1536 /** @defgroup GPIOEx_Alternate_function_AF5 Alternate function AF5
mbed_official 489:119543c9f674 1537 * @{
mbed_official 489:119543c9f674 1538 */
mbed_official 376:cb4d9db17537 1539 #define GPIO_AF5_SPI2 ((uint8_t)0x05) /* SPI2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1540 #define GPIO_AF5_I2C2 ((uint8_t)0x05) /* I2C2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1541 #define GPIO_AF5_TIM2 ((uint8_t)0x05) /* TIM2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1542 #define GPIO_AF5_TIM21 ((uint8_t)0x05) /* TIM21 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1543 #define GPIO_AF5_TIM22 ((uint8_t)0x05) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 1544 /**
mbed_official 489:119543c9f674 1545 * @}
mbed_official 489:119543c9f674 1546 */
mbed_official 376:cb4d9db17537 1547
mbed_official 489:119543c9f674 1548 /** @defgroup GPIOEx_Alternate_function_AF6 Alternate function AF6
mbed_official 489:119543c9f674 1549 * @{
mbed_official 489:119543c9f674 1550 */
mbed_official 376:cb4d9db17537 1551 #define GPIO_AF6_I2C2 ((uint8_t)0x06) /* I2C2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1552 #define GPIO_AF6_TIM21 ((uint8_t)0x06) /* TIM21 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1553 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1554 /**
mbed_official 489:119543c9f674 1555 * @}
mbed_official 489:119543c9f674 1556 */
mbed_official 376:cb4d9db17537 1557
mbed_official 489:119543c9f674 1558 /** @defgroup GPIOEx_Alternate_function_AF7 Alternate function AF7
mbed_official 489:119543c9f674 1559 * @{
mbed_official 489:119543c9f674 1560 */
mbed_official 376:cb4d9db17537 1561 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /* COMP1 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1562 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /* COMP2 Alternate Function mapping */
mbed_official 376:cb4d9db17537 1563 /**
mbed_official 376:cb4d9db17537 1564 * @}
mbed_official 489:119543c9f674 1565 */
mbed_official 376:cb4d9db17537 1566
mbed_official 376:cb4d9db17537 1567 /**
mbed_official 376:cb4d9db17537 1568 * @}
mbed_official 376:cb4d9db17537 1569 */
mbed_official 376:cb4d9db17537 1570
mbed_official 489:119543c9f674 1571
mbed_official 489:119543c9f674 1572 #define IS_GPIO_AF(__AF__) (((__AF__) == GPIO_AF0_SPI1) || ((__AF__) == GPIO_AF2_SPI2) || \
mbed_official 489:119543c9f674 1573 ((__AF__) == GPIO_AF0_SPI2) || ((__AF__) == GPIO_AF2_LPUART1) || \
mbed_official 489:119543c9f674 1574 ((__AF__) == GPIO_AF0_USART1) || ((__AF__) == GPIO_AF7_COMP1) || \
mbed_official 489:119543c9f674 1575 ((__AF__) == GPIO_AF0_USART2) || ((__AF__) == GPIO_AF2_LPTIM1) || \
mbed_official 489:119543c9f674 1576 ((__AF__) == GPIO_AF0_LPUART1) || ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1577 ((__AF__) == GPIO_AF0_LPTIM1) || ((__AF__) == GPIO_AF2_EVENTOUT) || \
mbed_official 489:119543c9f674 1578 ((__AF__) == GPIO_AF2_RTC) || ((__AF__) == GPIO_AF4_TIM22) || \
mbed_official 489:119543c9f674 1579 ((__AF__) == GPIO_AF0_TIM2) || ((__AF__) == GPIO_AF3_I2C1) || \
mbed_official 489:119543c9f674 1580 ((__AF__) == GPIO_AF0_TIM21) || ((__AF__) == GPIO_AF7_COMP2) || \
mbed_official 489:119543c9f674 1581 ((__AF__) == GPIO_AF0_TIM22) || ((__AF__) == GPIO_AF3_EVENTOUT) || \
mbed_official 489:119543c9f674 1582 ((__AF__) == GPIO_AF0_EVENTOUT) || ((__AF__) == GPIO_AF4_I2C1) || \
mbed_official 489:119543c9f674 1583 ((__AF__) == GPIO_AF0_MCO) || ((__AF__) == GPIO_AF4_USART1) || \
mbed_official 489:119543c9f674 1584 ((__AF__) == GPIO_AF0_SWDIO) || ((__AF__) == GPIO_AF0_SWCLK) || \
mbed_official 489:119543c9f674 1585 ((__AF__) == GPIO_AF1_SPI1) || ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 1586 ((__AF__) == GPIO_AF1_SPI2) || ((__AF__) == GPIO_AF4_LPUART1) || \
mbed_official 489:119543c9f674 1587 ((__AF__) == GPIO_AF1_I2C1) || ((__AF__) == GPIO_AF4_EVENTOUT) || \
mbed_official 489:119543c9f674 1588 ((__AF__) == GPIO_AF6_EVENTOUT) || ((__AF__) == GPIO_AF5_SPI2) || \
mbed_official 489:119543c9f674 1589 ((__AF__) == GPIO_AF5_I2C2) || ((__AF__) == GPIO_AF5_TIM2) || \
mbed_official 489:119543c9f674 1590 ((__AF__) == GPIO_AF5_TIM21) || ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 1591 ((__AF__) == GPIO_AF6_I2C2) || ((__AF__) == GPIO_AF6_TIM21))
mbed_official 489:119543c9f674 1592
mbed_official 489:119543c9f674 1593
mbed_official 489:119543c9f674 1594
mbed_official 489:119543c9f674 1595 #define IS_GPIO_AF_AVAILABLE(__INSTANCE__,__AF__) \
mbed_official 489:119543c9f674 1596 ((((__INSTANCE__) == GPIOA) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1597 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1598 ((__AF__) == GPIO_AF3_EVENTOUT) || \
mbed_official 489:119543c9f674 1599 ((__AF__) == GPIO_AF4_USART2) || \
mbed_official 489:119543c9f674 1600 ((__AF__) == GPIO_AF5_TIM22) || \
mbed_official 489:119543c9f674 1601 ((__AF__) == GPIO_AF6_EVENTOUT) || \
mbed_official 489:119543c9f674 1602 ((__AF__) == GPIO_AF7_COMP2))) || \
mbed_official 489:119543c9f674 1603 (((__INSTANCE__) == GPIOB) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1604 ((__AF__) == GPIO_AF1_I2C1) || \
mbed_official 489:119543c9f674 1605 ((__AF__) == GPIO_AF2_TIM2) || \
mbed_official 489:119543c9f674 1606 ((__AF__) == GPIO_AF3_I2C1) || \
mbed_official 489:119543c9f674 1607 ((__AF__) == GPIO_AF4_LPUART1) || \
mbed_official 489:119543c9f674 1608 ((__AF__) == GPIO_AF5_I2C2) || \
mbed_official 489:119543c9f674 1609 ((__AF__) == GPIO_AF6_TIM21))) || \
mbed_official 489:119543c9f674 1610 (((__INSTANCE__) == GPIOC) && (((__AF__) == GPIO_AF0_EVENTOUT) || \
mbed_official 489:119543c9f674 1611 ((__AF__) == GPIO_AF2_LPUART1))) || \
mbed_official 489:119543c9f674 1612 (((__INSTANCE__) == GPIOD) && (((__AF__) == GPIO_AF0_LPUART1))))
mbed_official 489:119543c9f674 1613
mbed_official 489:119543c9f674 1614
mbed_official 489:119543c9f674 1615 #endif /* STM32L051xx/STM32L061xx*/
mbed_official 489:119543c9f674 1616 /*------------------------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 1617
mbed_official 489:119543c9f674 1618 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 1619 /*------------------------- STM32L031xx/STM32L041xx---------------------------*/
mbed_official 489:119543c9f674 1620 /*----------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 1621 #if defined (STM32L031xx)|| defined (STM32L041xx)
mbed_official 489:119543c9f674 1622 /* The table below gives an overview of the different alternate functions per port.
mbed_official 489:119543c9f674 1623 * For more details refer yourself to the product data sheet.
mbed_official 489:119543c9f674 1624 *
mbed_official 489:119543c9f674 1625 */
mbed_official 489:119543c9f674 1626 /* | AF0 | AF1 | AF2 | AF3 | AF4 | AF5 | AF6 | AF7 |
mbed_official 489:119543c9f674 1627 *______________________________________________________________________________
mbed_official 489:119543c9f674 1628 * PA0 | |LPTIM1 |TIM2_C1 | |USART2 |TIM2_TR | |COMP1 |
mbed_official 489:119543c9f674 1629 * PA1 |EVENTOUT|LPTIM1 |TIM2_C2 |I2C1 |USART2 |TIM21_TR| | |
mbed_official 489:119543c9f674 1630 * PA2 |TIM21_C1| |TIM2_C3 | |USART2 | |LPUART1 |COMP2 |
mbed_official 489:119543c9f674 1631 * PA3 |TIM21_C2| |TIM2_C4 | |USART2 | |LPUART1 | |
mbed_official 489:119543c9f674 1632 * PA4 |SPI1 |LPTIM1 | | |USART2 |TIM22_TR| | |
mbed_official 489:119543c9f674 1633 * PA5 |SPI1 |LPTIM1 |TIM2_TR | | |TIM2_C1 | | |
mbed_official 489:119543c9f674 1634 * PA6 |SPI1 |LPTIM1 | | |LPUART |TIM22_C1|EVENTOUT|COMP1 |
mbed_official 489:119543c9f674 1635 * PA7 |SPI1 |LPTIM1 | | |USART2 |TIM22_C2|EVENTOUT|COMP2 |
mbed_official 489:119543c9f674 1636 * PA8 |MCO | |LPTIM1 |EVENTOUT|USART2 | | | |
mbed_official 489:119543c9f674 1637 * PA9 |MCO |I2C1 | | |USART2 |TIM22_C1| | |
mbed_official 489:119543c9f674 1638 * PA10| |I2C1 | | |USART2 |TIM22_C2| | |
mbed_official 489:119543c9f674 1639 * PA11|SPI1 | |EVENTOUT| |USART2 | | |COMP1 |
mbed_official 489:119543c9f674 1640 * PA12|SPI1 | |EVENTOUT| |USART2 | | |COMP2 |
mbed_official 489:119543c9f674 1641 * PA13|SWDIO |LPTIM1 | | | | |LPUART1 | |
mbed_official 489:119543c9f674 1642 * PA14|SWCLK |LPTIM1 | |I2C1 |USART2 | |LPUART1 | |
mbed_official 489:119543c9f674 1643 * PA15|SPI1 | |TIM2_TR |EVENTOUT|USART2 |TIM2_C1 | | |
mbed_official 489:119543c9f674 1644 *_____________________________________________________________________________|
mbed_official 489:119543c9f674 1645 * PB0 |EVENTOUT|SPI1 | | |USART2 |TIM2_C3 | | |
mbed_official 489:119543c9f674 1646 * PB1 |USART2 |SPI1 | | |LPUART1 |TIM2_C4 | | |
mbed_official 489:119543c9f674 1647 * PB2 | | |LPTIM1_O| | | | | |
mbed_official 489:119543c9f674 1648 * PB3 |SPI1 | |TIM2_C2 | |EVENTOUT| | | |
mbed_official 489:119543c9f674 1649 * PB4 |SPI1 | |EVENTOUT| |TIM22_C1| | | |
mbed_official 489:119543c9f674 1650 * PB5 |SPI1 | |LPTIM1_I|I2C1 |TIM22_C2| | | |
mbed_official 489:119543c9f674 1651 * PB6 |USART2 |I2C1 |LPTIM1_T| | | | | |
mbed_official 489:119543c9f674 1652 * PB7 |USART2 |I2C1 |LPTIM1_I| | | | | |
mbed_official 489:119543c9f674 1653 * PB8 | | | | |I2C1 | | | |
mbed_official 489:119543c9f674 1654 * PB9 | | |EVENTOUT| |I2C1 | | | |
mbed_official 489:119543c9f674 1655 * PB10| | |TIM2_C3 | | | |LPUART1 | |
mbed_official 489:119543c9f674 1656 * PB11|EVENTOUT| |TIM2_C4 | | | |LPUART1 | |
mbed_official 489:119543c9f674 1657 * PB12|SPI2 | | | | | |EVENTOUT| |
mbed_official 489:119543c9f674 1658 * PB13|SPI2 | |MCO | | |TIM21_C1|LPUART1 | |
mbed_official 489:119543c9f674 1659 * PB14|SPI2 | |RTC | | |TIM21_C2|LPUART1 | |
mbed_official 489:119543c9f674 1660 * PB15|SPI2 | |RTC | | | | | |
mbed_official 489:119543c9f674 1661 *_____________________________________________________________________________|
mbed_official 489:119543c9f674 1662 * PC0 |LPTIM1_I| |EVENTOUT| | | |LPUART1 | |
mbed_official 489:119543c9f674 1663 * PC1 | | | | | | | | |
mbed_official 489:119543c9f674 1664 * PC13| | | | | | | | |
mbed_official 489:119543c9f674 1665 * PC14| | | | | | | | |
mbed_official 489:119543c9f674 1666 * PC15| | | | | | | | |
mbed_official 489:119543c9f674 1667 *_____________________________________________________________________________|
mbed_official 489:119543c9f674 1668 * PH0 | | | | | | | | |
mbed_official 489:119543c9f674 1669 * PH1 | | | | | | | | |
mbed_official 489:119543c9f674 1670 *_____________________________________________________________________________|
mbed_official 489:119543c9f674 1671 */
mbed_official 489:119543c9f674 1672
mbed_official 489:119543c9f674 1673 /** @defgroup GPIOEx_Alternate_function_selection Alternate function selection
mbed_official 489:119543c9f674 1674 * @{
mbed_official 489:119543c9f674 1675 */
mbed_official 489:119543c9f674 1676
mbed_official 489:119543c9f674 1677 /** @defgroup GPIOEx_Alternate_function_AF0 Alternate function AF0
mbed_official 489:119543c9f674 1678 * @{
mbed_official 489:119543c9f674 1679 */
mbed_official 489:119543c9f674 1680 #define GPIO_AF0_EVENTOUT ((uint8_t)0x00) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1681 #define GPIO_AF0_TIM21 ((uint8_t)0x00) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 1682 #define GPIO_AF0_SPI1 ((uint8_t)0x00) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 1683 #define GPIO_AF0_USART2 ((uint8_t)0x00) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 1684 #define GPIO_AF0_LPTIM1 ((uint8_t)0x00) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 1685 #define GPIO_AF0_MCO ((uint8_t)0x00) /* MCO Alternate Function mapping */
mbed_official 489:119543c9f674 1686 #define GPIO_AF0_SWDIO ((uint8_t)0x00) /* SWDIO Alternate Function mapping */
mbed_official 489:119543c9f674 1687 #define GPIO_AF0_SWCLK ((uint8_t)0x00) /* SWCLK Alternate Function mapping */
mbed_official 489:119543c9f674 1688 /**
mbed_official 489:119543c9f674 1689 * @}
mbed_official 489:119543c9f674 1690 */
mbed_official 489:119543c9f674 1691
mbed_official 489:119543c9f674 1692 /** @defgroup GPIOEx_Alternate_function_AF1 Alternate function AF1
mbed_official 489:119543c9f674 1693 * @{
mbed_official 489:119543c9f674 1694 */
mbed_official 489:119543c9f674 1695 #define GPIO_AF1_SPI1 ((uint8_t)0x01) /* SPI1 Alternate Function mapping */
mbed_official 489:119543c9f674 1696 #define GPIO_AF1_I2C1 ((uint8_t)0x01) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 1697 #define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 1698 /**
mbed_official 489:119543c9f674 1699 * @}
mbed_official 489:119543c9f674 1700 */
mbed_official 489:119543c9f674 1701
mbed_official 489:119543c9f674 1702 /** @defgroup GPIOEx_Alternate_function_AF2 Alternate function AF2
mbed_official 489:119543c9f674 1703 * @{
mbed_official 489:119543c9f674 1704 */
mbed_official 489:119543c9f674 1705 #define GPIO_AF2_LPTIM1 ((uint8_t)0x02) /* LPTIM1 Alternate Function mapping */
mbed_official 489:119543c9f674 1706 #define GPIO_AF2_TIM2 ((uint8_t)0x02) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 1707 #define GPIO_AF2_EVENTOUT ((uint8_t)0x02) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1708 #define GPIO_AF2_RTC ((uint8_t)0x02) /* RTC_OUT Alternate Function mapping */
mbed_official 489:119543c9f674 1709 /**
mbed_official 489:119543c9f674 1710 * @}
mbed_official 489:119543c9f674 1711 */
mbed_official 489:119543c9f674 1712
mbed_official 489:119543c9f674 1713 /** @defgroup GPIOEx_Alternate_function_AF3 Alternate function AF3
mbed_official 489:119543c9f674 1714 * @{
mbed_official 489:119543c9f674 1715 */
mbed_official 489:119543c9f674 1716 #define GPIO_AF3_I2C1 ((uint8_t)0x03) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 1717 #define GPIO_AF3_EVENTOUT ((uint8_t)0x03) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1718 /**
mbed_official 489:119543c9f674 1719 * @}
mbed_official 489:119543c9f674 1720 */
mbed_official 489:119543c9f674 1721
mbed_official 489:119543c9f674 1722 /** @defgroup GPIOEx_Alternate_function_AF4 Alternate function AF4
mbed_official 489:119543c9f674 1723 * @{
mbed_official 489:119543c9f674 1724 */
mbed_official 489:119543c9f674 1725 #define GPIO_AF4_I2C1 ((uint8_t)0x04) /* I2C1 Alternate Function mapping */
mbed_official 489:119543c9f674 1726 #define GPIO_AF4_USART2 ((uint8_t)0x04) /* USART2 Alternate Function mapping */
mbed_official 489:119543c9f674 1727 #define GPIO_AF4_LPUART1 ((uint8_t)0x04) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 1728 #define GPIO_AF4_TIM22 ((uint8_t)0x04) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 1729 #define GPIO_AF4_EVENTOUT ((uint8_t)0x04) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1730 /**
mbed_official 489:119543c9f674 1731 * @}
mbed_official 489:119543c9f674 1732 */
mbed_official 489:119543c9f674 1733
mbed_official 489:119543c9f674 1734 /** @defgroup GPIOEx_Alternate_function_AF5 Alternate function AF5
mbed_official 489:119543c9f674 1735 * @{
mbed_official 489:119543c9f674 1736 */
mbed_official 489:119543c9f674 1737 #define GPIO_AF5_TIM2 ((uint8_t)0x05) /* TIM2 Alternate Function mapping */
mbed_official 489:119543c9f674 1738 #define GPIO_AF5_TIM21 ((uint8_t)0x05) /* TIM21 Alternate Function mapping */
mbed_official 489:119543c9f674 1739 #define GPIO_AF5_TIM22 ((uint8_t)0x05) /* TIM22 Alternate Function mapping */
mbed_official 489:119543c9f674 1740 /**
mbed_official 489:119543c9f674 1741 * @}
mbed_official 489:119543c9f674 1742 */
mbed_official 489:119543c9f674 1743
mbed_official 489:119543c9f674 1744 /** @defgroup GPIOEx_Alternate_function_AF6 Alternate function AF6
mbed_official 489:119543c9f674 1745 * @{
mbed_official 489:119543c9f674 1746 */
mbed_official 489:119543c9f674 1747 #define GPIO_AF6_LPUART1 ((uint8_t)0x06) /* LPUART1 Alternate Function mapping */
mbed_official 489:119543c9f674 1748 #define GPIO_AF6_EVENTOUT ((uint8_t)0x06) /* EVENTOUT Alternate Function mapping */
mbed_official 489:119543c9f674 1749 /**
mbed_official 489:119543c9f674 1750 * @}
mbed_official 489:119543c9f674 1751 */
mbed_official 489:119543c9f674 1752
mbed_official 489:119543c9f674 1753 /** @defgroup GPIOEx_Alternate_function_AF7 Alternate function AF7
mbed_official 489:119543c9f674 1754 * @{
mbed_official 489:119543c9f674 1755 */
mbed_official 489:119543c9f674 1756 #define GPIO_AF7_COMP1 ((uint8_t)0x07) /* COMP1 Alternate Function mapping */
mbed_official 489:119543c9f674 1757 #define GPIO_AF7_COMP2 ((uint8_t)0x07) /* COMP2 Alternate Function mapping */
mbed_official 489:119543c9f674 1758 /**
mbed_official 489:119543c9f674 1759 * @}
mbed_official 489:119543c9f674 1760 */
mbed_official 489:119543c9f674 1761
mbed_official 489:119543c9f674 1762 /**
mbed_official 489:119543c9f674 1763 * @}
mbed_official 489:119543c9f674 1764 */
mbed_official 489:119543c9f674 1765
mbed_official 489:119543c9f674 1766 #define IS_GPIO_AF(__AF__) (((__AF__) == GPIO_AF0_EVENTOUT ) || \
mbed_official 489:119543c9f674 1767 ((__AF__) == GPIO_AF0_TIM21 ) || \
mbed_official 489:119543c9f674 1768 ((__AF__) == GPIO_AF0_SPI1 ) || \
mbed_official 489:119543c9f674 1769 ((__AF__) == GPIO_AF0_USART2 ) || \
mbed_official 489:119543c9f674 1770 ((__AF__) == GPIO_AF0_LPTIM1 ) || \
mbed_official 489:119543c9f674 1771 ((__AF__) == GPIO_AF0_MCO ) || \
mbed_official 489:119543c9f674 1772 ((__AF__) == GPIO_AF0_SWDIO ) || \
mbed_official 489:119543c9f674 1773 ((__AF__) == GPIO_AF0_SWCLK ) || \
mbed_official 489:119543c9f674 1774 ((__AF__) == GPIO_AF1_SPI1 ) || \
mbed_official 489:119543c9f674 1775 ((__AF__) == GPIO_AF1_I2C1 ) || \
mbed_official 489:119543c9f674 1776 ((__AF__) == GPIO_AF1_LPTIM1 ) || \
mbed_official 489:119543c9f674 1777 ((__AF__) == GPIO_AF2_LPTIM1 ) || \
mbed_official 489:119543c9f674 1778 ((__AF__) == GPIO_AF2_TIM2 ) || \
mbed_official 489:119543c9f674 1779 ((__AF__) == GPIO_AF2_EVENTOUT ) || \
mbed_official 489:119543c9f674 1780 ((__AF__) == GPIO_AF2_RTC ) || \
mbed_official 489:119543c9f674 1781 ((__AF__) == GPIO_AF3_I2C1 ) || \
mbed_official 489:119543c9f674 1782 ((__AF__) == GPIO_AF3_EVENTOUT ) || \
mbed_official 489:119543c9f674 1783 ((__AF__) == GPIO_AF4_I2C1 ) || \
mbed_official 489:119543c9f674 1784 ((__AF__) == GPIO_AF4_USART2 ) || \
mbed_official 489:119543c9f674 1785 ((__AF__) == GPIO_AF4_LPUART1 ) || \
mbed_official 489:119543c9f674 1786 ((__AF__) == GPIO_AF4_TIM22 ) || \
mbed_official 489:119543c9f674 1787 ((__AF__) == GPIO_AF4_EVENTOUT ) || \
mbed_official 489:119543c9f674 1788 ((__AF__) == GPIO_AF5_TIM2 ) || \
mbed_official 489:119543c9f674 1789 ((__AF__) == GPIO_AF5_TIM21 ) || \
mbed_official 489:119543c9f674 1790 ((__AF__) == GPIO_AF5_TIM22 ) || \
mbed_official 489:119543c9f674 1791 ((__AF__) == GPIO_AF6_LPUART1 ) || \
mbed_official 489:119543c9f674 1792 ((__AF__) == GPIO_AF6_EVENTOUT ) || \
mbed_official 489:119543c9f674 1793 ((__AF__) == GPIO_AF7_COMP1 ) || \
mbed_official 489:119543c9f674 1794 ((__AF__) == GPIO_AF7_COMP2 ))
mbed_official 489:119543c9f674 1795
mbed_official 489:119543c9f674 1796
mbed_official 489:119543c9f674 1797
mbed_official 489:119543c9f674 1798 #define IS_GPIO_AF_AVAILABLE(__INSTANCE__,__AF__) \
mbed_official 489:119543c9f674 1799 (1)
mbed_official 489:119543c9f674 1800
mbed_official 489:119543c9f674 1801
mbed_official 489:119543c9f674 1802 #endif /* STM32L031xx/STM32L041xx*/
mbed_official 489:119543c9f674 1803 /*------------------------------------------------------------------------------------------*/
mbed_official 489:119543c9f674 1804
mbed_official 489:119543c9f674 1805
mbed_official 489:119543c9f674 1806
mbed_official 489:119543c9f674 1807 #if defined (STM32L083xx) || defined (STM32L082xx) || defined (STM32L081xx) || \
mbed_official 489:119543c9f674 1808 defined (STM32L073xx) || defined (STM32L072xx) || defined (STM32L071xx)
mbed_official 489:119543c9f674 1809
mbed_official 489:119543c9f674 1810 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
mbed_official 489:119543c9f674 1811 ((__GPIOx__) == (GPIOB))? 1U :\
mbed_official 489:119543c9f674 1812 ((__GPIOx__) == (GPIOC))? 2U :\
mbed_official 489:119543c9f674 1813 ((__GPIOx__) == (GPIOD))? 3U :\
mbed_official 489:119543c9f674 1814 ((__GPIOx__) == (GPIOE))? 4U :\
mbed_official 489:119543c9f674 1815 ((__GPIOx__) == (GPIOH))? 5U : 6U)
mbed_official 489:119543c9f674 1816
mbed_official 489:119543c9f674 1817 /** @defgroup GPIOEx_Pin_Available Pin available
mbed_official 489:119543c9f674 1818 * @{
mbed_official 489:119543c9f674 1819 */
mbed_official 489:119543c9f674 1820 #define GPIOA_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1821 #define GPIOB_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1822 #define GPIOC_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1823 #define GPIOD_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1824 #define GPIOE_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1825 #define GPIOH_PIN_AVAILABLE (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_9 | GPIO_PIN_10)
mbed_official 489:119543c9f674 1826 /**
mbed_official 489:119543c9f674 1827 * @}
mbed_official 489:119543c9f674 1828 */
mbed_official 489:119543c9f674 1829
mbed_official 489:119543c9f674 1830 #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \
mbed_official 489:119543c9f674 1831 ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1832 (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1833 (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1834 (((__INSTANCE__) == GPIOD) && (((__PIN__) & (GPIOD_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOD_PIN_AVAILABLE)) == (GPIOD_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1835 (((__INSTANCE__) == GPIOE) && (((__PIN__) & (GPIOE_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOE_PIN_AVAILABLE)) == (GPIOE_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1836 (((__INSTANCE__) == GPIOH) && (((__PIN__) & (GPIOH_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOH_PIN_AVAILABLE)) == (GPIOH_PIN_AVAILABLE))))
mbed_official 489:119543c9f674 1837
mbed_official 489:119543c9f674 1838 #elif defined (STM32L031xx) || defined (STM32L041xx)
mbed_official 489:119543c9f674 1839
mbed_official 489:119543c9f674 1840 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
mbed_official 489:119543c9f674 1841 ((__GPIOx__) == (GPIOB))? 1U :\
mbed_official 489:119543c9f674 1842 ((__GPIOx__) == (GPIOC))? 2U :\
mbed_official 489:119543c9f674 1843 ((__GPIOx__) == (GPIOH))? 5U : 6U)
mbed_official 489:119543c9f674 1844
mbed_official 489:119543c9f674 1845 /** @defgroup GPIOEx_Pin_Available Pin available
mbed_official 489:119543c9f674 1846 * @{
mbed_official 489:119543c9f674 1847 */
mbed_official 489:119543c9f674 1848 #define GPIOA_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1849 #define GPIOB_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1850 #define GPIOC_PIN_AVAILABLE (GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_13 | GPIO_PIN_14 | GPIO_PIN_15)
mbed_official 489:119543c9f674 1851 #define GPIOH_PIN_AVAILABLE (GPIO_PIN_0 | GPIO_PIN_1)
mbed_official 489:119543c9f674 1852 /**
mbed_official 489:119543c9f674 1853 * @}
mbed_official 489:119543c9f674 1854 */
mbed_official 489:119543c9f674 1855
mbed_official 489:119543c9f674 1856 #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \
mbed_official 489:119543c9f674 1857 ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1858 (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1859 (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1860 (((__INSTANCE__) == GPIOH) && (((__PIN__) & (GPIOH_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOH_PIN_AVAILABLE)) == (GPIOH_PIN_AVAILABLE))))
mbed_official 489:119543c9f674 1861
mbed_official 489:119543c9f674 1862 #elif defined (STM32L063xx) || defined (STM32L062xx) || defined (STM32L061xx) || \
mbed_official 489:119543c9f674 1863 defined (STM32L053xx) || defined (STM32L052xx) || defined (STM32L051xx)
mbed_official 489:119543c9f674 1864
mbed_official 489:119543c9f674 1865 #define GPIO_GET_INDEX(__GPIOx__) (((__GPIOx__) == (GPIOA))? 0U :\
mbed_official 489:119543c9f674 1866 ((__GPIOx__) == (GPIOB))? 1U :\
mbed_official 489:119543c9f674 1867 ((__GPIOx__) == (GPIOC))? 2U :\
mbed_official 489:119543c9f674 1868 ((__GPIOx__) == (GPIOD))? 3U :\
mbed_official 489:119543c9f674 1869 ((__GPIOx__) == (GPIOH))? 5U : 6U)
mbed_official 489:119543c9f674 1870
mbed_official 489:119543c9f674 1871 /** @defgroup GPIOEx_Pin_Available Pin available
mbed_official 489:119543c9f674 1872 * @{
mbed_official 489:119543c9f674 1873 */
mbed_official 489:119543c9f674 1874 #define GPIOA_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1875 #define GPIOB_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1876 #define GPIOC_PIN_AVAILABLE GPIO_PIN_All
mbed_official 489:119543c9f674 1877 #define GPIOD_PIN_AVAILABLE GPIO_PIN_2
mbed_official 489:119543c9f674 1878 #define GPIOH_PIN_AVAILABLE GPIO_PIN_0 | GPIO_PIN_1
mbed_official 489:119543c9f674 1879 /**
mbed_official 489:119543c9f674 1880 * @}
mbed_official 489:119543c9f674 1881 */
mbed_official 489:119543c9f674 1882
mbed_official 489:119543c9f674 1883 #define IS_GPIO_PIN_AVAILABLE(__INSTANCE__,__PIN__) \
mbed_official 489:119543c9f674 1884 ((((__INSTANCE__) == GPIOA) && (((__PIN__) & (GPIOA_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOA_PIN_AVAILABLE)) == (GPIOA_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1885 (((__INSTANCE__) == GPIOB) && (((__PIN__) & (GPIOB_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOB_PIN_AVAILABLE)) == (GPIOB_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1886 (((__INSTANCE__) == GPIOC) && (((__PIN__) & (GPIOC_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOC_PIN_AVAILABLE)) == (GPIOC_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1887 (((__INSTANCE__) == GPIOD) && (((__PIN__) & (GPIOD_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOD_PIN_AVAILABLE)) == (GPIOD_PIN_AVAILABLE))) || \
mbed_official 489:119543c9f674 1888 (((__INSTANCE__) == GPIOH) && (((__PIN__) & (GPIOH_PIN_AVAILABLE)) != 0) && (((__PIN__) | (GPIOH_PIN_AVAILABLE)) == (GPIOH_PIN_AVAILABLE))))
mbed_official 489:119543c9f674 1889
mbed_official 489:119543c9f674 1890
mbed_official 489:119543c9f674 1891 #endif /* STM32L083xx || STM32L082xx || STM32L081xx || STM32L073xx || STM32L072xx || STM32L071xx*/
mbed_official 376:cb4d9db17537 1892
mbed_official 376:cb4d9db17537 1893
mbed_official 376:cb4d9db17537 1894 /**
mbed_official 376:cb4d9db17537 1895 * @}
mbed_official 376:cb4d9db17537 1896 */
mbed_official 376:cb4d9db17537 1897
mbed_official 376:cb4d9db17537 1898 /**
mbed_official 489:119543c9f674 1899 * @}
mbed_official 489:119543c9f674 1900 */
mbed_official 489:119543c9f674 1901
mbed_official 489:119543c9f674 1902 /**
mbed_official 489:119543c9f674 1903 * @}
mbed_official 489:119543c9f674 1904 */
mbed_official 376:cb4d9db17537 1905 #ifdef __cplusplus
mbed_official 376:cb4d9db17537 1906 }
mbed_official 376:cb4d9db17537 1907 #endif
mbed_official 376:cb4d9db17537 1908
mbed_official 376:cb4d9db17537 1909 #endif /* __STM32L0xx_HAL_GPIO_EX_H */
mbed_official 376:cb4d9db17537 1910
mbed_official 376:cb4d9db17537 1911 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
mbed_official 489:119543c9f674 1912