Update rp2.asm_pio decorator typestub with execctrl and side_pindir parameters #835
+27
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updates the reference typestub for
rp2.asm_pio
decorator to include the new parameters proposed in MicroPython PR #18133.Changes
New
asm_pio
decorator parameters:execctrl=0
- Configures additional execution control options. Can be used with constants likePIO.STATUS_TXLEVEL + n
to trigger status checks based on FIFO thresholds.side_pindir: Optional[bool] = None
- When set toTrue
, configures.side()
modifiers to be used for pin directions instead of pin values (the default whenFalse
).New PIO constants:
PIO.STATUS_TXLEVEL = 0
- Status value for TX FIFO level thresholdPIO.STATUS_RXLEVEL = 32
- Status value for RX FIFO level thresholdPIO.STATUS_IRQ = 64
- Status value for IRQ flagsUsage Example
With these updates, developers can now use advanced PIO features like:
This enables interrupt generation when the TX FIFO has fewer than 5 words left, and configures side-set pins to control directions rather than values.
Backward Compatibility
All existing code remains fully compatible - these are optional parameters with sensible defaults that match the current behavior.
Files Updated
reference/micropython/rp2/__init__.pyi
- Main reference typestubreference/micropython/rp2/PIO.pyi
- Added STATUS constantsstubs/micropython-v1_27_0_preview-docstubs/rp2/__init__.pyi
- Future version consistencystubs/micropython-v1_27_0_preview-docstubs/rp2/PIO.pyi
- Future version constantsFixes the issue by providing proper type hints for the enhanced PIO assembler functionality that will be available in future MicroPython releases.
Fixes #834
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.