1

In order to use the Raspberry Pi Pico ADC on a pin, the adc_gpio_init function is used, which disables all digital functions (https://www.raspberrypi.com/documentation/pico-sdk/hardware.html#gab15d6e804715935b4e9b5027a2940910).

However, I'd like to both use the ADC (in free-running mode with DMA) and attach a falling-edge interrupt to the same pin. Is something like that possible, or do I have to connect the same signal to two pins?

1 Answer 1

1

My solution ended up being:

gpio_init(26 + CAPTURE_CHANNEL);
gpio_disable_pulls(26 + CAPTURE_CHANNEL);
gpio_set_irq_enabled_with_callback(26 + CAPTURE_CHANNEL, GPIO_IRQ_EDGE_FALL, true, gpio_callback);

This seems to configure the pin as an input without pull-up / pull-down resistors, and leaves both ADC and digital functions enabled.

Any amendments to the answer are welcome.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.