From 09ee163d378a57723f722fffe58a62625147b399 Mon Sep 17 00:00:00 2001 From: Marco Casaroli Date: Tue, 10 Oct 2023 10:57:40 +0000 Subject: [PATCH] feat(esp32s3-eye): I2C --- .../xtensa/esp32s3/esp32s3-eye/src/esp32s3-eye.h | 16 ++++++++++++++++ .../esp32s3/esp32s3-eye/src/esp32s3_bringup.c | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3-eye.h b/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3-eye.h index c0c4714df0..46fe3522c6 100644 --- a/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3-eye.h +++ b/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3-eye.h @@ -85,5 +85,21 @@ int esp32s3_bringup(void); int esp32s3_gpio_init(void); #endif +/**************************************************************************** + * Name: board_i2c_init + * + * Description: + * Configure the I2C driver. + * + * Returned Value: + * Zero (OK) is returned on success; A negated errno value is returned + * to indicate the nature of any failure. + * + ****************************************************************************/ + +#ifdef CONFIG_I2C_DRIVER +int board_i2c_init(void); +#endif + #endif /* __ASSEMBLY__ */ #endif /* __BOARDS_XTENSA_ESP32S3_ESP32S3_EYE_SRC_ESP32S3_EYE_H */ diff --git a/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c b/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c index 34af2191bd..d075e5a87c 100644 --- a/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c +++ b/boards/xtensa/esp32s3/esp32s3-eye/src/esp32s3_bringup.c @@ -58,6 +58,10 @@ # include "esp32s3_rt_timer.h" #endif +#ifdef CONFIG_ESP32S3_I2C +# include "esp32s3_i2c.h" +#endif + #ifdef CONFIG_WATCHDOG # include "esp32s3_board_wdt.h" #endif @@ -139,6 +143,16 @@ int esp32s3_bringup(void) } #endif +#ifdef CONFIG_I2C_DRIVER + /* Configure I2C peripheral interfaces */ + + ret = board_i2c_init(); + if (ret < 0) + { + syslog(LOG_ERR, "Failed to initialize I2C driver: %d\n", ret); + } +#endif + #ifdef CONFIG_INPUT_BUTTONS /* Register the BUTTON driver */