class PIO – advanced PIO usage¶
PIO class gives access to an instance of the RP2040’s PIO
(programmable I/O) interface.
The preferred way to interact with PIO is using
PIO class is for advanced use.
For assembling PIO programs, see
- class rp2.PIO(id)¶
Gets the PIO instance numbered id. The RP2040 has two PIO instances, numbered 0 and 1.
ValueErrorif any other argument is provided.
Add the program to the instruction memory of this PIO instance.
The amount of memory available for programs on each PIO instance is limited. If there isn’t enough space left in the PIO’s program memory this method will raise
Remove program from the instruction memory of this PIO instance.
If no program is provided, it removes all programs.
It is not an error to remove a program which has already been removed.
- PIO.state_machine(id[, program, ...])¶
Gets the state machine numbered id. On the RP2040, each PIO instance has four state machines, numbered 0 to 3.
Optionally initialize it with a program: see
>>> rp2.PIO(1).state_machine(3) StateMachine(7)
- PIO.irq(handler=None, trigger=IRQ_SM0 | IRQ_SM1 | IRQ_SM2 | IRQ_SM3, hard=False)¶
Returns the IRQ object for this PIO instance.
MicroPython only uses IRQ 0 on each PIO instance. IRQ 1 is not available.
Optionally configure it.
These constants are used for the out_init, set_init, and sideset_init arguments to
These constants are used for the fifo_join argument to