forked from espressif/esp-idf
refactor(i2s_es8311): remove esp-box bsp support
This commit is contained in:
@@ -75,11 +75,4 @@ menu "Example Configuration"
|
||||
default 60
|
||||
help
|
||||
Set voice volume
|
||||
|
||||
config EXAMPLE_BSP
|
||||
bool "Enable Board Support Package (BSP) support"
|
||||
default n
|
||||
select CODEC_I2C_BACKWARD_COMPATIBLE
|
||||
help
|
||||
Use BSP to setup all hardware settings. Specific board must be selected in main/idf_component.yml file.
|
||||
endmenu
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#define EXAMPLE_MIC_GAIN CONFIG_EXAMPLE_MIC_GAIN
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_EXAMPLE_BSP
|
||||
/* I2C port and GPIOs */
|
||||
#define I2C_NUM (0)
|
||||
#define I2C_SCL_IO CONFIG_EXAMPLE_I2C_SCL_IO
|
||||
@@ -32,10 +31,3 @@
|
||||
#define I2S_WS_IO CONFIG_EXAMPLE_I2S_WS_IO
|
||||
#define I2S_DO_IO CONFIG_EXAMPLE_I2S_DOUT_IO
|
||||
#define I2S_DI_IO CONFIG_EXAMPLE_I2S_DIN_IO
|
||||
|
||||
#else // CONFIG_EXAMPLE_BSP
|
||||
#include "bsp/esp-bsp.h"
|
||||
#define I2C_NUM BSP_I2C_NUM
|
||||
#define I2S_NUM (0)
|
||||
|
||||
#endif // CONFIG_EXAMPLE_BSP
|
||||
|
@@ -10,9 +10,7 @@
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "driver/i2s_std.h"
|
||||
#ifndef CONFIG_EXAMPLE_BSP
|
||||
#include "driver/i2c_master.h"
|
||||
#endif
|
||||
#include "driver/gpio.h"
|
||||
#include "esp_system.h"
|
||||
#include "esp_codec_dev_defaults.h"
|
||||
@@ -37,7 +35,6 @@ extern const uint8_t music_pcm_end[] asm("_binary_canon_pcm_end");
|
||||
static esp_err_t es8311_codec_init(void)
|
||||
{
|
||||
/* Initialize I2C peripheral */
|
||||
#ifndef CONFIG_EXAMPLE_BSP
|
||||
i2c_master_bus_handle_t i2c_bus_handle = NULL;
|
||||
i2c_master_bus_config_t i2c_mst_cfg = {
|
||||
.i2c_port = I2C_NUM,
|
||||
@@ -50,17 +47,12 @@ static esp_err_t es8311_codec_init(void)
|
||||
.flags.enable_internal_pullup = true,
|
||||
};
|
||||
ESP_ERROR_CHECK(i2c_new_master_bus(&i2c_mst_cfg, &i2c_bus_handle));
|
||||
#else
|
||||
ESP_ERROR_CHECK(bsp_i2c_init());
|
||||
#endif
|
||||
|
||||
/* Create control interface with I2C bus handle */
|
||||
audio_codec_i2c_cfg_t i2c_cfg = {
|
||||
.port = I2C_NUM,
|
||||
.addr = ES8311_CODEC_DEFAULT_ADDR,
|
||||
#ifndef CONFIG_EXAMPLE_BSP
|
||||
.bus_handle = i2c_bus_handle,
|
||||
#endif
|
||||
};
|
||||
const audio_codec_ctrl_if_t *ctrl_if = audio_codec_new_i2c_ctrl(&i2c_cfg);
|
||||
assert(ctrl_if);
|
||||
@@ -82,7 +74,7 @@ static esp_err_t es8311_codec_init(void)
|
||||
.gpio_if = gpio_if,
|
||||
.codec_mode = ESP_CODEC_DEV_WORK_MODE_BOTH,
|
||||
.master_mode = false,
|
||||
.use_mclk = true,
|
||||
.use_mclk = I2S_MCK_IO >= 0,
|
||||
.pa_pin = EXAMPLE_PA_CTRL_IO,
|
||||
.pa_reverted = false,
|
||||
.hw_gain = {
|
||||
@@ -131,7 +123,6 @@ static esp_err_t es8311_codec_init(void)
|
||||
|
||||
static esp_err_t i2s_driver_init(void)
|
||||
{
|
||||
#ifndef CONFIG_EXAMPLE_BSP
|
||||
i2s_chan_config_t chan_cfg = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM, I2S_ROLE_MASTER);
|
||||
chan_cfg.auto_clear = true; // Auto clear the legacy data in the DMA buffer
|
||||
ESP_ERROR_CHECK(i2s_new_channel(&chan_cfg, &tx_handle, &rx_handle));
|
||||
@@ -157,17 +148,6 @@ static esp_err_t i2s_driver_init(void)
|
||||
ESP_ERROR_CHECK(i2s_channel_init_std_mode(rx_handle, &std_cfg));
|
||||
ESP_ERROR_CHECK(i2s_channel_enable(tx_handle));
|
||||
ESP_ERROR_CHECK(i2s_channel_enable(rx_handle));
|
||||
#else
|
||||
ESP_LOGI(TAG, "Using BSP for HW configuration");
|
||||
i2s_std_config_t std_cfg = {
|
||||
.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(EXAMPLE_SAMPLE_RATE),
|
||||
.slot_cfg = I2S_STD_PHILIPS_SLOT_DEFAULT_CONFIG(I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO),
|
||||
.gpio_cfg = BSP_I2S_GPIO_CFG,
|
||||
};
|
||||
std_cfg.clk_cfg.mclk_multiple = EXAMPLE_MCLK_MULTIPLE;
|
||||
ESP_ERROR_CHECK(bsp_audio_init(&std_cfg, &tx_handle, &rx_handle));
|
||||
ESP_ERROR_CHECK(bsp_audio_poweramp_enable(true));
|
||||
#endif
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
@@ -2,19 +2,5 @@
|
||||
dependencies:
|
||||
idf: "^5.0"
|
||||
espressif/esp_codec_dev: ^1.3.4
|
||||
|
||||
# After enabling Board Support Packages support in menuconfig, you can pick you specific BSP here
|
||||
espressif/esp-box:
|
||||
version: "^2.4.2"
|
||||
rules:
|
||||
- if: "target in [esp32s3]"
|
||||
#espressif/esp32_s2_kaluga_kit:
|
||||
# version: "^2.1.1"
|
||||
# rules:
|
||||
# - if: "target in [esp32s2]"
|
||||
#espressif/esp32_s3_lcd_ev_board:
|
||||
# version: "^1"
|
||||
# rules:
|
||||
# - if: "target in [esp32s3]"
|
||||
i2s_examples_common:
|
||||
path: ${IDF_PATH}/examples/peripherals/i2s/i2s_examples_common
|
||||
|
@@ -30,27 +30,5 @@ def test_i2s_es8311_example_korvo2_v3(dut: Dut) -> None:
|
||||
dut.expect(r'i2s es8311 codec example start')
|
||||
dut.expect(r'-----------------------------')
|
||||
dut.expect(r'i2s_es8311: i2s driver init success')
|
||||
dut.expect(r'ES8311: Work in Slave mode')
|
||||
dut.expect(r'I2S_IF: channel mode [0-9]+ bits:[0-9]+/[0-9]+ channel:[0-9]+ mask:[0-9]+')
|
||||
dut.expect(r'I2S_IF: STD Mode [0-9]+ bits:[0-9]+/[0-9]+ channel:[0-9]+ sample_rate:[0-9]+ mask:[0-9]+')
|
||||
dut.expect(r'I2S_IF: channel mode [0-9]+ bits:[0-9]+/[0-9]+ channel:[0-9]+ mask:[0-9]+')
|
||||
dut.expect(r'I2S_IF: STD Mode [0-9]+ bits:[0-9]+/[0-9]+ channel:[0-9]+ sample_rate:[0-9]+ mask:[0-9]+')
|
||||
dut.expect(r'Adev_Codec: Open codec device OK')
|
||||
dut.expect(r'i2s_es8311: es8311 codec init success')
|
||||
dut.expect(r'Returned from app_main\(\)')
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'bsp',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_i2s_es8311_example_bsp(dut: Dut) -> None:
|
||||
dut.expect('i2s es8311 codec example start')
|
||||
dut.expect('-----------------------------')
|
||||
dut.expect('Using BSP for HW configuration')
|
||||
dut.expect('i2s_es8311: i2s driver init success')
|
||||
|
@@ -1,3 +0,0 @@
|
||||
CONFIG_IDF_TARGET="esp32s3"
|
||||
CONFIG_EXAMPLE_BSP=y
|
||||
CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=y
|
@@ -124,7 +124,6 @@ ENV_MARKERS = {
|
||||
'flash_4mb': 'C2 runners with 4 MB flash',
|
||||
'jtag_re_enable': 'Runner to re-enable jtag which is softly disabled by burning bit SOFT_DIS_JTAG on eFuse',
|
||||
'es8311': 'Development board that carries es8311 codec',
|
||||
'es7210': 'Development board that carries es7210 codec',
|
||||
# multi-dut markers
|
||||
'multi_dut_modbus_rs485': 'a pair of runners connected by RS485 bus',
|
||||
'ieee802154': 'ieee802154 related tests should run on ieee802154 runners.',
|
||||
|
Reference in New Issue
Block a user