From 1150bfea60e37dd4cbe2b644686f8f294d28a6eb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Sep 2025 22:54:09 +0000 Subject: [PATCH 1/3] Initial plan From da8d21e87faccdcef60489166e570755d5f6f3fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Sep 2025 23:01:10 +0000 Subject: [PATCH 2/3] Update rp2.asm_pio decorator with execctrl and side_pindir parameters Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com> --- reference/micropython/rp2/PIO.pyi | 8 ++++++++ reference/micropython/rp2/__init__.pyi | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/reference/micropython/rp2/PIO.pyi b/reference/micropython/rp2/PIO.pyi index 896e0e8ed..ecef755b8 100644 --- a/reference/micropython/rp2/PIO.pyi +++ b/reference/micropython/rp2/PIO.pyi @@ -69,6 +69,14 @@ class PIO: IRQ_SM2: int = 0x400 IRQ_SM3: int = 0x800 + # STATUS constants for execctrl argument to asm_pio + STATUS_TXLEVEL: int = 0 + """Status value for TX FIFO level threshold.""" + STATUS_RXLEVEL: int = 32 + """Status value for RX FIFO level threshold.""" + STATUS_IRQ: int = 64 + """Status value for IRQ flags.""" + def __init__(self, id:int) -> None: ... def add_program(self, program: _PIO_ASM_Program) -> None: diff --git a/reference/micropython/rp2/__init__.pyi b/reference/micropython/rp2/__init__.pyi index 91af11f9b..e61a5282a 100644 --- a/reference/micropython/rp2/__init__.pyi +++ b/reference/micropython/rp2/__init__.pyi @@ -40,6 +40,7 @@ def asm_pio( out_init: Union[Pin, List[Pin], int, List[int], None] = None, set_init: Union[Pin, List[Pin], int, List[int], None] = None, sideset_init: Union[Pin, List[Pin], int, List[int], None] = None, + side_pindir: Optional[bool] = None, in_shiftdir=0, out_shiftdir=0, autopush=False, @@ -47,6 +48,7 @@ def asm_pio( push_thresh=32, pull_thresh=32, fifo_join=PIO.JOIN_NONE, + execctrl=0, ) -> Callable[..., _PIO_ASM_Program]: """ Assemble a PIO program. @@ -61,6 +63,8 @@ def asm_pio( be at most 5. - *sideset_init* configures the pins used side-setting. There can be at most 5. + - *side_pindir* when set to ``True`` configures ``.side()`` modifiers to be + used for pin directions, instead of pin values (the default, when ``False``). The following parameters are used by default, but can be overridden in `StateMachine.init()`: @@ -81,6 +85,9 @@ def asm_pio( - *fifo_join* configures whether the 4-word TX and RX FIFOs should be combined into a single 8-word FIFO for one direction only. The options are `PIO.JOIN_NONE`, `PIO.JOIN_RX` and `PIO.JOIN_TX`. + - *execctrl* configures additional execution control options. Can be used + with constants like `PIO.STATUS_TXLEVEL` + n to trigger status checks + based on FIFO thresholds. """ ... From 1b8c8dd35a03b35e24f5b2241651bc25982e4a42 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 24 Sep 2025 23:04:40 +0000 Subject: [PATCH 3/3] Update v1.27.0-preview docstubs with new asm_pio parameters Co-authored-by: Josverl <981654+Josverl@users.noreply.github.com> --- stubs/micropython-v1_27_0_preview-docstubs/rp2/PIO.pyi | 6 ++++++ .../micropython-v1_27_0_preview-docstubs/rp2/__init__.pyi | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/stubs/micropython-v1_27_0_preview-docstubs/rp2/PIO.pyi b/stubs/micropython-v1_27_0_preview-docstubs/rp2/PIO.pyi index 242f92710..0c22b7ab5 100644 --- a/stubs/micropython-v1_27_0_preview-docstubs/rp2/PIO.pyi +++ b/stubs/micropython-v1_27_0_preview-docstubs/rp2/PIO.pyi @@ -62,6 +62,12 @@ class PIO: """These constants are used for the *trigger* argument to `PIO.irq`.""" IRQ_SM3: Incomplete """These constants are used for the *trigger* argument to `PIO.irq`.""" + STATUS_TXLEVEL: Incomplete + """Status value for TX FIFO level threshold.""" + STATUS_RXLEVEL: Incomplete + """Status value for RX FIFO level threshold.""" + STATUS_IRQ: Incomplete + """Status value for IRQ flags.""" def __init__(self, id: int) -> None: ... def gpio_base(self, base: Optional[Any] = None) -> Incomplete: """ diff --git a/stubs/micropython-v1_27_0_preview-docstubs/rp2/__init__.pyi b/stubs/micropython-v1_27_0_preview-docstubs/rp2/__init__.pyi index d4afaf31e..e6243200b 100644 --- a/stubs/micropython-v1_27_0_preview-docstubs/rp2/__init__.pyi +++ b/stubs/micropython-v1_27_0_preview-docstubs/rp2/__init__.pyi @@ -24,7 +24,7 @@ from rp2.PIO import PIO from rp2.StateMachine import StateMachine from machine import Pin from rp2.PIOASMEmit import PIOASMEmit -from typing import Callable, List, Union, overload +from typing import Callable, List, Union, Optional, overload from micropython import const from rp2 import PIOASMEmit, _PIO_ASM_Program @@ -41,6 +41,7 @@ def asm_pio( out_init: Union[Pin, List[Pin], int, List[int], None] = None, set_init: Union[Pin, List[Pin], int, List[int], None] = None, sideset_init: Union[Pin, List[Pin], int, List[int], None] = None, + side_pindir: Optional[bool] = None, in_shiftdir=0, out_shiftdir=0, autopush=False, @@ -48,6 +49,7 @@ def asm_pio( push_thresh=32, pull_thresh=32, fifo_join=PIO.JOIN_NONE, + execctrl=0, ) -> Callable[..., _PIO_ASM_Program]: """ Assemble a PIO program. @@ -84,6 +86,9 @@ def asm_pio( - *fifo_join* configures whether the 4-word TX and RX FIFOs should be combined into a single 8-word FIFO for one direction only. The options are `PIO.JOIN_NONE`, `PIO.JOIN_RX` and `PIO.JOIN_TX`. + - *execctrl* configures additional execution control options. Can be used + with constants like `PIO.STATUS_TXLEVEL` + n to trigger status checks + based on FIFO thresholds. """ ...