rp2/rp2_pio: Add side_pindir support for PIO.

Side-setting can also be used to change pin directions instead of pin
values.  This adds a parameter `side_pindir` to decorator `asm_pio()` to
configure it.

Also replaces a few close-by 0s with corresponding PIO.* constants.

Addresses issue #10027.

Signed-off-by: Markus Gyger <markus@gyger.org>
This commit is contained in:
Markus Gyger
2024-12-31 15:34:17 +07:00
committed by Damien George
parent 9d0a5ac7e9
commit 0662c55121
2 changed files with 10 additions and 7 deletions

View File

@@ -26,20 +26,21 @@ class PIOASMEmit:
out_init=None,
set_init=None,
sideset_init=None,
in_shiftdir=0,
out_shiftdir=0,
side_pindir=False,
in_shiftdir=PIO.SHIFT_LEFT,
out_shiftdir=PIO.SHIFT_LEFT,
autopush=False,
autopull=False,
push_thresh=32,
pull_thresh=32,
fifo_join=0,
fifo_join=PIO.JOIN_NONE,
):
# array is a built-in module so importing it here won't require
# scanning the filesystem.
from array import array
self.labels = {}
execctrl = 0
execctrl = side_pindir << 29
shiftctrl = (
fifo_join << 30
| (pull_thresh & 0x1F) << 25