ZL38063 Driver

Driver for ZL38063 codec chip used in ESP32-LyraTD-MSC audio board.

API Reference

Header File

Functions

esp_err_t zl38063_codec_init(audio_hal_codec_config_t *cfg)

Initialize ZL38063 chip.

Parameters

cfg – configuration of ZL38063

Returns

  • ESP_OK

  • ESP_FAIL

esp_err_t zl38063_codec_deinit(void)

Deinitialize ZL38063 chip.

Returns

  • ESP_OK

  • ESP_FAIL

esp_err_t zl38063_codec_ctrl_state(audio_hal_codec_mode_t mode, audio_hal_ctrl_t ctrl_state)

Control ZL38063 chip.

The functions zl38063_ctrl_state and zl38063_config_i2s are not used by this driver. They are kept here to maintain the uniformity and convenience of the interface of the ADF project. These settings for zl38063 are burned in firmware and configuration files. Default i2s configuration: 48000Hz, 16bit, Left-Right channels. Use resampling to be compatible with different file types.

Parameters
  • mode – codec mode

  • ctrl_state – start or stop decode or encode progress

Returns

  • ESP_FAIL Parameter error

  • ESP_OK Success

esp_err_t zl38063_codec_config_i2s(audio_hal_codec_mode_t mode, audio_hal_codec_i2s_iface_t *iface)

Configure ZL38063 codec mode and I2S interface.

Parameters
  • mode – codec mode

  • iface – I2S config

Returns

  • ESP_FAIL Parameter error

  • ESP_OK Success

esp_err_t zl38063_codec_set_voice_mute(bool mute)

mute or unmute the codec

Parameters

mute – true, false

Returns

  • ESP_OK

  • ESP_FAIL

esp_err_t zl38063_codec_set_voice_volume(int volume)

Set voice volume.

Parameters

volume – voice volume (0~100)

Returns

  • ESP_OK

  • ESP_FAIL

esp_err_t zl38063_codec_get_voice_volume(int *volume)

Get voice volume.

Parameters

*volume[out] voice volume (0~100)

Returns

  • ESP_OK

  • ESP_FAIL