rp2: rp2.asm_pio_encode incorrectly accepts 'pins' as src for 'wait'
- https://docs.micropython.org/en/latest/library/rp2.html#module-rp2 specifies the pio asm syntax for 'wait' as
wait(polarity, src, index) where 'src' one of (gpio, pin, irq) - The rp2040-datasheet.pdf similary uses (GPIO, PIN, IRQ)
The bug is that rp2.asm_pio_encode silently accepts the invalid src value 'pins'. It should raise an exception.
Incidentaly it encodes "wait(1, pins, 0)" the same as "wait(1, gpio, 0)"
demo code
import rp2
try:
rp2.asm_pio_encode("wait(1, pins, 0)")
exception_raised = False
except Exception:
exception_raised = True
assert exception_raised
rp2/rp2_pio: Fix PIO support for pin wrapping and RP2350B upper-bank pins.
Summary
The existing public pico-sdk API methods for pio_sm_set_pins_with_mask/pio_sm_set_pindirs_with_mask, including the 64-bit variants, do not allow PIO "pin wrapping", i.e. using [30, 31, 0, 1] or [46, 47, 16, 17] as contiguous pin ranges for a PIO program, despite the documented support for this in the underlying hardware.
This patch exposes the internal method that the existing 32- and 64-bit versions of these functions call to in order to skip the way the wrappers "helpfully" perform truncated bit-shifts on their arguments, and uses it to also resolve the outstanding issue with using upper-bank RP2350B pins for PIO.
Resolves: #16199
Closes: #16985
Testing
This still needs to be tested with real RP2350B hardware, not just the more common RP2350A --- as this is a key area where these two chips are different. At the moment I do not have suitable hardware to test on.