Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

esp audio board support and wm8978 codec driver (AUD-619) #33

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "esp-idf"]
path = esp-idf
url = https://github.com/espressif/esp-idf
[submodule "components/esp-adf-libs"]
path = components/esp-adf-libs
url = https://github.com/espressif/esp-adf-libs
2 changes: 2 additions & 0 deletions components/audio_hal/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ config ESP_LYRAT_V4_3_BOARD
bool "ESP32-Lyrat V4.3"
config ESP_LYRAT_V4_2_BOARD
bool "ESP32-Lyrat V4.2"
config WHYENGINEER_LIN_BOARD
bool "WhyEngineer Lin Audio board"
endchoice

endmenu
15 changes: 15 additions & 0 deletions components/audio_hal/audio_hal.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "audio_mutex.h"
#include "es8374.h"
#include "es8388.h"
#include "wm8978.h"

static const char *TAG = "AUDIO_HAL";

Expand All @@ -52,6 +53,7 @@ struct audio_hal {
};

static struct audio_hal audio_hal_codecs_default[] = {
#if (defined CONFIG_ESP_LYRAT_V4_3_BOARD) ||(defined CONFIG_ESP_LYRAT_V4_2_BOARD)
{
.audio_codec_initialize = es8388_init,
.audio_codec_deinitialize = es8388_deinit,
Expand All @@ -67,7 +69,18 @@ static struct audio_hal audio_hal_codecs_default[] = {
.audio_codec_config_iface = es8374_config_i2s,
.audio_codec_set_volume = es8374_set_voice_volume,
.audio_codec_get_volume = es8374_get_voice_volume,
},
#endif
#ifdef CONFIG_WHYENGINEER_LIN_BOARD
{
.audio_codec_initialize =wm8978_init,
.audio_codec_deinitialize=wm8978_deinit,
.audio_codec_ctrl=wm8978_ctrl_state,
.audio_codec_config_iface=wm8978_config_i2s,
.audio_codec_set_volume=wm8978_set_voice_volume,
.audio_codec_get_volume=wm8978_get_voice_volume,
}
#endif
};

audio_hal_handle_t audio_hal_init(audio_hal_codec_config_t* audio_hal_conf, int index)
Expand All @@ -93,7 +106,9 @@ audio_hal_handle_t audio_hal_init(audio_hal_codec_config_t* audio_hal_conf, int
audio_hal->handle = audio_hal;
audio_hal_codecs_default[index].handle = audio_hal;
mutex_unlock(audio_hal->audio_hal_lock);
#if (defined CONFIG_ESP_LYRAT_V4_3_BOARD) ||(defined CONFIG_ESP_LYRAT_V4_2_BOARD)
es8388_pa_power(true);
#endif
return audio_hal;
}

Expand Down
4 changes: 4 additions & 0 deletions components/audio_hal/board/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ extern "C" {
#include "lyrat_v4_2_board.h"
#endif

#ifdef CONFIG_WHYENGINEER_LIN_BOARD
#include "we_lin_board.h"
#endif


#ifdef __cplusplus
}
Expand Down
66 changes: 66 additions & 0 deletions components/audio_hal/board/we_lin_board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* ESPRESSIF MIT License
*
* Copyright (c) 2018 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
*
* Permission is hereby granted for use on all ESPRESSIF SYSTEMS products, in which case,
* it is free of charge, to any person obtaining a copy of this software and associated
* documentation files (the "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished
* to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/

#ifndef _WHYENGINEER_BOARD_H_
#define _WHYENGINEER_BOARD_H_

#ifdef __cplusplus
extern "C" {
#endif

#define SD_CARD_OPEN_FILE_NUM_MAX 5

#define IIC_PORT 0
#define IIC_DATA 19
#define IIC_CLK 18


/* I2S gpios */
#define IIS_SCLK 33
#define IIS_LCLK 25
#define IIS_DSIN 26
#define IIS_DOUT 27


#define LED_R 5
#define LED_G 21
#define LED_B 22

#define KEY_1_SEL GPIO_SEL_34
#define KEY_2_SEL GPIO_SEL_35
#define KEY_3_SEL GPIO_SEL_32

#define KEY_1_NUM GPIO_NUM_34
#define KEY_2_NUM GPIO_NUM_35
#define KEY_3_NUM GPIO_NUM_32

#define SD_CARD_INTR_GPIO 23
#define SD_CARD_INTR_SEL 23


#ifdef __cplusplus
}
#endif

#endif
10 changes: 8 additions & 2 deletions components/audio_hal/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
# (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)


COMPONENT_ADD_INCLUDEDIRS := ./include ./driver/es8388 ./board ./driver/es8374
COMPONENT_ADD_INCLUDEDIRS := ./include ./driver/es8388 ./board ./driver/es8374 ./driver/wm8978

COMPONENT_SRCDIRS := . ./driver/es8388 ./board ./driver/es8374

#COMPONENT_SRCDIRS :=. ./driver/es8388 ./board ./driver/es8374 ./driver/wm8978
ifdef CONFIG_WHYENGINEER_LIN_BOARD
COMPONENT_SRCDIRS := . ./driver/wm8978
else
COMPONENT_SRCDIRS := . ./driver/es8388 ./board ./driver/es8374
endif
Loading