diff --git a/boards/xtensa/esp32/common/include/esp32_board_i2c.h b/boards/xtensa/esp32/common/include/esp32_board_i2c.h index 77eee87d621..781dc9dc41f 100644 --- a/boards/xtensa/esp32/common/include/esp32_board_i2c.h +++ b/boards/xtensa/esp32/common/include/esp32_board_i2c.h @@ -44,8 +44,6 @@ extern "C" * Public Function Prototypes ****************************************************************************/ -#ifdef CONFIG_I2C_DRIVER - /**************************************************************************** * Name: esp32_i2c_register * @@ -60,8 +58,6 @@ extern "C" int esp32_i2c_register(int bus); -#endif /* CONFIG_I2C_DRIVER */ - #undef EXTERN #if defined(__cplusplus) } diff --git a/boards/xtensa/esp32/common/src/Make.defs b/boards/xtensa/esp32/common/src/Make.defs index 94fefc1e1e9..af42351072e 100644 --- a/boards/xtensa/esp32/common/src/Make.defs +++ b/boards/xtensa/esp32/common/src/Make.defs @@ -34,7 +34,7 @@ ifeq ($(CONFIG_ONESHOT),y) CSRCS += esp32_oneshot.c endif -ifeq ($(CONFIG_I2C_DRIVER),y) +ifeq ($(CONFIG_ESP32_I2C),y) CSRCS += esp32_board_i2c.c endif diff --git a/boards/xtensa/esp32/common/src/esp32_board_i2c.c b/boards/xtensa/esp32/common/src/esp32_board_i2c.c index 3a8615a5aad..ca5d363018e 100644 --- a/boards/xtensa/esp32/common/src/esp32_board_i2c.c +++ b/boards/xtensa/esp32/common/src/esp32_board_i2c.c @@ -52,27 +52,25 @@ int esp32_i2c_register(int bus) { struct i2c_master_s *i2c; - int ret; + int ret = OK; i2c = esp32_i2cbus_initialize(bus); if (i2c == NULL) { syslog(LOG_ERR, "ERROR: Failed to get I2C%d interface\n", bus); + ret = ERROR; } - else + +#ifdef CONFIG_I2C_DRIVER + ret = i2c_register(i2c, bus); + if (ret < 0) { - ret = i2c_register(i2c, bus); - if (ret < 0) - { - syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n", - bus, ret); - esp32_i2cbus_uninitialize(i2c); - } - - return ret; + syslog(LOG_ERR, "ERROR: Failed to register I2C%d driver: %d\n", + bus, ret); + esp32_i2cbus_uninitialize(i2c); } +#endif - return -1; + return ret; } - diff --git a/boards/xtensa/esp32/esp32-audio-kit/configs/audio/defconfig b/boards/xtensa/esp32/esp32-audio-kit/configs/audio/defconfig index 99bc7ebd535..09b92984a8c 100644 --- a/boards/xtensa/esp32/esp32-audio-kit/configs/audio/defconfig +++ b/boards/xtensa/esp32/esp32-audio-kit/configs/audio/defconfig @@ -60,7 +60,6 @@ CONFIG_EXAMPLES_I2SCHAR_TXSTACKSIZE=2048 CONFIG_EXAMPLES_ROMFS=y CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y -CONFIG_I2C=y CONFIG_I2S_DMADESC_NUM=4 CONFIG_IDLETHREAD_STACKSIZE=3072 CONFIG_INIT_ENTRYPOINT="nsh_main" diff --git a/boards/xtensa/esp32/esp32-audio-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-audio-kit/src/esp32_bringup.c index 076d08c014a..de60a22ba44 100644 --- a/boards/xtensa/esp32/esp32-audio-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-audio-kit/src/esp32_bringup.c @@ -316,8 +316,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -336,8 +334,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_ESPRESSIF_I2S #ifdef CONFIG_ESPRESSIF_I2S0 diff --git a/boards/xtensa/esp32/esp32-devkitc/configs/i2c/defconfig b/boards/xtensa/esp32/esp32-devkitc/configs/i2c/defconfig new file mode 100644 index 00000000000..7127a7ae58b --- /dev/null +++ b/boards/xtensa/esp32/esp32-devkitc/configs/i2c/defconfig @@ -0,0 +1,48 @@ +# +# This file is autogenerated: PLEASE DO NOT EDIT IT. +# +# You can use "make menuconfig" to make any modifications to the installed .config file. +# You can then do "make savedefconfig" to generate a new defconfig file that includes your +# modifications. +# +# CONFIG_ARCH_LEDS is not set +# CONFIG_NSH_ARGCAT is not set +# CONFIG_NSH_CMDOPT_HEXDUMP is not set +CONFIG_ARCH="xtensa" +CONFIG_ARCH_BOARD="esp32-devkitc" +CONFIG_ARCH_BOARD_COMMON=y +CONFIG_ARCH_BOARD_ESP32_DEVKITC=y +CONFIG_ARCH_CHIP="esp32" +CONFIG_ARCH_CHIP_ESP32=y +CONFIG_ARCH_CHIP_ESP32WROVER=y +CONFIG_ARCH_STACKDUMP=y +CONFIG_ARCH_XTENSA=y +CONFIG_BOARD_LOOPSPERMSEC=16717 +CONFIG_BUILTIN=y +CONFIG_ESP32_I2C0=y +CONFIG_ESP32_UART0=y +CONFIG_FS_PROCFS=y +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +CONFIG_IDLETHREAD_STACKSIZE=3072 +CONFIG_INIT_ENTRYPOINT="nsh_main" +CONFIG_INIT_STACKSIZE=3072 +CONFIG_INTELHEX_BINARY=y +CONFIG_LINE_MAX=64 +CONFIG_MM_REGIONS=3 +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_READLINE=y +CONFIG_PREALLOC_TIMERS=4 +CONFIG_RAM_SIZE=114688 +CONFIG_RAM_START=0x20000000 +CONFIG_RR_INTERVAL=200 +CONFIG_SCHED_WAITPID=y +CONFIG_START_DAY=28 +CONFIG_START_MONTH=6 +CONFIG_START_YEAR=2022 +CONFIG_SYSLOG_BUFFER=y +CONFIG_SYSTEM_I2CTOOL=y +CONFIG_SYSTEM_NSH=y +CONFIG_UART0_SERIAL_CONSOLE=y diff --git a/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c index 1ba046fcab8..d54042e8b4e 100644 --- a/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-devkitc/src/esp32_bringup.c @@ -518,8 +518,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -538,8 +536,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_SENSORS_BMP180 /* Try to register BMP180 device in I2C0 */ diff --git a/boards/xtensa/esp32/esp32-lyrat/configs/audio/defconfig b/boards/xtensa/esp32/esp32-lyrat/configs/audio/defconfig index 7ad325f58a8..802721ee600 100644 --- a/boards/xtensa/esp32/esp32-lyrat/configs/audio/defconfig +++ b/boards/xtensa/esp32/esp32-lyrat/configs/audio/defconfig @@ -59,7 +59,6 @@ CONFIG_FS_PROCFS=y CONFIG_FS_ROMFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y -CONFIG_I2C=y CONFIG_I2S_DMADESC_NUM=4 CONFIG_IDLETHREAD_STACKSIZE=3072 CONFIG_INIT_ENTRYPOINT="nsh_main" diff --git a/boards/xtensa/esp32/esp32-lyrat/configs/nxrecorder/defconfig b/boards/xtensa/esp32/esp32-lyrat/configs/nxrecorder/defconfig index cc890fb76d4..cd23636a9f4 100644 --- a/boards/xtensa/esp32/esp32-lyrat/configs/nxrecorder/defconfig +++ b/boards/xtensa/esp32/esp32-lyrat/configs/nxrecorder/defconfig @@ -54,7 +54,6 @@ CONFIG_FS_FAT=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y -CONFIG_I2C=y CONFIG_I2S_DMADESC_NUM=4 CONFIG_IDLETHREAD_STACKSIZE=3072 CONFIG_INIT_ENTRYPOINT="nsh_main" diff --git a/boards/xtensa/esp32/esp32-lyrat/configs/rtptools/defconfig b/boards/xtensa/esp32/esp32-lyrat/configs/rtptools/defconfig index 824f1fd2ff8..953e1f3e484 100644 --- a/boards/xtensa/esp32/esp32-lyrat/configs/rtptools/defconfig +++ b/boards/xtensa/esp32/esp32-lyrat/configs/rtptools/defconfig @@ -63,7 +63,6 @@ CONFIG_FS_ROMFS=y CONFIG_FS_SPIFFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y -CONFIG_I2C=y CONFIG_I2S_DMADESC_NUM=4 CONFIG_IDLETHREAD_STACKSIZE=3072 CONFIG_INIT_ENTRYPOINT="nsh_main" diff --git a/boards/xtensa/esp32/esp32-lyrat/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-lyrat/src/esp32_bringup.c index 14090a48d28..1d2d1eea236 100644 --- a/boards/xtensa/esp32/esp32-lyrat/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-lyrat/src/esp32_bringup.c @@ -317,8 +317,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -337,8 +335,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_ESPRESSIF_I2S #ifdef CONFIG_ESPRESSIF_I2S0 diff --git a/boards/xtensa/esp32/esp32-pico-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-pico-kit/src/esp32_bringup.c index cc6a3e6c896..0741b6bd288 100644 --- a/boards/xtensa/esp32/esp32-pico-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-pico-kit/src/esp32_bringup.c @@ -334,8 +334,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -354,8 +352,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_ESPRESSIF_I2S #if defined(CONFIG_ESPRESSIF_I2S0) && || defined(CONFIG_ESPRESSIF_I2S1) diff --git a/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_bringup.c index 318f9208ac8..173e4f97511 100644 --- a/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-sparrow-kit/src/esp32_bringup.c @@ -328,8 +328,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -348,8 +346,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_ESPRESSIF_I2S #ifdef CONFIG_ESPRESSIF_I2S0 diff --git a/boards/xtensa/esp32/esp32-wrover-kit/configs/lcd1602/defconfig b/boards/xtensa/esp32/esp32-wrover-kit/configs/lcd1602/defconfig index e41ccf40a1d..be605254d9c 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/configs/lcd1602/defconfig +++ b/boards/xtensa/esp32/esp32-wrover-kit/configs/lcd1602/defconfig @@ -25,7 +25,6 @@ CONFIG_EXAMPLES_SLCD=y CONFIG_FS_PROCFS=y CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y -CONFIG_I2C=y CONFIG_IDLETHREAD_STACKSIZE=3072 CONFIG_INIT_ENTRYPOINT="nsh_main" CONFIG_INIT_STACKSIZE=3072 diff --git a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c index e285ed5af9b..53ff941e2aa 100644 --- a/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c +++ b/boards/xtensa/esp32/esp32-wrover-kit/src/esp32_bringup.c @@ -316,8 +316,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -336,8 +334,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_SENSORS_BMP180 /* Try to register BMP180 device in I2C0 */ diff --git a/boards/xtensa/esp32/lilygo_tbeam_lora_gps/src/esp32_bringup.c b/boards/xtensa/esp32/lilygo_tbeam_lora_gps/src/esp32_bringup.c index 8309cee1c44..44393e5b65a 100644 --- a/boards/xtensa/esp32/lilygo_tbeam_lora_gps/src/esp32_bringup.c +++ b/boards/xtensa/esp32/lilygo_tbeam_lora_gps/src/esp32_bringup.c @@ -333,8 +333,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -355,8 +353,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_SENSORS_BMP180 /* Try to register BMP180 device in I2C0 */ diff --git a/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c b/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c index 98400f1cb78..8b23e705c2d 100644 --- a/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c +++ b/boards/xtensa/esp32/ttgo_eink5_v2/src/esp32_bringup.c @@ -419,8 +419,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -439,8 +437,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_SENSORS_BMP180 /* Try to register BMP180 device in I2C0 */ diff --git a/boards/xtensa/esp32/ttgo_lora_esp32/src/esp32_bringup.c b/boards/xtensa/esp32/ttgo_lora_esp32/src/esp32_bringup.c index 34509662c32..e841b9bd9b5 100644 --- a/boards/xtensa/esp32/ttgo_lora_esp32/src/esp32_bringup.c +++ b/boards/xtensa/esp32/ttgo_lora_esp32/src/esp32_bringup.c @@ -333,8 +333,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -355,8 +353,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_SENSORS_BMP180 /* Try to register BMP180 device in I2C0 */ diff --git a/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_bringup.c b/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_bringup.c index ac5c314793f..66d6a2a7168 100644 --- a/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_bringup.c +++ b/boards/xtensa/esp32/ttgo_t_display_esp32/src/esp32_bringup.c @@ -422,8 +422,6 @@ int esp32_bringup(void) } #endif -#ifdef CONFIG_I2C_DRIVER - #ifdef CONFIG_ESP32_I2C0 ret = esp32_i2c_register(0); @@ -442,8 +440,6 @@ int esp32_bringup(void) } #endif -#endif - #ifdef CONFIG_SENSORS_BMP180 /* Try to register BMP180 device in I2C0 */