@@ -44,7 +44,7 @@ extern "C" {
44
44
/** @defgroup GPIOEx_Alternate_function_selection GPIOEx Alternate function selection
45
45
* @{
46
46
*/
47
- #if defined(STM32U385xx ) || defined(STM32U375xx )
47
+ #if defined(STM32U356xx ) || defined( STM32U366xx ) || defined( STM32U385xx ) || defined(STM32U375xx ) || defined( STM32U3B5xx ) || defined( STM32U3C5xx )
48
48
/**
49
49
* @brief AF 0 selection
50
50
*/
@@ -63,6 +63,9 @@ extern "C" {
63
63
#define GPIO_AF1_LPTIM1 ((uint8_t)0x01) /*!< LPTIM1 Alternate Function mapping */
64
64
#define GPIO_AF1_TIM1 ((uint8_t)0x01) /*!< TIM1 Alternate Function mapping */
65
65
#define GPIO_AF1_TIM2 ((uint8_t)0x01) /*!< TIM2 Alternate Function mapping */
66
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
67
+ #define GPIO_AF1_TIM8 ((uint8_t)0x01) /*!< TIM8 Alternate Function mapping */
68
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
66
69
67
70
/**
68
71
* @brief AF 2 selection
@@ -75,27 +78,44 @@ extern "C" {
75
78
#define GPIO_AF2_TIM2 ((uint8_t)0x02) /*!< TIM2 Alternate Function mapping */
76
79
#define GPIO_AF2_TIM3 ((uint8_t)0x02) /*!< TIM3 Alternate Function mapping */
77
80
#define GPIO_AF2_TIM4 ((uint8_t)0x02) /*!< TIM4 Alternate Function mapping */
81
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
82
+ #define GPIO_AF2_TIM12 ((uint8_t)0x02) /*!< TIM12 Alternate Function mapping */
83
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
78
84
79
85
/**
80
86
* @brief AF 3 selection
81
87
*/
82
88
#define GPIO_AF3_ADF1 ((uint8_t)0x03) /*!< ADF1 Alternate Function mapping */
83
89
#define GPIO_AF3_I2C1 ((uint8_t)0x03) /*!< I2C1 Alternate Function mapping */
90
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
84
91
#define GPIO_AF3_I2C2 ((uint8_t)0x03) /*!< I2C2 Alternate Function mapping */
92
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
85
93
#define GPIO_AF3_I3C1 ((uint8_t)0x03) /*!< I3C1 Alternate Function mapping */
94
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
86
95
#define GPIO_AF3_I3C2 ((uint8_t)0x03) /*!< I3C2 Alternate Function mapping */
96
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
87
97
#define GPIO_AF3_OCTOSPI1 ((uint8_t)0x03) /*!< OCTOSPI1 Alternate Function mapping */
98
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
88
99
#define GPIO_AF3_SAI1 ((uint8_t)0x03) /*!< SAI1 Alternate Function mapping */
100
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
89
101
#define GPIO_AF3_SPI2 ((uint8_t)0x03) /*!< SPI2 Alternate Function mapping */
90
102
#define GPIO_AF3_TIM1 ((uint8_t)0x03) /*!< TIM1 Alternate Function mapping */
103
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
104
+ #define GPIO_AF3_TIM8 ((uint8_t)0x03) /*!< TIM8 Alternate Function mapping */
105
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
91
106
92
107
/**
93
108
* @brief AF 4 selection
94
109
*/
95
110
#define GPIO_AF4_I2C1 ((uint8_t)0x04) /*!< I2C1 Alternate Function mapping */
111
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
96
112
#define GPIO_AF4_I2C2 ((uint8_t)0x04) /*!< I2C2 Alternate Function mapping */
113
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
97
114
#define GPIO_AF4_I2C3 ((uint8_t)0x04) /*!< I2C3 Alternate Function mapping */
98
115
#define GPIO_AF4_LPTIM3 ((uint8_t)0x04) /*!< LPTIM3 Alternate Function mapping */
116
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
117
+ #define GPIO_AF4_USART2 ((uint8_t)0x04) /*!< USART2 Alternate Function mapping */
118
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
99
119
100
120
/**
101
121
* @brief AF 5 selection
@@ -107,18 +127,30 @@ extern "C" {
107
127
#define GPIO_AF5_SPI1 ((uint8_t)0x05) /*!< SPI1 Alternate Function mapping */
108
128
#define GPIO_AF5_SPI2 ((uint8_t)0x05) /*!< SPI2 Alternate Function mapping */
109
129
#define GPIO_AF5_SPI3 ((uint8_t)0x05) /*!< SPI3 Alternate Function mapping */
130
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
131
+ #define GPIO_AF5_I2C4 ((uint8_t)0x05) /*!< I2C4 Alternate Function mapping */
132
+ #define GPIO_AF5_SPI4 ((uint8_t)0x05) /*!< SPI4 Alternate Function mapping */
133
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
110
134
111
135
/**
112
136
* @brief AF 6 selection
113
137
*/
114
138
#define GPIO_AF6_I3C1 ((uint8_t)0x06) /*!< I3C1 Alternate Function mapping */
139
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
115
140
#define GPIO_AF6_I3C2 ((uint8_t)0x06) /*!< I3C2 Alternate Function mapping */
141
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
116
142
#define GPIO_AF6_SPI3 ((uint8_t)0x06) /*!< SPI3 Alternate Function mapping */
143
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
144
+ #define GPIO_AF6_SPI4 ((uint8_t)0x06) /*!< SPI4 Alternate Function mapping */
145
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
117
146
118
147
/**
119
148
* @brief AF 7 selection
120
149
*/
121
150
#define GPIO_AF7_USART1 ((uint8_t)0x07) /*!< USART1 Alternate Function mapping */
151
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
152
+ #define GPIO_AF7_USART2 ((uint8_t)0x07) /*!< USART2 Alternate Function mapping */
153
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
122
154
#define GPIO_AF7_USART3 ((uint8_t)0x07) /*!< USART3 Alternate Function mapping */
123
155
124
156
@@ -128,12 +160,16 @@ extern "C" {
128
160
#define GPIO_AF8_LPUART1 ((uint8_t)0x08) /*!< LPUART1 Alternate Function mapping */
129
161
#define GPIO_AF8_UART4 ((uint8_t)0x08) /*!< UART4 Alternate Function mapping */
130
162
#define GPIO_AF8_UART5 ((uint8_t)0x08) /*!< UART5 Alternate Function mapping */
163
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
131
164
#define GPIO_AF8_SDMMC1 ((uint8_t)0x08) /*!< SDMMC1 Alternate Function mapping */
165
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
132
166
133
167
/**
134
168
* @brief AF 9 selection
135
169
*/
170
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
136
171
#define GPIO_AF9_FDCAN1 ((uint8_t)0x09) /*!< FDCAN1 Alternate Function mapping */
172
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
137
173
#define GPIO_AF9_TSC ((uint8_t)0x09) /*!< TSC Alternate Function mapping */
138
174
139
175
/**
@@ -147,14 +183,26 @@ extern "C" {
147
183
* @brief AF 11 selection
148
184
*/
149
185
#define GPIO_AF11_MCO2 ((uint8_t)0x0B) /*!< MCO2 Alternate Function mapping */
186
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
187
+ #define GPIO_AF11_I2C4 ((uint8_t)0x0B) /*!< I2C4 Alternate Function mapping */
188
+ #define GPIO_AF11_FDCAN2 ((uint8_t)0x0B) /*!< FDCAN2 Alternate Function mapping */
189
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
190
+ #if defined(STM32U356xx ) || defined(STM32U366xx )
191
+ #define GPIO_AF11_LCD ((uint8_t)0x0B) /*!< LCD Alternate Function mapping */
192
+ #endif /* defined(STM32U356xx) || defined(STM32U366xx) */
150
193
151
194
/**
152
195
* @brief AF 12 selection
153
196
*/
154
197
#define GPIO_AF12_COMP1 ((uint8_t)0x0C) /*!< COMP1 Alternate Function mapping */
155
198
#define GPIO_AF12_COMP2 ((uint8_t)0x0C) /*!< COMP2 Alternate Function mapping */
199
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
156
200
#define GPIO_AF12_SDMMC1 ((uint8_t)0x0C) /*!< SDMMC1 Alternate Function mapping */
201
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
157
202
#define GPIO_AF12_TRACE ((uint8_t)0x0C) /*!< TRACE Alternate Function mapping */
203
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
204
+ #define GPIO_AF12_I2C4 ((uint8_t)0x0C) /*!< I2C4 Alternate Function mapping */
205
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
158
206
159
207
160
208
/**
@@ -163,7 +211,12 @@ extern "C" {
163
211
#define GPIO_AF13_AUDIOCLK ((uint8_t)0x0D) /*!< AUDIOCLOCK Alternate Function mapping */
164
212
#define GPIO_AF13_LPTIM2 ((uint8_t)0x0D) /*!< LPTIM2 Alternate Function mapping */
165
213
#define GPIO_AF13_LPTIM4 ((uint8_t)0x0D) /*!< LPTIM4 Alternate Function mapping */
214
+ #if !(defined(STM32U356xx ) || defined(STM32U366xx ))
166
215
#define GPIO_AF13_SAI1 ((uint8_t)0x0D) /*!< SAI1 Alternate Function mapping */
216
+ #endif /* !(defined(STM32U356xx) || defined(STM32U366xx)) */
217
+ #if defined(STM32U3B5xx ) || defined(STM32U3C5xx )
218
+ #define GPIO_AF13_TIM8 ((uint8_t)0x0D) /*!< TIM8 Alternate Function mapping */
219
+ #endif /* defined(STM32U3B5xx) || defined(STM32U3C5xx) */
167
220
168
221
169
222
/**
@@ -183,7 +236,7 @@ extern "C" {
183
236
184
237
#define IS_GPIO_AF (AF ) ((AF) <= (uint8_t)0x0F)
185
238
186
- #endif /* defined(STM32U385xx) || defined(STM32U375xx) */
239
+ #endif /* defined(STM32U385xx) || defined(STM32U375xx) || defined(STM32U3B5xx) || defined(STM32U3C5xx) */
187
240
188
241
189
242
/**
@@ -202,13 +255,31 @@ extern "C" {
202
255
/** @defgroup GPIOEx_Get_Port_Index GPIOEx Get Port Index
203
256
* @{
204
257
*/
258
+ #if defined(GPIOF )
205
259
#define GPIO_GET_INDEX (__GPIOx__ ) (((__GPIOx__) == (GPIOA))? 0UL :\
206
260
((__GPIOx__) == (GPIOB))? 1UL :\
207
261
((__GPIOx__) == (GPIOC))? 2UL :\
208
262
((__GPIOx__) == (GPIOD))? 3UL :\
209
263
((__GPIOx__) == (GPIOE))? 4UL :\
264
+ ((__GPIOx__) == (GPIOF))? 5UL :\
210
265
((__GPIOx__) == (GPIOG))? 6UL :\
211
266
((__GPIOx__) == (GPIOH))? 7UL : 16UL)
267
+ #elif defined(GPIOG )
268
+ #define GPIO_GET_INDEX (__GPIOx__ ) (((__GPIOx__) == (GPIOA))? 0UL :\
269
+ ((__GPIOx__) == (GPIOB))? 1UL :\
270
+ ((__GPIOx__) == (GPIOC))? 2UL :\
271
+ ((__GPIOx__) == (GPIOD))? 3UL :\
272
+ ((__GPIOx__) == (GPIOE))? 4UL :\
273
+ ((__GPIOx__) == (GPIOG))? 6UL :\
274
+ ((__GPIOx__) == (GPIOH))? 7UL : 16UL)
275
+ #else
276
+ #define GPIO_GET_INDEX (__GPIOx__ ) (((__GPIOx__) == (GPIOA))? 0UL :\
277
+ ((__GPIOx__) == (GPIOB))? 1UL :\
278
+ ((__GPIOx__) == (GPIOC))? 2UL :\
279
+ ((__GPIOx__) == (GPIOD))? 3UL :\
280
+ ((__GPIOx__) == (GPIOE))? 4UL :\
281
+ ((__GPIOx__) == (GPIOH))? 7UL : 16UL)
282
+ #endif /* GPIOF */
212
283
213
284
/**
214
285
* @}
0 commit comments