Skip to content

docs: pio_gpio_init claims it's not *needed* to enable input to a PIO #2387

Open
@Gadgetoid

Description

@Gadgetoid

The comment (and by extension docs?) for pio_gpio_init states:

Note that this is not necessary for a state machine to be able to read the input value from a GPIO, but only for it to set the output value or output enable.

I think this is wrong on RP2350, which needs pio_gpio_init to call gpio_set_function which enables input and - crucially? - disables pad isolation?

/*! \brief Setup the function select for a GPIO to use output from the given PIO instance
* \ingroup hardware_pio
*
* PIO appears as an alternate function in the GPIO muxing, just like an SPI
* or UART. This function configures that multiplexing to connect a given PIO
* instance to a GPIO. Note that this is not necessary for a state machine to
* be able to read the *input* value from a GPIO, but only for it to set the
* output value or output enable.
*
* \param pio The PIO instance; e.g. \ref pio0 or \ref pio1
* \param pin the GPIO pin whose function select to set
*/
static inline void pio_gpio_init(PIO pio, uint pin) {
check_pio_param(pio);
valid_params_if(HARDWARE_PIO, pin < NUM_BANK0_GPIOS);
gpio_set_function(pin, PIO_FUNCSEL_NUM(pio, pin));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions