1 Reply Latest reply on Feb 8, 2017 12:27 PM by Intel Corporation

    MCU api - gpio interrupt mode falling AND rising edge ?

    toukytrip

      Hi

       

      From the doc found at MCU API | Intel® Software :

      int gpio_register_interrupt(int gpio, int mode, irq_handler_t isr);

      where mode: 0 = falling edge interrupt, 1 = rising edge interrupt

       

      I just wonder if i can make interrupt for both falling and rising edge .

       

      i try to call :

      gpio_register_interrupt(my_pin, 0, my_isr);

      then

      gpio_register_interrupt(my_pin, 1, my_isr);

      which give me error when debuggin /dev/ttymcu1;

       

      but when i try :

      gpio_register_interrupt(my_pin, 2, my_isr);

      no error raised...

       

      just to be sure if there was not some mistake in the api documentation because it seems that mcu_snprintf

      is bad documented:

       

      from the doc, we can see that the declaration tell us that there is NO RETURN ( cause the void) and later, 'return value, number of chars ....' , in the 'mcu_api.h' header file this return an interger  :

       

      mcu_snprintf

      A simplified version of snprintf.

      void mcu_snprintf(char *buf, unsigned int size, const char *fmt, ...)

      ...where:

      • buf: the buffer point to contain the data
      • size: size of buffer
      • fmt: format string
      • return value: the number of characters that have been written

       

       

      thanks

       

       

      EDIT:

      just found this thread  Re: Multiple MCU interrupt handlers on single GPIO?

      which answer to my first question...

      so whats about the doc ?

        • 1. Re: MCU api - gpio interrupt mode falling AND rising edge ?
          Intel Corporation
          This message was posted on behalf of Intel Corporation

          Hi toukytrip,

           

          Thank you for contacting us and letting us know you found the solution to your fiest question. In regards to your second question, I looked at the mcu_snprintf function on the document you posted and at the mcu_api.h file. It appears that both documents say different things, as you pointed out. In https://software.intel.com/en-us/node/557355 , mcu_snprintf is declared as a void and in mcu_api.h, it is declared as an int, as you can see here:



          So, it appears that there’s a mismatch in the documentation. We’ll report this to the appropriate team so that the document can be modified.

           

          Let us know if there’s anything else we can assist you with.

           

          -Sergio