Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO feature: Add gpio_get_direction() and gpio_get_pull_mode() (IDFGH-10987) #12176

Closed
IhorNehrutsa opened this issue Sep 1, 2023 · 6 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally

Comments

@IhorNehrutsa
Copy link
Contributor

It is useful to have functions that return the current setting of a pin:

1) getter

esp_err_t gpio_get_direction(gpio_num_t gpio_num, gpio_mode_t *mode);

like the setter:

esp_err_t gpio_set_direction(gpio_num_t gpio_num, gpio_mode_t mode);

https://github.com/espressif/esp-idf/blob/82cceabc6e6a0a2d8c40e2249bc59917cc5e577a/components/driver/gpio/include/driver/gpio.h#L169C11-L169C29

2) getter

esp_err_t gpio_get_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t *pull);

like the setter:

esp_err_t gpio_set_pull_mode(gpio_num_t gpio_num, gpio_pull_mode_t pull);

https://github.com/espressif/esp-idf/blob/82cceabc6e6a0a2d8c40e2249bc59917cc5e577a/components/driver/gpio/include/driver/gpio.h#L184C11-L184C29

@espressif-bot espressif-bot added the Status: Opened Issue is new label Sep 1, 2023
@github-actions github-actions bot changed the title GPIO feature: Add gpio_get_direction() and gpio_get_pull_mode() GPIO feature: Add gpio_get_direction() and gpio_get_pull_mode() (IDFGH-10987) Sep 1, 2023
@IhorNehrutsa
Copy link
Contributor Author

@songruo
Hi.
Will you work on this issue?
Thanks.

@songruo
Copy link
Collaborator

songruo commented Sep 5, 2023

@IhorNehrutsa If I introduce a dump API that could dump out all information on the requested IO, including input_en = 0/1, output_en = 0/1, pullup_en = 0/1, pulldown_en = 0/1, func_sel, signal_connected, etc. together, instead of separate APIs for every characteristic. Will it work for you?

@IhorNehrutsa
Copy link
Contributor Author

@songruo Yes, perfect.
Thanks.

I need this feature in v5.0.2 ESP-IDF and later.
Thanks.

@KaeLL
Copy link
Contributor

KaeLL commented Sep 5, 2023

@songruo Maybe make gpio_config call this function in order to show gpio cfg? That would be less redundant.

@espressif-bot espressif-bot added Status: Reviewing Issue is being reviewed and removed Status: Opened Issue is new labels Sep 22, 2023
@IhorNehrutsa
Copy link
Contributor Author

@songruo Is any progress ?

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: Reviewing Issue is being reviewed labels Oct 13, 2023
@songruo
Copy link
Collaborator

songruo commented Oct 16, 2023

@IhorNehrutsa It has been merged to master, please wait for its sync to Github. However, we are not considering backporting the new feature to previous IDF versions. You could help yourself to pick the commit!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally
Projects
None yet
Development

No branches or pull requests

4 participants