1 2 Previous Next 15 Replies Latest reply on Aug 28, 2015 3:56 AM by semc_2183856

    Help setting up interrupt on GPIO

      Hi,

       

      I was wandering if anyone could help me set up an interrupt on one of the GPIO pins, I've tried my self by following the hardware interface guide and i can't see where I've gone wrong. this is the code I've added to try and set this up. Whenever I try to compile i get to few arguments to function gpio_registerForInterrupt. Thanks

       

      #define dial GPIO_PIN_P15


      gpio_configurePin(0,dial,GPIO_EN_INT_RISING_EDGE|GPIO_PULL_DOWN,GPIO_PIN_INPUT_HIGH);


      void hello_sensor_create(void)

      {

       


         //each bit corresponds to a port for port 0 - 3

           UINT16 interrupt_handler_mask[3] = {0,0,0};

           //0 is the port with pin 15

           interrupt_handler_mask[0] |= (1 << dial);

           //register interrupt handler

           gpio_registerForInterrupt(interrupt_handler_mask,interrupt_gpio,NULL);


      }

      void interrupt_gpio(void*){


        if(led_on == FALSE){

                       gpio_setPinOutput(0,LED,GPIO_PIN_OUTPUT_HIGH);

                       gpio_setPinOutput(0,RGB,GPIO_PIN_OUTPUT_HIGH);

                       led_on = TRUE;

                       }else{

                         gpio_setPinOutput(0,LED,GPIO_PIN_OUTPUT_LOW);

                         gpio_setPinOutput(0,RGB,GPIO_PIN_OUTPUT_LOW);

                         led_on = FALSE;

                       }

      }



        1 2 Previous Next