Hi wulph1,
I've recently had to use esp-adf on custom hardware. To do this i've implemented a custom driver for the TLV320AIC3110.
In terms of project hirarchy.
1. Create a component in your own project /component/audio to host custom driver and board definition.
2. In this component folder i've created a second sub folder called, for example, my_board ( /component/audio/my_board )
3. In the component.mk file within this folder i've added the following lines
Code: Select all
ifdef CONFIG_ESP_MY_BOARD_V1
COMPONENT_ADD_INCLUDEDIRS += ./my_board/src
COMPONENT_SRCDIRS += ./my_board/include
endif
4. Update your project kconfig to include the above #define
Code: Select all
#Audio HAL has been redefined here so each of the
# config's from the esp-adf are overriden.
# This is done to avoid making any changes to
# the esp-adf library source files.
menu "Audio HAL"
choice AUDIO_BOARD
prompt "Audio board"
default ESP_MY_BOARD_V1
help
Select an audio board to use with the ESP-ADF
config ESP_LYRAT_V4_3_BOARD
bool "ESP32-Lyrat V4.3"
config ESP_LYRAT_V4_2_BOARD
bool "ESP32-Lyrat V4.2"
config ESP_LYRATD_MSC_V2_1_BOARD
bool "ESP32-LyraTD-MSC V2.1"
config ESP_LYRATD_MSC_V2_2_BOARD
bool "ESP32-LyraTD-MSC V2.2"
config ESP_LYRAT_MINI_V1_1_BOARD
bool "ESP32-Lyrat-Mini V1.1"
config ESP_MY_BOARD_V1
bool "ESP32 My Board V1.0"
endchoice
endmenu
5. Create your own copy of board.c and board.h place these in /component/audio/my_board/src and /component/audio/my_board/include respectively.
6. Similarly do the same for board_pins_config.c and board_def.h ( it is in board_pins_config.c that I've defined i2s pins i2c pins and button pins.
7. In your custom driver you will also need to create the global variable that implements the interface functions for example
Code: Select all
audio_hal_func_t AUDIO_CODEC_AIC31XX_DEFAULT_HANDLE = { .audio_codec_initialize = aic31xx_init, .audio_codec_deinitialize = aic31xx_adc_deinit, .audio_codec_ctrl = aic31xx_adc_ctrl_state, .audio_codec_config_iface = aic31xx_config_i2s, .audio_codec_set_mute = aic31xx_spl_spr_mute, .audio_codec_set_volume = aic31xx_set_spl_spr_volume, .audio_codec_get_volume = aic31xx_spl_spr_get_volume, };
This is an implementation for TLV320AIC3110 your's may differ (they are just function names thought so whatever is your preference).
8. Place your driver source code in /component/audio/my_board/src
Hope this helps.
Jon