mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 06:52:44 +01:00
97ad22eed6
A number of ESP-IDF header files that are needed to compile RIOT include the header file `driver/gpio.h` only because of the definition of the type `gpio_num_t`. However, this header file contains the entire GPIO API definition of the ESP-IDF, which conflicts with that of RIOT. The solution was to use a wrapper library that does not need to include the `driver/gpio.h` file of the ESP-IDF during compilation of RIOT code. This commit provides another approach which does not require such a wrapper library. It just provides its own `driver/gpio.h` in RIOT that is included by ESP-IDF header files instead of the original `driver/gpio.h` in ESP-IDF. It defines only the required `gpio_num_t` if RIOT code is compiled but includes the original `driver/gpio.h` of ESP-IDF if ESP-IDF code is compiled. This avoids to create a wrapper library for each module.
25 lines
283 B
C
25 lines
283 B
C
#ifndef DRIVER_GPIO_H
|
|
#define DRIVER_GPIO_H
|
|
|
|
#ifdef ESP_IDF_CODE
|
|
|
|
#include_next "driver/gpio.h"
|
|
|
|
#else
|
|
|
|
#include "hal/gpio_types.h"
|
|
|
|
#define GPIO_PIN_COUNT (SOC_GPIO_PIN_COUNT)
|
|
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* DRIVER_GPIO_H */
|