Skip to content

hardware_pio: document struct pio_program (#2686)#2967

Open
anoshyn wants to merge 1 commit into
raspberrypi:developfrom
anoshyn:doc-pio-program-struct
Open

hardware_pio: document struct pio_program (#2686)#2967
anoshyn wants to merge 1 commit into
raspberrypi:developfrom
anoshyn:doc-pio-program-struct

Conversation

@anoshyn
Copy link
Copy Markdown

@anoshyn anoshyn commented May 22, 2026

Summary

struct pio_program / pio_program_t is passed to a large part of the PIO API (pio_add_program, pio_can_add_program, …) but carried no doxygen, and several of its fields aren't self-explanatory — origin, pio_version, and (on PIO v1) used_gpio_ranges. #2686 asks for it to be documented.

This adds a \brief for the struct plus per-member ///< descriptions:

  • instructions / length — the encoded instruction array and its size (also the instruction-memory footprint).
  • origin — required load offset, or -1 if relocatable.
  • pio_version — minimum required PIO hardware version (0 = any); loading on too-old hardware fails with PICO_ERROR_VERSION_MISMATCH (matches the check in pio.c).
  • used_gpio_ranges — bitmap of 16-pin GPIO ranges the program uses (bit 0 = pins 0-15, bit 1 = 16-31, bit 2 = 32-47), checked against the instance's GPIO base (pio_set_gpio_base). Bit layout and the compatibility rule are taken directly from is_gpio_compatible() in pio.c.

Documentation only — no functional change.

Test plan

  • Built hardware_pio on RP2350 (PICO_PIO_VERSION > 0, so the used_gpio_ranges member is compiled) — header parses cleanly, no warnings from the new comments.
  • All \ref targets verified to exist: pio_add_program, pio_can_add_program, pio_set_gpio_base, PICO_ERROR_VERSION_MISMATCH.

Closes #2686.

struct pio_program is a common parameter throughout the PIO API but had
no doxygen, and its fields (origin, pio_version, used_gpio_ranges) are
not self-explanatory. Add a brief for the struct and per-member \ref
descriptions, including the meaning of the used_gpio_ranges bitmap and
the pio_version / GPIO-base compatibility checks.

Documentation only; no functional change.

Closes raspberrypi#2686.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant