linguini1 opened a new pull request, #16281:
URL: https://github.com/apache/nuttx/pull/16281

   ## Summary
   
   The RP2040 chip supports 4 different GPIO interrupt modes. They can be 
configured to be used simultaneously, although previously the NuttX support 
only allowed one type of interrupt to be enabled per GPIO pin. This allows up 
to all four to be selected without changing previous behaviour.
   
   ## Impact
   
   This impacts the interrupt configuration behaviour for the RP2040. Where it 
used to only be previously possible to select one interrupt per pin:
   
   ```c
   ret = rp2040_gpio_irq_attach(irq,
                              RP2040_GPIO_INTR_EDGE_HIGH,
                              rp2040gpio_interrupt,
                              &g_gpint[rp2040gpint->rp2040gpio.id]);
   ```
   
   it is now possible to select multiple interrupts per pin using the OR 
operator:
   
   ```c
   ret = rp2040_gpio_irq_attach(irq,
                              RP2040_GPIO_INTR_EDGE_LOW |
                              RP2040_GPIO_INTR_EDGE_HIGH,
                              rp2040gpio_interrupt,
                              &g_gpint[rp2040gpint->rp2040gpio.id]);
   ```
   
   This change does not affect any previous code relying on the old behaviour, 
since it is still possible to only enable one interrupt mode at a time.
   
   No other part of the system is affected by this change.
   
   ## Testing
   
   This change was compiled and tested on the W5500-EVB Pico board. I enabled 
the gpio driver and `gpio` example. In the gpio driver, I enabled both rising 
and falling edge interrupts (as in the second code snippet above). The GPIO 
pins were enabled with a pull-down resistor.
   
   I then used the gpio example to wait for interrupt on GPIO2 and verified 
that it works for both rising and falling interrupts by plugging a 3.3V signal 
into GPIO2 (triggering rising interrupt), and then removing it (triggering 
falling interrupt).
   
   Logs:
   
   ```console
   nsh> gpio -w 30 /dev/gpio2
   Driver: /dev/gpio2
     Interrupt pin: Value=1
     Verify:        Value=0
   nsh> gpio -w 30 /de/gpio2
   Driver: /dev/gpio2
     Interrupt pin: Value=0
     Verify:        Value=1
   nsh> 
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to