diff --git a/gpio/hello_gpio_irq/hello_gpio_irq.c b/gpio/hello_gpio_irq/hello_gpio_irq.c index 8620b835a..e26952679 100644 --- a/gpio/hello_gpio_irq/hello_gpio_irq.c +++ b/gpio/hello_gpio_irq/hello_gpio_irq.c @@ -8,6 +8,8 @@ #include "pico/stdlib.h" #include "hardware/gpio.h" +#define GPIO_WATCH_PIN 2 + static char event_str[128]; void gpio_event_string(char *buf, uint32_t events); @@ -23,8 +25,8 @@ int main() { stdio_init_all(); printf("Hello GPIO IRQ\n"); - gpio_init(2); - gpio_set_irq_enabled_with_callback(2, GPIO_IRQ_EDGE_RISE | GPIO_IRQ_EDGE_FALL, true, &gpio_callback); + gpio_init(GPIO_WATCH_PIN); + gpio_set_irq_enabled_with_callback(GPIO_WATCH_PIN, GPIO_IRQ_EDGE_RISE | GPIO_IRQ_EDGE_FALL, true, &gpio_callback); // Wait forever while (1); @@ -57,4 +59,4 @@ void gpio_event_string(char *buf, uint32_t events) { } } *buf++ = '\0'; -} \ No newline at end of file +}