AnsweredAssumed Answered

GPIOB_pin12 connecting to interrupt line

Question asked by Kilohercas on Jul 23, 2012
Latest reply on Jul 18, 2013 by Clive Two.Zero
hello, i am trying to make interrupt based touchscreen program, but have no luck connecting
GPIOB_pin12 to interrupt line
i was able to do so in GPIOA_pin1, but still cant figureout how to do that on GPIOB port
void touch_init(void)
{  
  GPIO_InitTypeDef   GPIO_InitStructure;
  EXTI_InitTypeDef   EXTI_InitStructure;
  NVIC_InitTypeDef   NVIC_InitStructure;
 
  SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource12);
 RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOB);
  //T_PEN
  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
  GPIO_Init(GPIOB, &GPIO_InitStructure);
 
  EXTI_InitStructure.EXTI_Line = EXTI_Line12;
  EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
  EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; 
  EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  EXTI_Init(&EXTI_InitStructure);
 
  NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;
  NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
  NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
  NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
  NVIC_Init(&NVIC_InitStructure);
}
and interrupt itself in stm32f4_it.c file:
 
void EXTI4_IRQHandler(void)
{
  if(EXTI_GetITStatus(EXTI_Line12) != RESET)
  {
    LCD_Clear(RED);
    Delay(0xFFFFFF);
    EXTI_ClearITPendingBit(EXTI_Line12);
  }
}
i should get interrupt on falling edge, when i touch touchscreen Pen_IRQ (PORTB leg 12) goes low, i double-checked that

Outcomes