diff --git a/.build-test-rules.yml b/.build-test-rules.yml index 7ed960d8..bea7e367 100644 --- a/.build-test-rules.yml +++ b/.build-test-rules.yml @@ -7,7 +7,7 @@ examples: reason: Example depends on BSP, which is supported only for IDF >= 5.2 - if: (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR < 3) and CONFIG_NAME in ["esp32_p4_function_ev_board", "esp-box-3"] reason: Example depends on BSP, which is supported only for IDF >= 5.3 - - if: (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR < 4) and CONFIG_NAME in ["m5stack_core_s3", "esp32_s2_kaluga_kit"] + - if: (IDF_VERSION_MAJOR == 5 and IDF_VERSION_MINOR < 4) and CONFIG_NAME in ["m5stack_core_s3", "esp32_s2_kaluga_kit", "esp32_s3_korvo_2"] reason: Example depends on BSP, which is supported only for IDF >= 5.4 examples/generic_button_led: diff --git a/bsp/esp32_s3_korvo_2/CHANGELOG.md b/bsp/esp32_s3_korvo_2/CHANGELOG.md index d74e5e93..4bc7e6de 100644 --- a/bsp/esp32_s3_korvo_2/CHANGELOG.md +++ b/bsp/esp32_s3_korvo_2/CHANGELOG.md @@ -1,5 +1,9 @@ # ChangeLog +## v3.0.0 + +* Migrated to I2C Driver-NG (https://docs.espressif.com/projects/esp-idf/en/stable/esp32/migration-guides/release-5.x/5.2/peripherals.html#i2c) + ## v2.2.1 - 2024-09-20 ### Bugfix diff --git a/bsp/esp32_s3_korvo_2/CMakeLists.txt b/bsp/esp32_s3_korvo_2/CMakeLists.txt index 0836705f..1ead8c2e 100644 --- a/bsp/esp32_s3_korvo_2/CMakeLists.txt +++ b/bsp/esp32_s3_korvo_2/CMakeLists.txt @@ -1,16 +1,7 @@ -#IDF version is less than IDF5.0 -if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "5.0") - set(SRC_VER "esp32_s3_korvo_2_idf4.c") - set(REQ driver esp_lcd) -else() - set(SRC_VER "esp32_s3_korvo_2_idf5.c") - set(REQ driver esp_lcd esp_adc) -endif() - idf_component_register( - SRCS "esp32_s3_korvo_2.c" ${SRC_VER} + SRCS "esp32_s3_korvo_2.c" "esp32_s3_korvo_2_idf5.c" INCLUDE_DIRS "include" PRIV_INCLUDE_DIRS "priv_include" - REQUIRES ${REQ} - PRIV_REQUIRES spiffs fatfs + REQUIRES esp_driver_gpio esp_driver_i2s esp_driver_sdmmc esp_adc + PRIV_REQUIRES spiffs fatfs esp_lcd esp_driver_i2c esp_driver_spi esp_driver_ledc ) diff --git a/bsp/esp32_s3_korvo_2/Kconfig b/bsp/esp32_s3_korvo_2/Kconfig index c7eb97da..b0d40431 100644 --- a/bsp/esp32_s3_korvo_2/Kconfig +++ b/bsp/esp32_s3_korvo_2/Kconfig @@ -12,7 +12,7 @@ menu "Board Support Package" default 1 range 0 1 help - ESP32S3 has two I2C peripherals, pick the one you want to use. + ESP32-S3 has two I2C peripherals, pick the one you want to use. config BSP_I2C_FAST_MODE bool "Enable I2C fast mode" @@ -72,5 +72,5 @@ menu "Board Support Package" default 1 range 0 1 help - ESP32S3 has two I2S peripherals, pick the one you want to use. + ESP32-S3 has two I2S peripherals, pick the one you want to use. endmenu diff --git a/bsp/esp32_s3_korvo_2/README.md b/bsp/esp32_s3_korvo_2/README.md index 14f0520c..3191ab41 100644 --- a/bsp/esp32_s3_korvo_2/README.md +++ b/bsp/esp32_s3_korvo_2/README.md @@ -12,17 +12,17 @@ The ESP32-S3-Korvo-2 is a multimedia development board based on the ESP32-S3 chi ### Capabilities and dependencies -| Capability | Available | Component | Version | -|-------------|------------------|--------------------------------------------------------------------------------------------------------------|-----------| -| DISPLAY |:heavy_check_mark:| [espressif/esp_lcd_ili9341](https://components.espressif.com/components/espressif/esp_lcd_ili9341) | ^1 | -| LVGL_PORT |:heavy_check_mark:| [espressif/esp_lvgl_port](https://components.espressif.com/components/espressif/esp_lvgl_port) | ^2 | -| TOUCH |:heavy_check_mark:|[espressif/esp_lcd_touch_tt21100](https://components.espressif.com/components/espressif/esp_lcd_touch_tt21100)| ^1 | -| BUTTONS |:heavy_check_mark:| [espressif/button](https://components.espressif.com/components/espressif/button) | >=2.5,<4.0| -| AUDIO |:heavy_check_mark:| [espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev) |^1.0.2,<1.2| -|AUDIO_SPEAKER|:heavy_check_mark:| | | -| AUDIO_MIC |:heavy_check_mark:| | | -| LED |:heavy_check_mark:| idf | >=4.4.5 | -| SDCARD |:heavy_check_mark:| idf | >=4.4.5 | -| IMU | :x: | | | -| CAMERA |:heavy_check_mark:| [espressif/esp32-camera](https://components.espressif.com/components/espressif/esp32-camera) | ^2.0.2 | +| Capability | Available | Component | Version | +|-------------|------------------|--------------------------------------------------------------------------------------------------------------|----------| +| DISPLAY |:heavy_check_mark:| [espressif/esp_lcd_ili9341](https://components.espressif.com/components/espressif/esp_lcd_ili9341) | ^1 | +| LVGL_PORT |:heavy_check_mark:| [espressif/esp_lvgl_port](https://components.espressif.com/components/espressif/esp_lvgl_port) | ^2 | +| TOUCH |:heavy_check_mark:|[espressif/esp_lcd_touch_tt21100](https://components.espressif.com/components/espressif/esp_lcd_touch_tt21100)| ^1 | +| BUTTONS |:heavy_check_mark:| [espressif/button](https://components.espressif.com/components/espressif/button) |>=2.5,<4.0| +| AUDIO |:heavy_check_mark:| [espressif/esp_codec_dev](https://components.espressif.com/components/espressif/esp_codec_dev) | ~1.3.1 | +|AUDIO_SPEAKER|:heavy_check_mark:| | | +| AUDIO_MIC |:heavy_check_mark:| | | +| LED |:heavy_check_mark:| idf | >=5.4 | +| SDCARD |:heavy_check_mark:| idf | >=5.4 | +| IMU | :x: | | | +| CAMERA |:heavy_check_mark:| [espressif/esp32-camera](https://components.espressif.com/components/espressif/esp32-camera) | ^2.0.13 | diff --git a/bsp/esp32_s3_korvo_2/esp32_s3_korvo_2.c b/bsp/esp32_s3_korvo_2/esp32_s3_korvo_2.c index fb13148e..e5aa2d59 100644 --- a/bsp/esp32_s3_korvo_2/esp32_s3_korvo_2.c +++ b/bsp/esp32_s3_korvo_2/esp32_s3_korvo_2.c @@ -7,6 +7,7 @@ #include "driver/gpio.h" #include "driver/ledc.h" #include "driver/spi_master.h" +#include "driver/i2c_master.h" #include "esp_err.h" #include "esp_log.h" #include "esp_check.h" @@ -28,14 +29,21 @@ static const char *TAG = "S3-KORVO-2"; +/** + * @brief I2C handle for BSP usage + * + * In IDF v5.4 you can call i2c_master_get_bus_handle(BSP_I2C_NUM, i2c_master_bus_handle_t *ret_handle) + * from #include "esp_private/i2c_platform.h" to get this handle + * + * For IDF 5.2 and 5.3 you must call bsp_i2c_get_handle() + */ +static i2c_master_bus_handle_t i2c_handle = NULL; +static bool i2c_initialized = false; static esp_io_expander_handle_t io_expander = NULL; // IO expander tca9554 handle sdmmc_card_t *bsp_sdcard = NULL; // Global uSD card handler static esp_lcd_touch_handle_t tp; // LCD touch handle static lv_indev_t *disp_indev = NULL; -static bool i2c_initialized = false; -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) static adc_oneshot_unit_handle_t bsp_adc_handle = NULL; -#endif // This is just a wrapper to get function signature for espressif/button API callback static uint8_t bsp_get_main_button(void *param); @@ -44,9 +52,7 @@ static esp_err_t bsp_init_main_button(void *param); static const button_config_t bsp_button_config[BSP_BUTTON_NUM] = { { .type = BUTTON_TYPE_ADC, -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) .adc_button_config.adc_handle = &bsp_adc_handle, -#endif .adc_button_config.adc_channel = ADC_CHANNEL_4, // ADC1 channel 4 is GPIO5 .adc_button_config.button_index = BSP_BUTTON_REC, .adc_button_config.min = 2310, // middle is 2410mV @@ -54,9 +60,7 @@ static const button_config_t bsp_button_config[BSP_BUTTON_NUM] = { }, { .type = BUTTON_TYPE_ADC, -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) .adc_button_config.adc_handle = &bsp_adc_handle, -#endif .adc_button_config.adc_channel = ADC_CHANNEL_4, // ADC1 channel 4 is GPIO5 .adc_button_config.button_index = BSP_BUTTON_MUTE, .adc_button_config.min = 1880, // middle is 1980mV @@ -64,9 +68,7 @@ static const button_config_t bsp_button_config[BSP_BUTTON_NUM] = { }, { .type = BUTTON_TYPE_ADC, -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) .adc_button_config.adc_handle = &bsp_adc_handle, -#endif .adc_button_config.adc_channel = ADC_CHANNEL_4, // ADC1 channel 4 is GPIO5 .adc_button_config.button_index = BSP_BUTTON_PLAY, .adc_button_config.min = 1550, // middle is 1650mV @@ -74,9 +76,7 @@ static const button_config_t bsp_button_config[BSP_BUTTON_NUM] = { }, { .type = BUTTON_TYPE_ADC, -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) .adc_button_config.adc_handle = &bsp_adc_handle, -#endif .adc_button_config.adc_channel = ADC_CHANNEL_4, // ADC1 channel 4 is GPIO5 .adc_button_config.button_index = BSP_BUTTON_SET, .adc_button_config.min = 1010, // middle is 1110mV @@ -84,9 +84,7 @@ static const button_config_t bsp_button_config[BSP_BUTTON_NUM] = { }, { .type = BUTTON_TYPE_ADC, -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) .adc_button_config.adc_handle = &bsp_adc_handle, -#endif .adc_button_config.adc_channel = ADC_CHANNEL_4, // ADC1 channel 4 is GPIO5 .adc_button_config.button_index = BSP_BUTTON_VOLDOWN, .adc_button_config.min = 720, // middle is 820mV @@ -94,9 +92,7 @@ static const button_config_t bsp_button_config[BSP_BUTTON_NUM] = { }, { .type = BUTTON_TYPE_ADC, -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) .adc_button_config.adc_handle = &bsp_adc_handle, -#endif .adc_button_config.adc_channel = ADC_CHANNEL_4, // ADC1 channel 4 is GPIO5 .adc_button_config.button_index = BSP_BUTTON_VOLUP, .adc_button_config.min = 280, // middle is 380mV @@ -119,29 +115,31 @@ esp_err_t bsp_i2c_init(void) return ESP_OK; } - const i2c_config_t i2c_conf = { - .mode = I2C_MODE_MASTER, + const i2c_master_bus_config_t i2c_config = { + .i2c_port = BSP_I2C_NUM, .sda_io_num = BSP_I2C_SDA, - .sda_pullup_en = GPIO_PULLUP_DISABLE, .scl_io_num = BSP_I2C_SCL, - .scl_pullup_en = GPIO_PULLUP_DISABLE, - .master.clk_speed = CONFIG_BSP_I2C_CLK_SPEED_HZ + .clk_source = I2C_CLK_SRC_DEFAULT, + .flags.enable_internal_pullup = true, }; - BSP_ERROR_CHECK_RETURN_ERR(i2c_param_config(BSP_I2C_NUM, &i2c_conf)); - BSP_ERROR_CHECK_RETURN_ERR(i2c_driver_install(BSP_I2C_NUM, i2c_conf.mode, 0, 0, 0)); + BSP_ERROR_CHECK_RETURN_ERR(i2c_new_master_bus(&i2c_config, &i2c_handle)); i2c_initialized = true; - return ESP_OK; } esp_err_t bsp_i2c_deinit(void) { - BSP_ERROR_CHECK_RETURN_ERR(i2c_driver_delete(BSP_I2C_NUM)); + BSP_ERROR_CHECK_RETURN_ERR(i2c_del_master_bus(i2c_handle)); i2c_initialized = false; return ESP_OK; } +i2c_master_bus_handle_t bsp_i2c_get_handle(void) +{ + bsp_i2c_init(); + return i2c_handle; +} esp_err_t bsp_sdcard_mount(void) { @@ -198,6 +196,7 @@ esp_codec_dev_handle_t bsp_audio_codec_speaker_init(void) audio_codec_i2c_cfg_t i2c_cfg = { .port = BSP_I2C_NUM, .addr = ES8311_CODEC_DEFAULT_ADDR, + .bus_handle = i2c_handle, }; const audio_codec_ctrl_if_t *i2c_ctrl_if = audio_codec_new_i2c_ctrl(&i2c_cfg); BSP_NULL_CHECK(i2c_ctrl_if, NULL); @@ -246,6 +245,7 @@ esp_codec_dev_handle_t bsp_audio_codec_microphone_init(void) audio_codec_i2c_cfg_t i2c_cfg = { .port = BSP_I2C_NUM, .addr = ES7210_CODEC_DEFAULT_ADDR, + .bus_handle = i2c_handle, }; const audio_codec_ctrl_if_t *i2c_ctrl_if = audio_codec_new_i2c_ctrl(&i2c_cfg); BSP_NULL_CHECK(i2c_ctrl_if, NULL); @@ -273,13 +273,11 @@ esp_io_expander_handle_t bsp_io_expander_init(void) ESP_LOGD(TAG, "io_expander is initialized"); } else { // Here we try to initialize TCA9554 first, if it fails, we try to initialize TCA9554A - // *INDENT-OFF* - if ((esp_io_expander_new_i2c_tca9554(BSP_I2C_NUM, BSP_IO_EXPANDER_I2C_ADDRESS_TCA9554, &io_expander) != ESP_OK) && - (esp_io_expander_new_i2c_tca9554(BSP_I2C_NUM, BSP_IO_EXPANDER_I2C_ADDRESS_TCA9554A, &io_expander) != ESP_OK)) { - ESP_LOGE(TAG, "Failed to initialize IO expander"); - return NULL; + if (i2c_master_probe(i2c_handle, BSP_IO_EXPANDER_I2C_ADDRESS_TCA9554, 100) == ESP_OK) { + esp_io_expander_new_i2c_tca9554(i2c_handle, BSP_IO_EXPANDER_I2C_ADDRESS_TCA9554, &io_expander); + } else if (i2c_master_probe(i2c_handle, BSP_IO_EXPANDER_I2C_ADDRESS_TCA9554A, 100) == ESP_OK) { + esp_io_expander_new_i2c_tca9554(i2c_handle, BSP_IO_EXPANDER_I2C_ADDRESS_TCA9554A, &io_expander); } - // *INDENT-OFF* } return io_expander; @@ -397,6 +395,13 @@ static lv_display_t *bsp_display_lcd_init(const bsp_display_cfg_t *cfg) esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t *ret_touch) { + BSP_ERROR_CHECK_RETURN_ERR(bsp_i2c_init()); + + esp_lcd_panel_io_handle_t tp_io_handle = NULL; + esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_TT21100_CONFIG(); + tp_io_config.scl_speed_hz = CONFIG_BSP_I2C_CLK_SPEED_HZ; // This parameter was introduced together with I2C Driver-NG in IDF v5.2 + ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c(i2c_handle, &tp_io_config, &tp_io_handle), TAG, ""); + /* Initialize touch */ const esp_lcd_touch_config_t tp_cfg = { .x_max = BSP_LCD_H_RES, @@ -413,10 +418,6 @@ esp_err_t bsp_touch_new(const bsp_touch_config_t *config, esp_lcd_touch_handle_t .mirror_y = 0, }, }; - esp_lcd_panel_io_handle_t tp_io_handle = NULL; - const esp_lcd_panel_io_i2c_config_t tp_io_config = ESP_LCD_TOUCH_IO_I2C_TT21100_CONFIG(); - BSP_ERROR_CHECK_RETURN_ERR(bsp_i2c_init()); - ESP_RETURN_ON_ERROR(esp_lcd_new_panel_io_i2c((esp_lcd_i2c_bus_handle_t)BSP_I2C_NUM, &tp_io_config, &tp_io_handle), TAG, ""); return esp_lcd_touch_new_i2c_tt21100(tp_io_handle, &tp_cfg, ret_touch); } @@ -575,11 +576,9 @@ esp_err_t bsp_iot_button_create(button_handle_t btn_array[], int *btn_cnt, int b (btn_array == NULL)) { return ESP_ERR_INVALID_ARG; } -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) /* Initialize ADC and get ADC handle */ BSP_ERROR_CHECK_RETURN_NULL(bsp_adc_initialize()); bsp_adc_handle = bsp_adc_get_handle(); -#endif if (btn_cnt) { *btn_cnt = 0; diff --git a/bsp/esp32_s3_korvo_2/esp32_s3_korvo_2_idf4.c b/bsp/esp32_s3_korvo_2/esp32_s3_korvo_2_idf4.c deleted file mode 100644 index 60972e07..00000000 --- a/bsp/esp32_s3_korvo_2/esp32_s3_korvo_2_idf4.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include "esp_err.h" -#include "bsp/esp32_s3_korvo_2.h" -#include "bsp_err_check.h" -#include "esp_codec_dev_defaults.h" -#include "driver/adc.h" -#include "esp_adc_cal.h" - -static const char *TAG = "S3-KORVO-2"; - -/* This configuration is used by default in bsp_audio_init() */ -#define BSP_I2S_DUPLEX_MONO_CFG(_sample_rate) \ - { \ - .mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_RX, \ - .sample_rate = _sample_rate, \ - .bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT, \ - .channel_format = I2S_CHANNEL_FMT_ONLY_LEFT, \ - .communication_format = I2S_COMM_FORMAT_STAND_I2S, \ - .dma_buf_count = 3, \ - .dma_buf_len = 1024, \ - .use_apll = true, \ - .tx_desc_auto_clear = true, \ - .intr_alloc_flags = ESP_INTR_FLAG_LEVEL2 | ESP_INTR_FLAG_IRAM \ - } - -static const audio_codec_data_if_t *i2s_data_if = NULL; /* Codec data interface */ -static esp_adc_cal_characteristics_t bsp_adc_chars; - -esp_err_t bsp_audio_init(const i2s_config_t *i2s_config) -{ - esp_err_t ret = ESP_FAIL; - - if (i2s_data_if != NULL) { - /* Audio was initialized before */ - return ESP_OK; - } - - /* Setup I2S peripheral */ - const i2s_pin_config_t i2s_pin_config = { - .mck_io_num = BSP_I2S_MCLK, - .bck_io_num = BSP_I2S_SCLK, - .ws_io_num = BSP_I2S_LCLK, - .data_out_num = BSP_I2S_DOUT, - .data_in_num = BSP_I2S_DSIN - }; - - /* Setup I2S channels */ - const i2s_config_t std_cfg_default = BSP_I2S_DUPLEX_MONO_CFG(22050); - const i2s_config_t *p_i2s_cfg = &std_cfg_default; - if (i2s_config != NULL) { - p_i2s_cfg = i2s_config; - } - - ESP_ERROR_CHECK(i2s_driver_install(CONFIG_BSP_I2S_NUM, p_i2s_cfg, 0, NULL)); - ESP_GOTO_ON_ERROR(i2s_set_pin(CONFIG_BSP_I2S_NUM, &i2s_pin_config), err, TAG, "I2S set pin failed"); - - audio_codec_i2s_cfg_t i2s_cfg = { - .port = CONFIG_BSP_I2S_NUM, - }; - i2s_data_if = audio_codec_new_i2s_data(&i2s_cfg); - BSP_NULL_CHECK_GOTO(i2s_data_if, err); - - return ESP_OK; - -err: - i2s_driver_uninstall(CONFIG_BSP_I2S_NUM); - return ret; -} - -const audio_codec_data_if_t *bsp_audio_get_codec_itf(void) -{ - return i2s_data_if; -} - -esp_err_t bsp_adc_initialize(void) -{ - esp_err_t ret = ESP_OK; - BSP_ERROR_CHECK_RETURN_ERR(esp_adc_cal_check_efuse(ESP_ADC_CAL_VAL_EFUSE_TP_FIT)); - esp_adc_cal_characterize(ADC_UNIT_1, ADC_ATTEN_DB_11, ADC_WIDTH_BIT_DEFAULT, 0, &bsp_adc_chars); - - /* ADC1 config */ - BSP_ERROR_CHECK_RETURN_ERR(adc1_config_width(ADC_WIDTH_BIT_DEFAULT)); - return ret; -} - -esp_err_t bsp_voltage_init(void) -{ - BSP_ERROR_CHECK_RETURN_ERR(bsp_adc_initialize()); - BSP_ERROR_CHECK_RETURN_ERR(adc1_config_channel_atten(ADC1_CHANNEL_5, ADC_ATTEN_DB_11)); - - return ESP_OK; -} - -int bsp_voltage_battery_get(void) -{ - int voltage, adc_raw; - - adc_raw = adc1_get_raw(ADC1_CHANNEL_5); - voltage = esp_adc_cal_raw_to_voltage(adc_raw, &bsp_adc_chars); - return voltage * BSP_BATTERY_VOLTAGE_DIV; -} diff --git a/bsp/esp32_s3_korvo_2/idf_component.yml b/bsp/esp32_s3_korvo_2/idf_component.yml index 7bf08bf4..b6792fdc 100644 --- a/bsp/esp32_s3_korvo_2/idf_component.yml +++ b/bsp/esp32_s3_korvo_2/idf_component.yml @@ -1,4 +1,4 @@ -version: "2.2.1" +version: "3.0.0" description: Board Support Package (BSP) for ESP32-S3-Korvo-2 url: https://github.com/espressif/esp-bsp/tree/master/bsp/esp32_s3_korvo_2 @@ -9,20 +9,20 @@ tags: - bsp dependencies: - idf: ">=4.4.5" + idf: ">=5.4" # I2C Driver-NG is supported in esp32-camera only from IDFv5.4 esp_lcd_ili9341: "^1" esp_lcd_touch_tt21100: "^1" esp_io_expander_tca9554: - version: "^1" + version: "^2" public: true esp_codec_dev: - version: "^1.0.2,<1.2" + version: "~1.3.1" public: true esp32-camera: - version: "^2.0.2" + version: "^2.0.13" public: true button: diff --git a/bsp/esp32_s3_korvo_2/include/bsp/esp32_s3_korvo_2.h b/bsp/esp32_s3_korvo_2/include/bsp/esp32_s3_korvo_2.h index bb649e2a..ed962e76 100644 --- a/bsp/esp32_s3_korvo_2/include/bsp/esp32_s3_korvo_2.h +++ b/bsp/esp32_s3_korvo_2/include/bsp/esp32_s3_korvo_2.h @@ -8,8 +8,9 @@ #include "sdkconfig.h" #include "driver/gpio.h" -#include "driver/i2c.h" +#include "driver/i2s_std.h" #include "driver/sdmmc_host.h" +#include "esp_adc/adc_oneshot.h" #include "soc/usb_pins.h" #include "iot_button.h" #include "esp_io_expander.h" @@ -18,11 +19,6 @@ #include "esp_lvgl_port.h" #include "bsp/display.h" -#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) -#include "driver/i2s.h" -#else -#include "driver/i2s_std.h" -#endif /************************************************************************************************** * BSP Capabilities **************************************************************************************************/ @@ -202,7 +198,6 @@ esp_err_t bsp_iot_button_create(button_handle_t btn_array[], int *btn_cnt, int b * @brief Init audio * * @note There is no deinit audio function. Users can free audio resources by calling i2s_del_channel() - * @warning The type of i2s_config param is depending on IDF version. * @param[in] i2s_config I2S configuration. Pass NULL to use default values (Mono, duplex, 16bit, 22050 Hz) * @param[out] tx_channel I2S TX channel * @param[out] rx_channel I2S RX channel @@ -214,11 +209,7 @@ esp_err_t bsp_iot_button_create(button_handle_t btn_array[], int *btn_cnt, int b * - ESP_ERR_NO_MEM No memory for storing the channel information * - ESP_ERR_INVALID_STATE This channel has not initialized or already started */ -#if ESP_IDF_VERSION < ESP_IDF_VERSION_VAL(5, 0, 0) -esp_err_t bsp_audio_init(const i2s_config_t *i2s_config); -#else esp_err_t bsp_audio_init(const i2s_std_config_t *i2s_config); -#endif /** * @brief Get codec I2S interface (initialized in bsp_audio_init) @@ -252,8 +243,6 @@ esp_codec_dev_handle_t bsp_audio_codec_microphone_init(void); * - LCD Touch controller * - IO Expander TCA9554 * - Camera - * - * After initialization of I2C, use BSP_I2C_NUM macro when creating I2C device drivers **************************************************************************************************/ #define BSP_I2C_NUM CONFIG_BSP_I2C_NUM @@ -278,6 +267,13 @@ esp_err_t bsp_i2c_init(void); */ esp_err_t bsp_i2c_deinit(void); +/** + * @brief Get I2C driver handle + * + * @return + * - I2C handle + */ +i2c_master_bus_handle_t bsp_i2c_get_handle(void); /************************************************************************************************** * @@ -558,8 +554,6 @@ esp_err_t bsp_led_set(const bsp_led_t led_io, const bool on); */ esp_err_t bsp_adc_initialize(void); - -#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 0, 0) /** * @brief Get ADC handle * @@ -568,7 +562,6 @@ esp_err_t bsp_adc_initialize(void); * @return ADC handle */ adc_oneshot_unit_handle_t bsp_adc_get_handle(void); -#endif /************************************************************************************************** * diff --git a/examples/audio/sdkconfig.bsp.esp32_s3_korvo_2 b/examples/audio/sdkconfig.bsp.esp32_s3_korvo_2 index a01b1219..26f1803b 100644 --- a/examples/audio/sdkconfig.bsp.esp32_s3_korvo_2 +++ b/examples/audio/sdkconfig.bsp.esp32_s3_korvo_2 @@ -12,3 +12,4 @@ CONFIG_SPIFFS_PAGE_SIZE=1024 CONFIG_LV_USE_PERF_MONITOR=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n diff --git a/examples/display/sdkconfig.bsp.esp32_s3_korvo_2 b/examples/display/sdkconfig.bsp.esp32_s3_korvo_2 index 3ff98e29..1faf8d35 100644 --- a/examples/display/sdkconfig.bsp.esp32_s3_korvo_2 +++ b/examples/display/sdkconfig.bsp.esp32_s3_korvo_2 @@ -6,6 +6,7 @@ CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y CONFIG_ESP_DEFAULT_CPU_FREQ_240=y CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display_audio_photo/sdkconfig.bsp.esp32_s3_korvo_2 b/examples/display_audio_photo/sdkconfig.bsp.esp32_s3_korvo_2 index 9f4a5db4..59e852cb 100644 --- a/examples/display_audio_photo/sdkconfig.bsp.esp32_s3_korvo_2 +++ b/examples/display_audio_photo/sdkconfig.bsp.esp32_s3_korvo_2 @@ -12,6 +12,7 @@ CONFIG_ESP_DEFAULT_CPU_FREQ_MHZ_240=y CONFIG_SPIFFS_PAGE_SIZE=1024 CONFIG_LV_SPRINTF_CUSTOM=y # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display_camera/sdkconfig.bsp.esp32_s3_korvo_2 b/examples/display_camera/sdkconfig.bsp.esp32_s3_korvo_2 index 005f3c5e..8650b3f3 100644 --- a/examples/display_camera/sdkconfig.bsp.esp32_s3_korvo_2 +++ b/examples/display_camera/sdkconfig.bsp.esp32_s3_korvo_2 @@ -15,6 +15,7 @@ CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY=y CONFIG_LV_SPRINTF_CUSTOM=y CAMERA_TASK_STACK_SIZE=4096 # CONFIG_LV_BUILD_EXAMPLES is not set +CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display_lvgl_demos/sdkconfig.bsp.esp32_s3_korvo_2 b/examples/display_lvgl_demos/sdkconfig.bsp.esp32_s3_korvo_2 index a177bdc6..d321aabf 100644 --- a/examples/display_lvgl_demos/sdkconfig.bsp.esp32_s3_korvo_2 +++ b/examples/display_lvgl_demos/sdkconfig.bsp.esp32_s3_korvo_2 @@ -22,6 +22,7 @@ CONFIG_LV_USE_DEMO_STRESS=y CONFIG_LV_USE_DEMO_MUSIC=y CONFIG_LV_DEMO_MUSIC_AUTO_PLAY=y CONFIG_LV_DEMO_MUSIC_SQUARE=y +CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n ## LVGL8 ## CONFIG_LV_USE_PERF_MONITOR=y diff --git a/examples/display_rotation/sdkconfig.bsp.esp32_s3_korvo_2 b/examples/display_rotation/sdkconfig.bsp.esp32_s3_korvo_2 index c862604d..cebef8bd 100644 --- a/examples/display_rotation/sdkconfig.bsp.esp32_s3_korvo_2 +++ b/examples/display_rotation/sdkconfig.bsp.esp32_s3_korvo_2 @@ -9,6 +9,7 @@ CONFIG_LV_USE_PERF_MONITOR=y CONFIG_LV_COLOR_16_SWAP=y CONFIG_LV_MEM_CUSTOM=y CONFIG_LV_MEMCPY_MEMSET_STD=y +CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n ## LVGL9 ## CONFIG_LV_CONF_SKIP=y