1 /**
2   ******************************************************************************
3   * @file    stm32wlxx_hal_gpio_ex.h
4   * @author  MCD Application Team
5   * @brief   Header file of GPIO HAL Extended module.
6   ******************************************************************************
7   * @attention
8   *
9   * Copyright (c) 2020 STMicroelectronics.
10   * All rights reserved.
11   *
12   * This software is licensed under terms that can be found in the LICENSE file
13   * in the root directory of this software component.
14   * If no LICENSE file comes with this software, it is provided AS-IS.
15   *
16   ******************************************************************************
17   */
18 
19 /* Define to prevent recursive inclusion -------------------------------------*/
20 #ifndef STM32WLxx_HAL_GPIO_EX_H
21 #define STM32WLxx_HAL_GPIO_EX_H
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /* Includes ------------------------------------------------------------------*/
28 #include "stm32wlxx_hal_def.h"
29 
30 /** @addtogroup STM32WLxx_HAL_Driver
31   * @{
32   */
33 
34 /** @defgroup GPIOEx GPIOEx
35   * @brief GPIO Extended HAL module driver
36   * @{
37   */
38 
39 /* Exported types ------------------------------------------------------------*/
40 /* Exported constants --------------------------------------------------------*/
41 /** @defgroup GPIOEx_Exported_Constants GPIOEx Exported Constants
42   * @{
43   */
44 
45 /** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
46   * @{
47   */
48 
49 /**
50   * @brief   AF 0 selection
51   */
52 #define GPIO_AF0_MCO                        ((uint8_t)0x00)  /*!< MCO Alternate Function mapping       */
53 #define GPIO_AF0_LSCO                       ((uint8_t)0x00)  /*!< LSCO Alternate Function mapping      */
54 #define GPIO_AF0_JTAG                       ((uint8_t)0x00)  /*!< JTAG Alternate Function mapping      */
55 #define GPIO_AF0_SWD                        ((uint8_t)0x00)  /*!< SWD Alternate Function mapping       */
56 #define GPIO_AF0_RTC                        ((uint8_t)0x00)  /*!< RCT_OUT Alternate Function mapping   */
57 
58 /**
59   * @brief   AF 1 selection
60  */
61 #define GPIO_AF1_LPTIM1                     ((uint8_t)0x01)  /*!< LPTIM3 Alternate Function mapping    */
62 #define GPIO_AF1_TIM1                       ((uint8_t)0x01)  /*!< TIM1 Alternate Function mapping      */
63 #define GPIO_AF1_TIM2                       ((uint8_t)0x01)  /*!< TIM2 Alternate Function mapping      */
64 
65 /**
66   * @brief   AF 2 selection
67   */
68 #define GPIO_AF2_TIM2                       ((uint8_t)0x02)  /*!< TIM2 Alternate Function mapping      */
69 #define GPIO_AF2_TIM1                       ((uint8_t)0x02)  /*!< TIM1 Alternate Function mapping      */
70 
71 /**
72   * @brief   AF 3 selection
73   */
74 #define GPIO_AF3_SPI2                       ((uint8_t)0x03)  /*!< SPI2 Alternate Function mapping      */
75 #define GPIO_AF3_LPTIM3                     ((uint8_t)0x03)  /*!< LPTIM3 Alternate Function mapping    */
76 #define GPIO_AF3_TIM1                       ((uint8_t)0x03)  /*!< TIM1 Alternate Function mapping      */
77 
78 /**
79   * @brief   AF 4 selection
80   */
81 #define GPIO_AF4_I2C1                       ((uint8_t)0x04)  /*!< I2C1 Alternate Function mapping      */
82 #define GPIO_AF4_I2C2                       ((uint8_t)0x04)  /*!< I2C1 Alternate Function mapping      */
83 #define GPIO_AF4_I2C3                       ((uint8_t)0x04)  /*!< I2C3 Alternate Function mapping      */
84 
85 /**
86   * @brief   AF 5 selection
87   */
88 #define GPIO_AF5_SPI1                       ((uint8_t)0x05)  /*!< SPI1 Alternate Function mapping      */
89 #define GPIO_AF5_SPI2                       ((uint8_t)0x05)  /*!< SPI2 Alternate Function mapping      */
90 
91 /**
92   * @brief   AF 6 selection
93   */
94 #define GPIO_AF6_RF_BUSY                    ((uint8_t)0x06)  /*!< RF_BUSY Alternate Function mapping   */
95 
96 /**
97   * @brief  AF 7 selection
98   */
99 #define GPIO_AF7_USART1                     ((uint8_t)0x07) /*!< USART1 Alternate Function mapping     */
100 #define GPIO_AF7_USART2                     ((uint8_t)0x07) /*!< USART1 Alternate Function mapping     */
101 
102 /**
103   * @brief  AF 8 selection
104   */
105 #define GPIO_AF8_LPUART1                    ((uint8_t)0x08) /*!< LPUART1 Alternate Function mapping    */
106 #define GPIO_AF8_IR                         ((uint8_t)0x08) /*!< IR Alternate Function mapping         */
107 
108 /**
109   * @brief  AF 12 selection
110   */
111 #define GPIO_AF12_COMP1                     ((uint8_t)0x0C)  /*!< COMP1 Alternate Function mapping     */
112 #define GPIO_AF12_COMP2                     ((uint8_t)0x0C)  /*!< COMP2 Alternate Function mapping     */
113 #define GPIO_AF12_TIM1                      ((uint8_t)0x0C)  /*!< TIM1 Alternate Function mapping      */
114 
115 /**
116   * @brief  AF 13 selection
117   */
118 #define GPIO_AF13_DEBUG_PWR                 ((uint8_t)0x0D) /*!< Debug PWR Alternate Function mapping       */
119 #define GPIO_AF13_DEBUG_RF                  ((uint8_t)0x0D) /*!< Debug RF Alternate Function mapping        */
120 #define GPIO_AF13_DEBUG_SUBGHZSPI           ((uint8_t)0x0D) /*!< Debug SUBGHZSPI Alternate Function mapping */
121 
122 /**
123   * @brief  AF 14 selection
124   */
125 #define GPIO_AF14_LPTIM2                    ((uint8_t)0x0E) /*!< LPTIM2 Alternate Function mapping     */
126 #define GPIO_AF14_TIM2                      ((uint8_t)0x0E) /*!< TIM2 Alternate Function mapping       */
127 #define GPIO_AF14_TIM16                     ((uint8_t)0x0E) /*!< TIM16 Alternate Function mapping      */
128 #define GPIO_AF14_TIM17                     ((uint8_t)0x0E) /*!< TIM17 Alternate Function mapping      */
129 
130 /**
131   * @brief  AF 15 selection
132   */
133 
134 #define GPIO_AF15_EVENTOUT                  ((uint8_t)0x0F) /*!< EVENTOUT Alternate Function mapping   */
135 
136 #define IS_GPIO_AF(AF)                      ((AF) <= (uint8_t)0x0F)
137 
138 
139 /**
140   * @}
141   */
142 
143 /**
144   * @}
145   */
146 
147 /* Exported macro ------------------------------------------------------------*/
148 /** @defgroup GPIOEx_Exported_Macros GPIOEx Exported Macros
149   * @{
150   */
151 
152 /** @defgroup GPIOEx_Get_Port_Index GPIOEx Get Port Index
153   * @{
154   */
155 
156 #define GPIO_GET_INDEX(__GPIOx__)           (((__GPIOx__) == (GPIOA))? 0uL :\
157                                              ((__GPIOx__) == (GPIOB))? 1uL :\
158                                              ((__GPIOx__) == (GPIOC))? 2uL : 7uL)
159 
160 /**
161   * @}
162  */
163 
164 /**
165   * @}
166   */
167 
168 /* Exported functions --------------------------------------------------------*/
169 /**
170   * @}
171   */
172 
173 /**
174   * @}
175   */
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif /* STM32WLxx_HAL_GPIO_EX_H */
182