mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
cpu/esp32/esp-idf: minimum gpio definition for ESP-IDF headers
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.
This commit is contained in:
parent
d50fd0b41e
commit
97ad22eed6
@ -1,6 +1,6 @@
|
||||
# common definitions for all ESP-IDF modules
|
||||
|
||||
# additional include pathes required by als ESP-IDF module
|
||||
# additional include pathes required by ESP-IDF module
|
||||
INCLUDES += -I$(ESP32_SDK_DIR)/components/bootloader_support/include
|
||||
INCLUDES += -I$(ESP32_SDK_DIR)/components/bootloader_support/include_bootloader
|
||||
INCLUDES += -I$(ESP32_SDK_DIR)/components/driver/$(CPU_FAM)/include
|
||||
|
@ -1,5 +1,8 @@
|
||||
# common definitions for all ESP-IDF modules
|
||||
|
||||
# indicate that ESP-IDF code is compiled
|
||||
CFLAGS += -DESP_IDF_CODE
|
||||
|
||||
# shortcuts used by ESP-IDF
|
||||
CFLAGS += -Dasm=__asm
|
||||
CFLAGS += -Dtypeof=__typeof__
|
||||
|
24
cpu/esp32/esp-idf/include/driver/gpio.h
Normal file
24
cpu/esp32/esp-idf/include/driver/gpio.h
Normal file
@ -0,0 +1,24 @@
|
||||
#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 */
|
Loading…
Reference in New Issue
Block a user