AnsweredAssumed Answered

2 lwgpio interrupt handlers for 2 different pins

Question asked by albert calpito on Jun 7, 2013
Latest reply on Aug 13, 2014 by Kyle Yang

I've been trying to initialize 2 separate gpio pins to have 2 separate interrupt handlers, however they seem to only be linked to the 2nd handler i initialize.  Is there some hardware restriction I am missing where 2 pins of the same port must share 1 interrupt hander?  I am seeing that although they are different pins, that the lwgpio_int_get_vector function is returning the same value for both.

 

LWGPIO_STRUCT column_1;

LWGPIO_STRUCT column_2;

 

 

 

lwgpio_init(&column_1, (GPIO_PORT_B | GPIO_PIN17), LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE);
lwgpio_set_functionality(&column_1, 1);
lwgpio_set_attribute(&column_1, LWGPIO_ATTR_PULL_DOWN, LWGPIO_AVAL_ENABLE);
lwgpio_int_init(&column_1, LWGPIO_INT_MODE_RISING);
_int_install_isr(lwgpio_int_get_vector(&column_1), column_1_button_pressed_function, (void *) &column_1);
_bsp_int_init(lwgpio_int_get_vector(&column_1), 3, 0, TRUE);
lwgpio_int_enable(&column_1, TRUE);

 

lwgpio_init(&column_2, (GPIO_PORT_B | GPIO_PIN18), LWGPIO_DIR_INPUT, LWGPIO_VALUE_NOCHANGE);
lwgpio_set_functionality(&column_2, 1);
lwgpio_set_attribute(&column_2, LWGPIO_ATTR_PULL_DOWN, LWGPIO_AVAL_ENABLE);
lwgpio_int_init(&column_2, LWGPIO_INT_MODE_RISING);
_int_install_isr(lwgpio_int_get_vector(&column_2), column_2_button_pressed_function, (void *) &column_2);
_bsp_int_init(lwgpio_int_get_vector(&column_2), 3, 0, TRUE);
lwgpio_int_enable(&column_2, TRUE);

 


vector_value = lwgpio_int_get_vector(&column_1);
vector_value = lwgpio_int_get_vector(&column_2);

 

 

 

 

void column_1_button_pressed_function(void *pin)
{
  printf("1\r\n");
  lwgpio_int_clear_flag((LWGPIO_STRUCT_PTR) pin);
}

void column_2_button_pressed_function(void *pin)
{
  printf("2\r\n");
  lwgpio_int_clear_flag((LWGPIO_STRUCT_PTR) pin);
}

 

 

 

 

 

 


Outcomes