1 /******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
\r
2 * File Name : stm32f10x_gpio.c
\r
3 * Author : MCD Application Team
\r
6 * Description : This file provides all the GPIO firmware functions.
\r
7 ********************************************************************************
\r
8 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
\r
9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
\r
10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
\r
11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
\r
12 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
\r
13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
\r
14 *******************************************************************************/
\r
16 /* Includes ------------------------------------------------------------------*/
\r
17 #include "stm32f10x_gpio.h"
\r
18 #include "stm32f10x_rcc.h"
\r
20 /* Private typedef -----------------------------------------------------------*/
\r
21 /* Private define ------------------------------------------------------------*/
\r
22 /* ------------ RCC registers bit address in the alias region ----------- */
\r
23 #define AFIO_OFFSET (AFIO_BASE - PERIPH_BASE)
\r
25 /* --- EVENTCR Register ---*/
\r
26 /* Alias word address of EVOE bit */
\r
27 #define EVCR_OFFSET (AFIO_OFFSET + 0x00)
\r
28 #define EVOE_BitNumber ((u8)0x07)
\r
29 #define EVCR_EVOE_BB (PERIPH_BB_BASE + (EVCR_OFFSET * 32) + (EVOE_BitNumber * 4))
\r
31 #define EVCR_PORTPINCONFIG_MASK ((u16)0xFF80)
\r
32 #define LSB_MASK ((u16)0xFFFF)
\r
33 #define DBGAFR_POSITION_MASK ((u32)0x000F0000)
\r
34 #define DBGAFR_SWJCFG_MASK ((u32)0xF0FFFFFF)
\r
35 #define DBGAFR_LOCATION_MASK ((u32)0x00200000)
\r
36 #define DBGAFR_NUMBITS_MASK ((u32)0x00100000)
\r
38 /* Private macro -------------------------------------------------------------*/
\r
39 /* Private variables ---------------------------------------------------------*/
\r
40 /* Private function prototypes -----------------------------------------------*/
\r
41 /* Private functions ---------------------------------------------------------*/
\r
43 /*******************************************************************************
\r
44 * Function Name : GPIO_DeInit
\r
45 * Description : Deinitializes the GPIOx peripheral registers to their default
\r
47 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
50 *******************************************************************************/
\r
51 void GPIO_DeInit(GPIO_TypeDef* GPIOx)
\r
53 /* Check the parameters */
\r
54 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
56 switch (*(u32*)&GPIOx)
\r
59 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, ENABLE);
\r
60 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOA, DISABLE);
\r
64 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, ENABLE);
\r
65 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOB, DISABLE);
\r
69 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, ENABLE);
\r
70 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOC, DISABLE);
\r
74 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, ENABLE);
\r
75 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOD, DISABLE);
\r
79 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOE, ENABLE);
\r
80 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOE, DISABLE);
\r
84 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOF, ENABLE);
\r
85 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOF, DISABLE);
\r
89 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOG, ENABLE);
\r
90 RCC_APB2PeriphResetCmd(RCC_APB2Periph_GPIOG, DISABLE);
\r
98 /*******************************************************************************
\r
99 * Function Name : GPIO_AFIODeInit
\r
100 * Description : Deinitializes the Alternate Functions (remap, event control
\r
101 * and EXTI configuration) registers to their default reset
\r
106 *******************************************************************************/
\r
107 void GPIO_AFIODeInit(void)
\r
109 RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, ENABLE);
\r
110 RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO, DISABLE);
\r
113 /*******************************************************************************
\r
114 * Function Name : GPIO_Init
\r
115 * Description : Initializes the GPIOx peripheral according to the specified
\r
116 * parameters in the GPIO_InitStruct.
\r
117 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
118 * - GPIO_InitStruct: pointer to a GPIO_InitTypeDef structure that
\r
119 * contains the configuration information for the specified GPIO
\r
123 *******************************************************************************/
\r
124 void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
\r
126 u32 currentmode = 0x00, currentpin = 0x00, pinpos = 0x00, pos = 0x00;
\r
127 u32 tmpreg = 0x00, pinmask = 0x00;
\r
129 /* Check the parameters */
\r
130 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
131 assert_param(IS_GPIO_MODE(GPIO_InitStruct->GPIO_Mode));
\r
132 assert_param(IS_GPIO_PIN(GPIO_InitStruct->GPIO_Pin));
\r
134 /*---------------------------- GPIO Mode Configuration -----------------------*/
\r
135 currentmode = ((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x0F);
\r
137 if ((((u32)GPIO_InitStruct->GPIO_Mode) & ((u32)0x10)) != 0x00)
\r
139 /* Check the parameters */
\r
140 assert_param(IS_GPIO_SPEED(GPIO_InitStruct->GPIO_Speed));
\r
142 currentmode |= (u32)GPIO_InitStruct->GPIO_Speed;
\r
145 /*---------------------------- GPIO CRL Configuration ------------------------*/
\r
146 /* Configure the eight low port pins */
\r
147 if (((u32)GPIO_InitStruct->GPIO_Pin & ((u32)0x00FF)) != 0x00)
\r
149 tmpreg = GPIOx->CRL;
\r
151 for (pinpos = 0x00; pinpos < 0x08; pinpos++)
\r
153 pos = ((u32)0x01) << pinpos;
\r
154 /* Get the port pins position */
\r
155 currentpin = (GPIO_InitStruct->GPIO_Pin) & pos;
\r
157 if (currentpin == pos)
\r
160 /* Clear the corresponding low control register bits */
\r
161 pinmask = ((u32)0x0F) << pos;
\r
162 tmpreg &= ~pinmask;
\r
164 /* Write the mode configuration in the corresponding bits */
\r
165 tmpreg |= (currentmode << pos);
\r
167 /* Reset the corresponding ODR bit */
\r
168 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
\r
170 GPIOx->BRR = (((u32)0x01) << pinpos);
\r
172 /* Set the corresponding ODR bit */
\r
173 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
\r
175 GPIOx->BSRR = (((u32)0x01) << pinpos);
\r
179 GPIOx->CRL = tmpreg;
\r
182 /*---------------------------- GPIO CRH Configuration ------------------------*/
\r
183 /* Configure the eight high port pins */
\r
184 if (GPIO_InitStruct->GPIO_Pin > 0x00FF)
\r
186 tmpreg = GPIOx->CRH;
\r
187 for (pinpos = 0x00; pinpos < 0x08; pinpos++)
\r
189 pos = (((u32)0x01) << (pinpos + 0x08));
\r
190 /* Get the port pins position */
\r
191 currentpin = ((GPIO_InitStruct->GPIO_Pin) & pos);
\r
192 if (currentpin == pos)
\r
195 /* Clear the corresponding high control register bits */
\r
196 pinmask = ((u32)0x0F) << pos;
\r
197 tmpreg &= ~pinmask;
\r
199 /* Write the mode configuration in the corresponding bits */
\r
200 tmpreg |= (currentmode << pos);
\r
202 /* Reset the corresponding ODR bit */
\r
203 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPD)
\r
205 GPIOx->BRR = (((u32)0x01) << (pinpos + 0x08));
\r
207 /* Set the corresponding ODR bit */
\r
208 if (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_IPU)
\r
210 GPIOx->BSRR = (((u32)0x01) << (pinpos + 0x08));
\r
214 GPIOx->CRH = tmpreg;
\r
218 /*******************************************************************************
\r
219 * Function Name : GPIO_StructInit
\r
220 * Description : Fills each GPIO_InitStruct member with its default value.
\r
221 * Input : - GPIO_InitStruct : pointer to a GPIO_InitTypeDef structure
\r
222 * which will be initialized.
\r
225 *******************************************************************************/
\r
226 void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
\r
228 /* Reset GPIO init structure parameters values */
\r
229 GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
\r
230 GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;
\r
231 GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN_FLOATING;
\r
234 /*******************************************************************************
\r
235 * Function Name : GPIO_ReadInputDataBit
\r
236 * Description : Reads the specified input port pin.
\r
237 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
238 * : - GPIO_Pin: specifies the port bit to read.
\r
239 * This parameter can be GPIO_Pin_x where x can be (0..15).
\r
241 * Return : The input port pin value.
\r
242 *******************************************************************************/
\r
243 u8 GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
\r
245 u8 bitstatus = 0x00;
\r
247 /* Check the parameters */
\r
248 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
249 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
\r
251 if ((GPIOx->IDR & GPIO_Pin) != (u32)Bit_RESET)
\r
253 bitstatus = (u8)Bit_SET;
\r
257 bitstatus = (u8)Bit_RESET;
\r
262 /*******************************************************************************
\r
263 * Function Name : GPIO_ReadInputData
\r
264 * Description : Reads the specified GPIO input data port.
\r
265 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
267 * Return : GPIO input data port value.
\r
268 *******************************************************************************/
\r
269 u16 GPIO_ReadInputData(GPIO_TypeDef* GPIOx)
\r
271 /* Check the parameters */
\r
272 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
274 return ((u16)GPIOx->IDR);
\r
277 /*******************************************************************************
\r
278 * Function Name : GPIO_ReadOutputDataBit
\r
279 * Description : Reads the specified output data port bit.
\r
280 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
281 * : - GPIO_Pin: specifies the port bit to read.
\r
282 * This parameter can be GPIO_Pin_x where x can be (0..15).
\r
284 * Return : The output port pin value.
\r
285 *******************************************************************************/
\r
286 u8 GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
\r
288 u8 bitstatus = 0x00;
\r
290 /* Check the parameters */
\r
291 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
292 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
\r
294 if ((GPIOx->ODR & GPIO_Pin) != (u32)Bit_RESET)
\r
296 bitstatus = (u8)Bit_SET;
\r
300 bitstatus = (u8)Bit_RESET;
\r
305 /*******************************************************************************
\r
306 * Function Name : GPIO_ReadOutputData
\r
307 * Description : Reads the specified GPIO output data port.
\r
308 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
310 * Return : GPIO output data port value.
\r
311 *******************************************************************************/
\r
312 u16 GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)
\r
314 /* Check the parameters */
\r
315 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
317 return ((u16)GPIOx->ODR);
\r
320 /*******************************************************************************
\r
321 * Function Name : GPIO_SetBits
\r
322 * Description : Sets the selected data port bits.
\r
323 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
324 * - GPIO_Pin: specifies the port bits to be written.
\r
325 * This parameter can be any combination of GPIO_Pin_x where
\r
326 * x can be (0..15).
\r
329 *******************************************************************************/
\r
330 void GPIO_SetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
\r
332 /* Check the parameters */
\r
333 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
334 assert_param(IS_GPIO_PIN(GPIO_Pin));
\r
336 GPIOx->BSRR = GPIO_Pin;
\r
339 /*******************************************************************************
\r
340 * Function Name : GPIO_ResetBits
\r
341 * Description : Clears the selected data port bits.
\r
342 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
343 * - GPIO_Pin: specifies the port bits to be written.
\r
344 * This parameter can be any combination of GPIO_Pin_x where
\r
345 * x can be (0..15).
\r
348 *******************************************************************************/
\r
349 void GPIO_ResetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
\r
351 /* Check the parameters */
\r
352 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
353 assert_param(IS_GPIO_PIN(GPIO_Pin));
\r
355 GPIOx->BRR = GPIO_Pin;
\r
358 /*******************************************************************************
\r
359 * Function Name : GPIO_WriteBit
\r
360 * Description : Sets or clears the selected data port bit.
\r
361 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
362 * - GPIO_Pin: specifies the port bit to be written.
\r
363 * This parameter can be one of GPIO_Pin_x where x can be (0..15).
\r
364 * - BitVal: specifies the value to be written to the selected bit.
\r
365 * This parameter can be one of the BitAction enum values:
\r
366 * - Bit_RESET: to clear the port pin
\r
367 * - Bit_SET: to set the port pin
\r
370 *******************************************************************************/
\r
371 void GPIO_WriteBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin, BitAction BitVal)
\r
373 /* Check the parameters */
\r
374 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
375 assert_param(IS_GET_GPIO_PIN(GPIO_Pin));
\r
376 assert_param(IS_GPIO_BIT_ACTION(BitVal));
\r
378 if (BitVal != Bit_RESET)
\r
380 GPIOx->BSRR = GPIO_Pin;
\r
384 GPIOx->BRR = GPIO_Pin;
\r
388 /*******************************************************************************
\r
389 * Function Name : GPIO_Write
\r
390 * Description : Writes data to the specified GPIO data port.
\r
391 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
392 * - PortVal: specifies the value to be written to the port output
\r
396 *******************************************************************************/
\r
397 void GPIO_Write(GPIO_TypeDef* GPIOx, u16 PortVal)
\r
399 /* Check the parameters */
\r
400 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
402 GPIOx->ODR = PortVal;
\r
405 /*******************************************************************************
\r
406 * Function Name : GPIO_PinLockConfig
\r
407 * Description : Locks GPIO Pins configuration registers.
\r
408 * Input : - GPIOx: where x can be (A..G) to select the GPIO peripheral.
\r
409 * - GPIO_Pin: specifies the port bit to be written.
\r
410 * This parameter can be any combination of GPIO_Pin_x where
\r
411 * x can be (0..15).
\r
414 *******************************************************************************/
\r
415 void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, u16 GPIO_Pin)
\r
417 u32 tmp = 0x00010000;
\r
419 /* Check the parameters */
\r
420 assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
\r
421 assert_param(IS_GPIO_PIN(GPIO_Pin));
\r
426 /* Reset LCKK bit */
\r
427 GPIOx->LCKR = GPIO_Pin;
\r
436 /*******************************************************************************
\r
437 * Function Name : GPIO_EventOutputConfig
\r
438 * Description : Selects the GPIO pin used as Event output.
\r
439 * Input : - GPIO_PortSource: selects the GPIO port to be used as source
\r
440 * for Event output.
\r
441 * This parameter can be GPIO_PortSourceGPIOx where x can be
\r
443 * - GPIO_PinSource: specifies the pin for the Event output.
\r
444 * This parameter can be GPIO_PinSourcex where x can be (0..15).
\r
447 *******************************************************************************/
\r
448 void GPIO_EventOutputConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)
\r
452 /* Check the parameters */
\r
453 assert_param(IS_GPIO_EVENTOUT_PORT_SOURCE(GPIO_PortSource));
\r
454 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
\r
456 tmpreg = AFIO->EVCR;
\r
457 /* Clear the PORT[6:4] and PIN[3:0] bits */
\r
458 tmpreg &= EVCR_PORTPINCONFIG_MASK;
\r
459 tmpreg |= (u32)GPIO_PortSource << 0x04;
\r
460 tmpreg |= GPIO_PinSource;
\r
462 AFIO->EVCR = tmpreg;
\r
465 /*******************************************************************************
\r
466 * Function Name : GPIO_EventOutputCmd
\r
467 * Description : Enables or disables the Event Output.
\r
468 * Input : - NewState: new state of the Event output.
\r
469 * This parameter can be: ENABLE or DISABLE.
\r
472 *******************************************************************************/
\r
473 void GPIO_EventOutputCmd(FunctionalState NewState)
\r
475 /* Check the parameters */
\r
476 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
478 *(vu32 *) EVCR_EVOE_BB = (u32)NewState;
\r
481 /*******************************************************************************
\r
482 * Function Name : GPIO_PinRemapConfig
\r
483 * Description : Changes the mapping of the specified pin.
\r
484 * Input : - GPIO_Remap: selects the pin to remap.
\r
485 * This parameter can be one of the following values:
\r
486 * - GPIO_Remap_SPI1
\r
487 * - GPIO_Remap_I2C1
\r
488 * - GPIO_Remap_USART1
\r
489 * - GPIO_Remap_USART2
\r
490 * - GPIO_PartialRemap_USART3
\r
491 * - GPIO_FullRemap_USART3
\r
492 * - GPIO_PartialRemap_TIM1
\r
493 * - GPIO_FullRemap_TIM1
\r
494 * - GPIO_PartialRemap1_TIM2
\r
495 * - GPIO_PartialRemap2_TIM2
\r
496 * - GPIO_FullRemap_TIM2
\r
497 * - GPIO_PartialRemap_TIM3
\r
498 * - GPIO_FullRemap_TIM3
\r
499 * - GPIO_Remap_TIM4
\r
500 * - GPIO_Remap1_CAN
\r
501 * - GPIO_Remap2_CAN
\r
502 * - GPIO_Remap_PD01
\r
503 * - GPIO_Remap_TIM5CH4_LSI
\r
504 * - GPIO_Remap_ADC1_ETRGINJ
\r
505 * - GPIO_Remap_ADC1_ETRGREG
\r
506 * - GPIO_Remap_ADC2_ETRGINJ
\r
507 * - GPIO_Remap_ADC2_ETRGREG
\r
508 * - GPIO_Remap_SWJ_NoJTRST
\r
509 * - GPIO_Remap_SWJ_JTAGDisable
\r
510 * - GPIO_Remap_SWJ_Disable
\r
511 * - NewState: new state of the port pin remapping.
\r
512 * This parameter can be: ENABLE or DISABLE.
\r
515 *******************************************************************************/
\r
516 void GPIO_PinRemapConfig(u32 GPIO_Remap, FunctionalState NewState)
\r
518 u32 tmp = 0x00, tmp1 = 0x00, tmpreg = 0x00, tmpmask = 0x00;
\r
520 /* Check the parameters */
\r
521 assert_param(IS_GPIO_REMAP(GPIO_Remap));
\r
522 assert_param(IS_FUNCTIONAL_STATE(NewState));
\r
524 tmpreg = AFIO->MAPR;
\r
526 tmpmask = (GPIO_Remap & DBGAFR_POSITION_MASK) >> 0x10;
\r
527 tmp = GPIO_Remap & LSB_MASK;
\r
529 if ((GPIO_Remap & (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK)) == (DBGAFR_LOCATION_MASK | DBGAFR_NUMBITS_MASK))
\r
531 tmpreg &= DBGAFR_SWJCFG_MASK;
\r
532 AFIO->MAPR &= DBGAFR_SWJCFG_MASK;
\r
534 else if ((GPIO_Remap & DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK)
\r
536 tmp1 = ((u32)0x03) << tmpmask;
\r
538 tmpreg |= ~DBGAFR_SWJCFG_MASK;
\r
542 tmpreg &= ~(tmp << ((GPIO_Remap >> 0x15)*0x10));
\r
543 tmpreg |= ~DBGAFR_SWJCFG_MASK;
\r
546 if (NewState != DISABLE)
\r
548 tmpreg |= (tmp << ((GPIO_Remap >> 0x15)*0x10));
\r
551 AFIO->MAPR = tmpreg;
\r
554 /*******************************************************************************
\r
555 * Function Name : GPIO_EXTILineConfig
\r
556 * Description : Selects the GPIO pin used as EXTI Line.
\r
557 * Input : - GPIO_PortSource: selects the GPIO port to be used as
\r
558 * source for EXTI lines.
\r
559 * This parameter can be GPIO_PortSourceGPIOx where x can be
\r
561 * - GPIO_PinSource: specifies the EXTI line to be configured.
\r
562 * This parameter can be GPIO_PinSourcex where x can be (0..15).
\r
565 *******************************************************************************/
\r
566 void GPIO_EXTILineConfig(u8 GPIO_PortSource, u8 GPIO_PinSource)
\r
570 /* Check the parameters */
\r
571 assert_param(IS_GPIO_EXTI_PORT_SOURCE(GPIO_PortSource));
\r
572 assert_param(IS_GPIO_PIN_SOURCE(GPIO_PinSource));
\r
574 tmp = ((u32)0x0F) << (0x04 * (GPIO_PinSource & (u8)0x03));
\r
576 AFIO->EXTICR[GPIO_PinSource >> 0x02] &= ~tmp;
\r
577 AFIO->EXTICR[GPIO_PinSource >> 0x02] |= (((u32)GPIO_PortSource) << (0x04 * (GPIO_PinSource & (u8)0x03)));
\r
580 /******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
\r