Skip to content

i2s_driver.h

Generated from i2s_driver.h in platform-idf. Edit the header’s doxygen comments to change this page.

BSP I2S Dual Driver.

esp_err_t bsp_i2s_init_dual(const i2s_std_config_t *i2s_config)

Initialize dual I2S interfaces for codec input.

This function initializes both I2S interfaces (I2S0 and I2S1) for stereo codec input.

  • I2S0 operates in MASTER mode and provides clock signals
  • I2S1 operates in SLAVE mode and shares clock signals from I2S0

Parameters

  • i2s_config — I2S standard configuration. Pass NULL to use default values (Stereo, 16-bit, bsp_i2s_get_sample_rate() Hz, Philips mode)

Returns

  • ESP_OK on success
  • ESP_ERR_INVALID_ARG if configuration is invalid
  • ESP_ERR_NO_MEM if memory allocation failed
  • ESP_FAIL on other errors

Declared in i2s_driver.h:44.

void bsp_i2s_set_sample_rate(uint32_t hz)

Declared in i2s_driver.h:50.

uint32_t bsp_i2s_get_sample_rate(void)

Declared in i2s_driver.h:51.

esp_err_t bsp_i2s_deinit_all(void)

Deinitialize all I2S interfaces.

Returns

  • ESP_OK on success
  • ESP_FAIL on failure

Declared in i2s_driver.h:60.

i2s_chan_handle_t bsp_i2s_get_tx_handle(bsp_i2s_interface_t interface)

Get I2S TX channel handle for specific interface.

Parameters

  • interface — I2S interface identifier

Returns

i2s_chan_handle_t TX channel handle or NULL if not initialized

Declared in i2s_driver.h:68.

i2s_chan_handle_t bsp_i2s_get_rx_handle(bsp_i2s_interface_t interface)

Get I2S RX channel handle for specific interface.

Parameters

  • interface — I2S interface identifier

Returns

i2s_chan_handle_t RX channel handle or NULL if not initialized

Declared in i2s_driver.h:76.

const audio_codec_data_if_t * bsp_i2s_get_codec_itf(bsp_i2s_interface_t interface)

Get codec data interface for specific I2S interface.

This function returns the ESP-ADF codec data interface for the specified I2S interface, which can be used with other ESP-ADF audio components.

Parameters

  • interface — I2S interface identifier

Returns

Pointer to audio codec data interface or NULL if not initialized

Declared in i2s_driver.h:87.

esp_err_t bsp_i2s_es8388_init(i2c_master_bus_handle_t i2c_handle, const i2s_std_config_t *i2s_config, bool dual_codec)

Initialize I2S with ES8388 codec.

This is a convenience function that initializes both I2S interfaces and ES8388 codecs. It configures:

  • I2S0 as MASTER with ES8388 codec 0
  • I2S1 as SLAVE with ES8388 codec 1 (if enabled)

Parameters

  • i2c_handle — I2C master bus handle (must be initialized)
  • i2s_config — I2S configuration. Pass NULL to use defaults
  • dual_codec — Enable second ES8388 codec on I2S1 interface

Returns

  • ESP_OK on success
  • ESP_ERR_INVALID_ARG if i2c_handle is NULL
  • ESP_FAIL on other errors

Declared in i2s_driver.h:106.

esp_err_t bsp_i2s_es8388_deinit(void)

Deinitialize I2S and ES8388 codecs.

Returns

ESP_OK on success

Declared in i2s_driver.h:115.

I2S interface identifier.

ValueValueDescription
BSP_I2S_INTERFACE_00Primary I2S interface (I2S_NUM_0)
BSP_I2S_INTERFACE_11Secondary I2S interface (I2S_NUM_1)
BSP_I2S_INTERFACE_MAX

Declared in i2s_driver.h:22.

MacroValueDescription
BSP_I2S_DEFAULT_SAMPLE_RATE48000