1 /**
2 ******************************************************************************
3 * @file HAL_gpio.c
4 * @author AE Team
5 * @version V1.0.0
6 * @date 28/7/2017
7 * @brief This file provides all the GPIO firmware functions.
8 ******************************************************************************
9 * @copy
10 *
11 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 * TIME. AS A RESULT, MindMotion SHALL NOT BE HELD LIABLE FOR ANY
14 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 *
18 * <h2><center>© COPYRIGHT 2017 MindMotion</center></h2>
19 */
20
21 /* Includes ------------------------------------------------------------------*/
22 #include "HAL_gpio.h"
23 #include "HAL_rcc.h"
24
25 /** @addtogroup StdPeriph_Driver
26 * @{
27 */
28
29 /** @defgroup GPIO
30 * @brief GPIO driver modules
31 * @{
32 */
33
34 /** @defgroup GPIO_Private_TypesDefinitions
35 * @{
36 */
37
38 /**
39 * @}
40 */
41
42 /** @defgroup GPIO_Private_Defines
43 * @{
44 */
45
46 /* ------------ RCC registers bit address in the alias region ----------------*/
47 #define AFIO_OFFSET (AFIO_BASE - PERIPH_BASE)
48
49 /* --- EVENTCR Register -----*/
50
51 /* Alias word address of EVOE bit */
52 #define EVCR_OFFSET (AFIO_OFFSET + 0x00)
53 #define EVOE_BitNumber ((uint8_t)0x07)
54 #define EVCR_EVOE_BB (PERIPH_BB_BASE + (EVCR_OFFSET * 32) + (EVOE_BitNumber * 4))
55 #define EVCR_PORTPINCONFIG_MASK ((uint16_t)0xFF80)
56 #define LSB_MASK ((uint16_t)0xFFFF)
57 #define DBGAFR_POSITION_MASK ((uint32_t)0x000F0000)
58 #define DBGAFR_SWJCFG_MASK ((uint32_t)0xFFFFFFFF)
59 #define DBGAFR_LOCATION_MASK ((uint32_t)0x00200000)
60 #define DBGAFR_NUMBITS_MASK ((uint32_t)0x00100000)
61
62 /**
63 * @}
64 */
65
66 /** @defgroup GPIO_Private_Macros
67 * @{
68 */
69
70 /**
71 * @}
72 */
73
74 /** @defgroup GPIO_Private_Variables
75 * @{
76 */
77
78 /**
79 * @}
80 */
81
82 /** @defgroup GPIO_Private_FunctionPrototypes
83 * @{
84 */
85
86 /**
87 * @}
88 */
89
90 /** @defgroup GPIO_Private_Functions
91 * @{
92 */
93
94 /**
95 * @brief Deinitializes the GPIOx peripheral registers to their default
96 * reset values.
97 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
98 * @retval : None
99 */
GPIO_DeInit(GPIO_TypeDef * GPIOx)100 void GPIO_DeInit(GPIO_TypeDef* GPIOx)
101 {
102 /* Check the parameters */
103 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
104
105 switch (*(uint32_t*)&GPIOx)
106 {
107 case GPIOA_BASE:
108 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, ENABLE);
109 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, DISABLE);
110 break;
111 case GPIOB_BASE:
112 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, ENABLE);
113 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, DISABLE);
114 break;
115 case GPIOC_BASE:
116 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, ENABLE);
117 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, DISABLE);
118 break;
119 case GPIOD_BASE:
120 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, ENABLE);
121 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, DISABLE);
122 break;
123
124 default:
125 break;
126 }
127 }
128
129 /**
130 * @brief Deinitializes the Alternate Functions (remap, event control
131 * and EXTI configuration) registers to their default reset
132 * values.
133 * @param None
134 * @retval : None
135 */
GPIO_AFIODeInit(void)136 void GPIO_AFIODeInit(void)
137 {
138 RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, ENABLE);
139 RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, DISABLE);
140 }
141
142 /**
143 * @brief Initializes the GPIOx peripheral according to the specified
144 * parameters in the GPIO_InitStruct.
145 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
146 * @param GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
147 * contains the configuration information for the specified GPIO
148 * peripheral.
149 * @retval : None
150 */
GPIO_Init(GPIO_TypeDef * GPIOx,GPIO_InitTypeDef * GPIO_InitStruct)151 void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
152 {
153 uint32_t currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00;
154 uint32_t tmpreg = 0x00, pinmask = 0x00;
155 /* Check the parameters */
156 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
157 assert_param(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));
158 assert_param(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin));
159
160 /*---------------------------- GPIO Mode Configuration -----------------------*/
161 currentmode = ((uint32_t)GPIO_InitStruct->GPIO_Mode) & ((uint32_t)0x0F);
162 if ((((uint32_t)GPIO_InitStruct->GPIO_Mode) & ((uint32_t)0x10)) != 0x00)
163 {
164 /* Check the parameters */
165 assert_param(IS_GPIO_SPEED(GPIO_InitStruct->GPIO_Speed));
166 /* Output mode */
167 currentmode |= (uint32_t)GPIO_InitStruct->GPIO_Speed;
168 }
169 /*---------------------------- GPIO CRL Configuration ------------------------*/
170 /* Configure the eight low port pins */
171 if (((uint32_t)GPIO_InitStruct->GPIO_Pin & ((uint32_t)0x00FF)) != 0x00)
172 {
173 tmpreg = GPIOx->CRL;
174 for (pinpos = 0x00; pinpos < 0x08; pinpos++)
175 {
176 pos = ((uint32_t)0x01) << pinpos;
177 /* Get the port pins position */
178 currentpin = (GPIO_InitStruct->GPIO_Pin) & pos;
179 if (currentpin == pos)
180 {
181 pos = pinpos << 2;
182 /* Clear the corresponding low control register bits */
183 pinmask = ((uint32_t)0x0F) << pos;
184 tmpreg &= ~pinmask;
185 /* Write the mode configuration in the corresponding bits */
186 tmpreg |= (currentmode << pos);
187 /* Reset the corresponding ODR bit */
188 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
189 {
190 GPIOx->BRR = (((uint32_t)0x01) << pinpos);
191 }
192 else
193 {
194 /* Set the corresponding ODR bit */
195 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
196 {
197 GPIOx->BSRR = (((uint32_t)0x01) << pinpos);
198 }
199 }
200 }
201 }
202 GPIOx->CRL = tmpreg;
203 }
204 /*---------------------------- GPIO CRH Configuration ------------------------*/
205 /* Configure the eight high port pins */
206 if (GPIO_InitStruct->GPIO_Pin > 0x00FF)
207 {
208 tmpreg = GPIOx->CRH;
209 for (pinpos = 0x00; pinpos < 0x08; pinpos++)
210 {
211 pos = (((uint32_t)0x01) << (pinpos + 0x08));
212 /* Get the port pins position */
213 currentpin = ((GPIO_InitStruct->GPIO_Pin) & pos);
214 if (currentpin == pos)
215 {
216 pos = pinpos << 2;
217 /* Clear the corresponding high control register bits */
218 pinmask = ((uint32_t)0x0F) << pos;
219 tmpreg &= ~pinmask;
220 /* Write the mode configuration in the corresponding bits */
221 tmpreg |= (currentmode << pos);
222 /* Reset the corresponding ODR bit */
223 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
224 {
225 GPIOx->BRR = (((uint32_t)0x01) << (pinpos + 0x08));
226 }
227 /* Set the corresponding ODR bit */
228 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
229 {
230 GPIOx->BSRR = (((uint32_t)0x01) << (pinpos + 0x08));
231 }
232 }
233 }
234 GPIOx->CRH = tmpreg;
235 }
236 }
237
238 /**
239 * @brief Fills each GPIO_InitStruct member with its default value.
240 * @param GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
241 * which will be initialized.
242 * @retval : None
243 */
GPIO_StructInit(GPIO_InitTypeDef * GPIO_InitStruct)244 void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
245 {
246 /* Reset GPIO init structure parameters values */
247 GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
248 GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;
249 GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
250 }
251
252 /**
253 * @brief Reads the specified input port pin.
254 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
255 * @param GPIO_Pin: specifies the port bit to read.
256 * This parameter can be GPIO_Pin_x where x can be (0..15).
257 * @retval : The input port pin value.
258 */
GPIO_ReadInputDataBit(GPIO_TypeDef * GPIOx,uint16_t GPIO_Pin)259 uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
260 {
261 uint8_t bitstatus = 0x00;
262
263 /* Check the parameters */
264 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
265 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
266
267 if ((GPIOx->IDR & GPIO_Pin) != (uint32_t)Bit_RESET)
268 {
269 bitstatus = (uint8_t)Bit_SET;
270 }
271 else
272 {
273 bitstatus = (uint8_t)Bit_RESET;
274 }
275 return bitstatus;
276 }
277
278 /**
279 * @brief Reads the specified GPIO input data port.
280 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
281 * @retval : GPIO input data port value.
282 */
GPIO_ReadInputData(GPIO_TypeDef * GPIOx)283 uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx)
284 {
285 /* Check the parameters */
286 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
287
288 return ((uint16_t)GPIOx->IDR);
289 }
290
291 /**
292 * @brief Reads the specified output data port bit.
293 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
294 * @param GPIO_Pin: specifies the port bit to read.
295 * This parameter can be GPIO_Pin_x where x can be (0..15).
296 * @retval : The output port pin value.
297 */
GPIO_ReadOutputDataBit(GPIO_TypeDef * GPIOx,uint16_t GPIO_Pin)298 uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
299 {
300 uint8_t bitstatus = 0x00;
301 /* Check the parameters */
302 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
303 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
304
305 if ((GPIOx->ODR & GPIO_Pin) != (uint32_t)Bit_RESET)
306 {
307 bitstatus = (uint8_t)Bit_SET;
308 }
309 else
310 {
311 bitstatus = (uint8_t)Bit_RESET;
312 }
313 return bitstatus;
314 }
315
316 /**
317 * @brief Reads the specified GPIO output data port.
318 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
319 * @retval : GPIO output data port value.
320 */
GPIO_ReadOutputData(GPIO_TypeDef * GPIOx)321 uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)
322 {
323 /* Check the parameters */
324 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
325
326 return ((uint16_t)GPIOx->ODR);
327 }
328
329 /**
330 * @brief Sets the selected data port bits.
331 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
332 * @param GPIO_Pin: specifies the port bits to be written.
333 * This parameter can be any combination of GPIO_Pin_x where
334 * x can be (0..15).
335 * @retval : None
336 */
GPIO_SetBits(GPIO_TypeDef * GPIOx,uint16_t GPIO_Pin)337 void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
338 {
339 /* Check the parameters */
340 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
341 assert_param(IS_GPIO_PIN(GPIO_Pin));
342
343 GPIOx->BSRR = GPIO_Pin;
344 }
345
346 /**
347 * @brief Clears the selected data port bits.
348 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
349 * @param GPIO_Pin: specifies the port bits to be written.
350 * This parameter can be any combination of GPIO_Pin_x where
351 * x can be (0..15).
352 * @retval : None
353 */
GPIO_ResetBits(GPIO_TypeDef * GPIOx,uint16_t GPIO_Pin)354 void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
355 {
356 /* Check the parameters */
357 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
358 assert_param(IS_GPIO_PIN(GPIO_Pin));
359
360 GPIOx->BRR = GPIO_Pin;
361 }
362
363 /**
364 * @brief Sets or clears the selected data port bit.
365 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
366 * @param GPIO_Pin: specifies the port bit to be written.
367 * This parameter can be one of GPIO_Pin_x where x can be (0..15).
368 * @param BitVal: specifies the value to be written to the selected bit.
369 * This parameter can be one of the BitAction enum values:
370 * @arg Bit_RESET: to clear the port pin
371 * @arg Bit_SET: to set the port pin
372 * @retval : None
373 */
GPIO_WriteBit(GPIO_TypeDef * GPIOx,uint16_t GPIO_Pin,BitAction BitVal)374 void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
375 {
376 /* Check the parameters */
377 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
378 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
379 assert_param(IS_GPIO_BIT_ACTION(BitVal));
380
381 if (BitVal != Bit_RESET)
382 {
383 GPIOx->BSRR = GPIO_Pin;
384 }
385 else
386 {
387 GPIOx->BRR = GPIO_Pin;
388 }
389 }
390
391 /**
392 * @brief Writes data to the specified GPIO data port.
393 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
394 * @param PortVal: specifies the value to be written to the port output
395 * data register.
396 * @retval : None
397 */
GPIO_Write(GPIO_TypeDef * GPIOx,uint16_t PortVal)398 void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal)
399 {
400 /* Check the parameters */
401 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
402
403 GPIOx->ODR = PortVal;
404 }
405
406 /**
407 * @brief Locks GPIO Pins configuration registers.
408 * @param GPIOx: where x can be (A..G) to select the GPIO peripheral.
409 * @param GPIO_Pin: specifies the port bit to be written.
410 * This parameter can be any combination of GPIO_Pin_x where
411 * x can be (0..15).
412 * @retval : None
413 */
GPIO_PinLockConfig(GPIO_TypeDef * GPIOx,uint16_t GPIO_Pin)414 void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
415 {
416 uint32_t tmp = 0x00010000;
417
418 /* Check the parameters */
419 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
420 assert_param(IS_GPIO_PIN(GPIO_Pin));
421
422 tmp |= GPIO_Pin;
423 /* Set LCKK bit */
424 GPIOx->LCKR = tmp;
425 /* Reset LCKK bit */
426 GPIOx->LCKR = GPIO_Pin;
427 /* Set LCKK bit */
428 GPIOx->LCKR = tmp;
429 /* Read LCKK bit*/
430 tmp = GPIOx->LCKR;
431 /* Read LCKK bit*/
432 tmp = GPIOx->LCKR;
433 }
434
435 /**
436 * @brief Selects the GPIO pin used as Event output.
437 * @param GPIO_PortSource: selects the GPIO port to be used as source
438 * for Event output.
439 * This parameter can be GPIO_PortSourceGPIOx where x can be
440 * (A..E).
441 * @param GPIO_PinSource: specifies the pin for the Event output.
442 * This parameter can be GPIO_PinSourcex where x can be (0..15).
443 * @retval : None
444 */
GPIO_EventOutputConfig(uint8_t GPIO_PortSource,uint8_t GPIO_PinSource)445 void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
446 {
447 uint32_t tmpreg = 0x00;
448 /* Check the parameters */
449 assert_param(IS_GPIO_EVENTOUT_PORT_SOURCE(GPIO_PortSource));
450 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
451
452 tmpreg = AFIO->EVCR;
453 /* Clear the PORT[6:4] and PIN[3:0] bits */
454 tmpreg &= EVCR_PORTPINCONFIG_MASK;
455 tmpreg |= (uint32_t)GPIO_PortSource << 0x04;
456 tmpreg |= GPIO_PinSource;
457 AFIO->EVCR = tmpreg;
458 }
459
460 /**
461 * @brief Enables or disables the Event Output.
462 * @param NewState: new state of the Event output.
463 * This parameter can be: ENABLE or DISABLE.
464 * @retval : None
465 */
GPIO_EventOutputCmd(FunctionalState NewState)466 void GPIO_EventOutputCmd(FunctionalState NewState)
467 {
468 /* Check the parameters */
469 assert_param(IS_FUNCTIONAL_STATE(NewState));
470
471 *(__IO uint32_t *) EVCR_EVOE_BB = (uint32_t)NewState;
472 }
473
474 /**
475 * @brief Changes the mapping of the specified pin.
476 * @param GPIO_Remap: selects the pin to remap.
477 * This parameter can be one of the following values:
478 * @arg GPIO_Remap_SPI1
479 * @arg GPIO_Remap_I2C1
480 * @arg GPIO_Remap_UART1
481 * @arg GPIO_Remap_UART2
482 * @arg GPIO_PartialRemap_UART3
483 * @arg GPIO_FullRemap_UART3
484 * @arg GPIO_PartialRemap_TIM1
485 * @arg GPIO_FullRemap_TIM1
486 * @arg GPIO_PartialRemap1_TIM2
487 * @arg GPIO_PartialRemap2_TIM2
488 * @arg GPIO_FullRemap_TIM2
489 * @arg GPIO_PartialRemap_TIM3
490 * @arg GPIO_FullRemap_TIM3
491 * @arg GPIO_Remap_TIM4
492 * @arg GPIO_Remap1_CAN1
493 * @arg GPIO_Remap2_CAN1
494 * @arg GPIO_Remap_PD01
495 * @arg GPIO_Remap_TIM5CH4_LSI
496 * @arg GPIO_Remap_ADC1_ETRGINJ
497 * @arg GPIO_Remap_ADC1_ETRGREG
498 * @arg GPIO_Remap_ADC2_ETRGINJ
499 * @arg GPIO_Remap_ADC2_ETRGREG
500 * @arg GPIO_Remap_SWJ_NoJTRST
501 * @arg GPIO_Remap_SWJ_JTAGDisable
502 * @arg GPIO_Remap_SWJ_Disable
503 * @param NewState: new state of the port pin remapping.
504 * This parameter can be: ENABLE or DISABLE.
505 * @retval : None
506 */
GPIO_PinRemapConfig(uint32_t GPIO_Remap,FunctionalState NewState)507 void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState)
508 {
509 uint32_t tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00;
510 /* Check the parameters */
511 assert_param(IS_GPIO_REMAP(GPIO_Remap));
512 assert_param(IS_FUNCTIONAL_STATE(NewState));
513
514 tmpreg = AFIO->MAPR;
515 tmpmask = (GPIO_Remap & DBGAFR_POSITION_MASK) >> 0x10;
516 tmp = GPIO_Remap & LSB_MASK;
517 if ((GPIO_Remap & (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK)) == (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK))
518 {
519 tmpreg &= DBGAFR_SWJCFG_MASK;
520 AFIO->MAPR &= DBGAFR_SWJCFG_MASK;
521 }
522 else if ((GPIO_Remap & DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK)
523 {
524 tmp1 = ((uint32_t)0x03) << tmpmask;
525 tmpreg &= ~tmp1;
526 tmpreg |= ~DBGAFR_SWJCFG_MASK;
527 }
528 else
529 {
530 tmpreg &= ~(tmp << ((GPIO_Remap >> 0x15)*0x10));
531 tmpreg |= ~DBGAFR_SWJCFG_MASK;
532 }
533 if (NewState != DISABLE)
534 {
535 tmpreg |= (tmp << ((GPIO_Remap >> 0x15)*0x10));
536 }
537 AFIO->MAPR = tmpreg;
538 }
539
540 /**
541 * @brief Selects the GPIO pin used as EXTI Line.
542 * @param GPIO_PortSource: selects the GPIO port to be used as
543 * source for EXTI lines.
544 * This parameter can be GPIO_PortSourceGPIOx where x can be
545 * (A..G).
546 * @param GPIO_PinSource: specifies the EXTI line to be configured.
547 * This parameter can be GPIO_PinSourcex where x can be (0..15).
548 * @retval : None
549 */
GPIO_EXTILineConfig(uint8_t GPIO_PortSource,uint8_t GPIO_PinSource)550 void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
551 {
552 uint32_t tmp = 0x00;
553 /* Check the parameters */
554 assert_param(IS_GPIO_EXTI_PORT_SOURCE(GPIO_PortSource));
555 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
556
557 tmp = ((uint32_t)0x0F) << (0x04 * (GPIO_PinSource & (uint8_t)0x03));
558 AFIO->EXTICR[GPIO_PinSource >> 0x02] &= ~tmp;
559 AFIO->EXTICR[GPIO_PinSource >> 0x02] |= (((uint32_t)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (uint8_t)0x03)));
560 }
561
562 /**
563 * @}
564 */
565
566 /**
567 * @}
568 */
569
570 /**
571 * @}
572 */
573
574 /*-------------------------(C) COPYRIGHT 2017 MindMotion ----------------------*/
575