Does gpio_set_level() before gpio_set_direction() work?
Posted: Mon Jul 04, 2022 7:40 pm
I'd like to ensure that when I configure a GPIO as an output it has a known initial state.
Will gpio_set_level() configure a GPIO properly before it has been set as an output, for example:
If not, how can a GPIO be configured to have a particular output state when the pin is switched to GPIO_MODE_OUTPUT?
Will gpio_set_level() configure a GPIO properly before it has been set as an output, for example:
Code: Select all
gpio_num_t gpio = /* some valid GPIO pin # */;
gpio_set_level(gpio, 0);
gpio_set_direction(gpio, GPIO_MODE_OUTPUT);