cpu/esp32: cleanup of ESP-IDF interface API (module esp_idf_api
)
#19426
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
This PR cleans up the wrapper library (module
esp_idf_api
) that is used to interface to ESP-IDF driver modules.A number of ESP-IDF header files needed to compile RIOT include the ESP-IDF header file
driver/gpio.h
only because of the definition of the typegpio_num_t
. However,driver/gpio.h
does not only definegpio_num_t
but the complete ESP-IDF GPIO API which conflicts with that in RIOT. The solution was to use a wrapper library when compiling the RIOT code that does not need to include the ESP-IDF header filedriver/gpio.h
. The disadvantage of this approach was that for each ESP-IDF function to be used in RIOT, a corresponding function in the wrapper library had to be defined which does nothing else than calling the corresponding ESP-IDF function.This PR provides another approach which does not require such a wrapper library in most cases and allows to clean up the wrapper library (module
esp_idf_api
). It just provides its owndriver/gpio.h
that is included by ESP-IDF header files instead of the original ESP-IDF header filedriver/gpio.h
. It defines only the requiredgpio_num_t
when RIOT code is compiled but includes the original ESP-IDF header filedriver/gpio.h
when ESP-IDF code is compiled. As a result. most of the functions in the wrapper library could be eliminated. A further advantage is that further ESP-IDF API functions can be used without defining corresponding wrapper functions.Testing procedure
Green CI
Issues/PRs references