RP2: PIO interrupt API for Raspberry Pi Pico
In the Micropython port RP2 for the Raspberry Pi Pico it looks like there are some APIs missing.
Especially it seems it is not possible to enable a PIO FIFO interrupt. (Or I did miss something)
In the Raspberry Pico C API there is the function pio_set_irq0_source_enabled that lets you configure FIFO interrupts:
https://raspberrypi.github.io/pico-sdk-doxygen/group__hardware__pio.html
I would like to see support for that in Micropython. Without that API you have to poll the FIFO which is in my case bad for performance.
rp2: Add RP2350 PIO v1 assembler support.
Add support for new PIO v1 instruction features on RP2350:
- wait: add jmp_pin source (PINCTRL_JMP_PIN, src=3) with a
2-bit offset argument. - irq: add next_pio/prev_pio index modifiers for cross-PIO IRQ
targeting. - asm_pio: add in_count parameter encoding SHIFTCTRL.IN_COUNT
(bits [4:0]) to mask unneeded IN-mapped pins to zero. - asm_pio: fix fifo_join encoding to support RP2350 TXGET(4),
TXPUT(8) and PUTGET(12) modes via SHIFTCTRL bits [15:14].
All changes are backward-compatible with RP2040 PIO v0.
Also update RP2 docs to cover new changes.
Signed-off-by: NED KONZ NED@METAMAGIX.TECH
Summary
The RP2350 added a number of improvements to the PIO hardware in the RP2040.
This PR is the first of three that will bring MicroPython's RP2 PIO support up to date.
Testing
Tested on a RPI_PICO2 board using #18974: all encoding tests passed,
covering new instructions, RP2350 FIFO join modes, in_count,
and regression checks for all existing instruction encodings.
I also tested on a RPI_PICO board and there were no regressions.
Generative AI
I used generative AI tools when creating this PR, but a human has checked the
code and is responsible for the code and the description above.