Ricardo Benitez / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Mar 15 14:34:00 2016 +0000
Revision:
116:c0f6e94411f5
Release 116 of the mbed library

Changes:
- new targets - NUCLEO_L073RZ
- fixes to IOTSS BEID platform
- LPC824, LPC1549 and LPC11U68 - fix PWMOut SCT bugs
- STM32F7 - Cube driver
- STM32F4 - add RTC LSI macro, defined as 0
- STM32F3 - fix multiple ADC clock initialization
- retarget - binary mode fix for GCC

Who changed what in which revision?

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