Skip to content

Commit bb66fdf

Browse files
authored
pico_encode_gpio_wait doc improvement (#2579)
1 parent 3461d65 commit bb66fdf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/rp2_common/hardware_pio/include/hardware/pio_instructions.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
* parameters.
1919
*
2020
* For fuller descriptions of the instructions in question see the "RP2040 Datasheet"
21-
*
22-
* NOTE: These are helper functions for the raw instruction encoding, and thus
23-
* only provide support for pins numbered 0-31. You should adjust your encoding
24-
* according to your expected GPIO_BASE (see \ref pio_set_gpio_base)
2521
*/
2622

2723
// PICO_CONFIG: PARAM_ASSERTIONS_ENABLED_PIO_INSTRUCTIONS, Enable/disable assertions in the PIO instructions, type=bool, default=0, group=pio_instructions
@@ -271,8 +267,12 @@ static inline uint _pio_encode_irq(bool relative, uint irq) {
271267
*
272268
* This is the equivalent of `WAIT <polarity> GPIO <gpio>`
273269
*
270+
* \note gpio here refers to the raw instruction encoding, which only supports 32 GPIOs. So, if you had a PIO
271+
* program with `WAIT <polarity> GPIO 42` and a GPIO_BASE (see \ref pio_set_gpio_base) of 16, then you'd want to do
272+
* `pio_encode_wait_gpio(polarity, 42-16)` assuming you are using this function to craft instructions for \ref pio_sm_exec.
273+
*
274274
* \param polarity true for `WAIT 1`, false for `WAIT 0`
275-
* \param gpio The real GPIO number 0-31
275+
* \param gpio The GPIO number 0-31 relative to the state machine's GPIO_BASE (see \ref pio_set_gpio_base)
276276
* \return The instruction encoding with 0 delay and no side set value
277277
* \see pio_encode_delay, pio_encode_sideset, pio_encode_sideset_opt
278278
*/

0 commit comments

Comments
 (0)