title: ESP 32 interrupt issue
body: <p>I'm using esp32 module and on which I am implementing interrupt functionality.
  So, basically whenever interrupt comes the led should glow and if not the led should be in the off state. Surprisingly, if I try the reverse that is "If interrupt come from a switch then led turns off and normally it is in turned on position " this works.</p>
  
  <p>Here's my code.:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;stdlib.h&gt;
  #include "freertos/FreeRTOS.h"
  #include "freertos/task.h"
  #include "freertos/queue.h"
  #include "driver/gpio.h"
  #define op 18
  #define ip 4
  #define OP_PIN_SEL 1ULL&lt;&lt;op
  #define IP_PIN_SEL 1ULL&lt;&lt;ip
  #define ESP_INTR_FLAG_DEFAULT 0
  static void gpio_isr_handler(void )
  {
          printf("Intrpt Act\n");
          gpio_set_level(op,0);
          vTaskDelay(1000/portTICK_PERIOD_MS);
          fflush(stdout);
  }
  void app_main()
  {
          gpio_config_t io_conf;
  //      io_conf=malloc(0);
          gpio_pad_select_gpio(op);
          gpio_pad_select_gpio(ip);
          gpio_set_direction (op,GPIO_MODE_OUTPUT);
          gpio_set_direction(ip,GPIO_MODE_INPUT);
  
          io_conf.intr_type=GPIO_PIN_INTR_ANYEDGE;
          io_conf.mode=GPIO_MODE_OUTPUT;
          io_conf.pin_bit_mask=OP_PIN_SEL;
          io_conf.pull_down_en=1;
          io_conf.pull_up_en=0;
          gpio_config(&amp;io_conf);
  
          gpio_set_intr_type(ip,GPIO_INTR_POSEDGE);
          gpio_install_isr_service(ESP_INTR_FLAG_DEFAULT);
          gpio_isr_handler_add(ip,gpio_isr_handler,(void*)ip);
  
          int cnt=0;
          while(1)
          {
  
                  printf("cnt: %d",cnt++);
                  gpio_set_level(op,1);
                  vTaskDelay(1000/portTICK_RATE_MS);
                  fflush(stdout);
          }
  
  }
  </code></pre>
  
  <p>Also this error occurs when I trigger an interrupt through switch:</p>
  
  <p>Exception in thread Thread-2:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
      self.run()
    File "/usr/lib/python2.7/threading.py", line 754, in run
      self.__target(*self.__args, **self.__kwargs)
    File "/home/dhananjay/esp/esp-idf/tools/idf_monitor.py", line 133, in _run_outer
      self.run()
    File "/home/dhananjay/esp/esp-idf/tools/idf_monitor.py", line 226, in run
      data = self.serial.read(self.serial.in_waiting or 1)
    File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 495, in read
      raise SerialException('device reports readiness to read but returned no data (device disconnected or multiple access on port?)')
  SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)
  </code></pre>