-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bsp: Added support for IDF v4.4 into ESP32-S3-EYE
- Loading branch information
Showing
9 changed files
with
550 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
examples: | ||
disable: | ||
- if: IDF_VERSION_MAJOR < 5 and CONFIG_NAME not in ["esp-box", "esp-box-lite"] | ||
- if: IDF_VERSION_MAJOR < 5 and CONFIG_NAME not in ["esp-box", "esp-box-lite", "esp32_s3_eye"] | ||
reason: Example depends on BSP, which is supported only for IDF >= 5.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,14 @@ | ||
#IDF version is less than IDF5.0 | ||
if("${IDF_VERSION_MAJOR}.${IDF_VERSION_MINOR}" VERSION_LESS "5.0") | ||
set(SRC_VER "esp32_s3_eye_idf4.c") | ||
else() | ||
set(SRC_VER "esp32_s3_eye_idf5.c") | ||
endif() | ||
|
||
idf_component_register( | ||
SRCS "esp32_s3_eye.c" | ||
SRCS "esp32_s3_eye.c" ${SRC_VER} | ||
INCLUDE_DIRS "include" | ||
PRIV_INCLUDE_DIRS "priv_include" | ||
REQUIRES driver | ||
REQUIRES driver spiffs | ||
PRIV_REQUIRES fatfs esp_lcd | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include "esp_err.h" | ||
#include "bsp/esp32_s3_eye.h" | ||
#include "bsp_err_check.h" | ||
#include "esp_codec_dev_defaults.h" | ||
|
||
static const char *TAG = "ESP-BOX"; | ||
|
||
/* Sample rate of MSM261S4030H0 */ | ||
#define BSP_MIC_SAMPLE_RATE (48000u) | ||
|
||
/* This configuration is used by default in bsp_audio_init() */ | ||
#define BSP_I2S_SIMPLEX_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 */ | ||
|
||
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 = GPIO_NUM_NC, | ||
.bck_io_num = BSP_I2S_SCLK, | ||
.ws_io_num = BSP_I2S_LCLK, | ||
.data_out_num = GPIO_NUM_NC, | ||
.data_in_num = BSP_I2S_DIN | ||
}; | ||
|
||
/* Setup I2S channels */ | ||
const i2s_config_t std_cfg_default = BSP_I2S_SIMPLEX_MONO_CFG(BSP_MIC_SAMPLE_RATE); | ||
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) | ||
{ | ||
return ESP_OK; | ||
} |
Oops, something went wrong.