1 2 Previous Next 19 Replies Latest reply on Oct 26, 2016 3:04 PM by Intel Corporation

    MRAA Library falling edge interrupt not proper work.

    Nikunj_Patel

      Hello everyone;

       

      I made the one application based on switch . I want to configure switch as gpio_interrupt.

      I had configure the IO4 as a interrupt for switch.

       

      Below is my code.

       

       

      #include <mraa.h>

      #include <mraa/gpio.h>

       

      char counter = 0;

       

      void intrHandler(void *arg)

      {

          counter++;

      //    printf("C = %d\n",counter);

      }

       

       

      int main()

      {

          mraa_init();

       

          mraa_gpio_context m_gpio;

       

          m_gpio = mraa_gpio_init(4);

         

          mraa_gpio_dir(m_gpio, MRAA_GPIO_IN);

          

          mraa_gpio_mode(m_gpio,MRAA_GPIO_PULLUP);

       

          mraa_gpio_isr(m_gpio, MRAA_GPIO_EDGE_FALLING, intrHandler, NULL);

       

          sleep (20);

       

          printf("outer_counter = %d\n",counter);

       

          mraa_gpio_isr_exit(m_gpio);

       

          mraa_gpio_close(m_gpio);

       

          return 0;

      }

       

       

      I had check program with "MRAA_GPIO_EDGE_RISING" EDGE and its run fine and i get the 100% proper result.

       

      but I had check program with "MRAA_GPIO_EDGE_FALLING" EDGE, it is run but result is not proper means the key press for single time and interrupt isr will call two time or random. its behaviour is random.

       

      Please help me to solve my problem.

       

      Thanks & Best Regards;

      Nikunj Patel

        1 2 Previous Next