Skip to content
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ coverage_report/

.vscode
mycode
/examples/player/pipeline_http_opus/sdkconfig.defaults
11 changes: 10 additions & 1 deletion components/audio_board/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ set(COMPONENT_ADD_INCLUDEDIRS ./include)

# Edit following two lines to set component requirements (see docs)
set(COMPONENT_REQUIRES )
set(COMPONENT_PRIV_REQUIRES audio_sal audio_hal esp_dispatcher esp_peripherals display_service)
set(COMPONENT_PRIV_REQUIRES esp_peripherals audio_sal audio_hal esp_dispatcher display_service)


if (CONFIG_ESP_LYRAT_V4_2_BOARD)
Expand Down Expand Up @@ -79,4 +79,13 @@ set(COMPONENT_SRCS
)
endif()

if (CONFIG_HAMWIFI_BOARD)
message(STATUS "Current board name is " CONFIG_HANWIFI_BOARD)
list(APPEND COMPONENT_ADD_INCLUDEDIRS ./hamwifi)
set(COMPONENT_SRCS
./hamwifi/board.c
./hamwifi/board_pins_config.c
)
endif()

register_component()
4 changes: 3 additions & 1 deletion components/audio_board/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ config ESP32_S2_KALUGA_1_V1_2_BOARD
bool "ESP32-S2-Kaluga-1 v1.2"
config ESP_AI_THINKER_V2_2_BOARD
bool "ESP32-AiThinker-audio V2.2"
config HAMWIFI_BOARD
bool "HAMWIFI"

endchoice

choice ESP32_KORVO_DU1906_DAC
prompt "ESP32 KORVO DU1906 Board DAC chip"
depends on ESP32_KORVO_DU1906_BOARD
default ESP32_KORVO_DU1906_CODEC_TAS5805M
default ESP32_KORVO_DU1906_DAC_TAS5805M
help
Select DAC chip to use on ESP32_KORVO_DU1906 board

Expand Down
52 changes: 47 additions & 5 deletions components/audio_board/ai_thinker_audio_kit_v2_2/board.c
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "esp_log.h"
#include "board.h"
#include "audio_mem.h"

#include "periph_sdcard.h"
#include "led_indicator.h"
#include "periph_touch.h"
Expand Down Expand Up @@ -78,30 +79,71 @@ display_service_handle_t audio_board_led_init(void)
return display_service_create(&display);
}

display_service_handle_t audio_board_blue_led_init(void)
{
led_indicator_handle_t led = led_indicator_init((gpio_num_t)get_blue_led_gpio());
display_service_config_t display = {
.based_cfg = {
.task_stack = 0,
.task_prio = 0,
.task_core = 0,
.task_func = NULL,
.service_start = NULL,
.service_stop = NULL,
.service_destroy = NULL,
.service_ioctl = led_indicator_pattern,
.service_name = "DISPLAY_serv",
.user_data = NULL,
},
.instance = led,
};

return display_service_create(&display);
}

esp_err_t audio_board_key_init(esp_periph_set_handle_t set)
{
esp_err_t ret = ESP_OK;

periph_button_cfg_t btn_cfg = {
.gpio_mask = TOUCH_SEL_SET | TOUCH_SEL_PLAY | TOUCH_SEL_VOLUP | TOUCH_SEL_VOLDWN, //REC BTN & MODE BTN
.gpio_mask = TOUCH_SEL_SET | TOUCH_SEL_PLAY | TOUCH_SEL_VOLUP | TOUCH_SEL_VOLDWN | TOUCH_SEL_REC | TOUCH_SEL_REC, //REC BTN & MODE BTN
};
esp_periph_handle_t button_handle = periph_button_init(&btn_cfg);
AUDIO_NULL_CHECK(TAG, button_handle, return ESP_ERR_ADF_MEMORY_LACK);

ret = esp_periph_start(set, button_handle);
return ret;
}

esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set)
esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, periph_sdcard_mode_t mode)
{
if (mode != SD_MODE_1_LINE) {
ESP_LOGE(TAG, "current board only support 1-line SD mode!");
return ESP_FAIL;
}
// if (mode >= SD_MODE_MAX) {
// ESP_LOGE(TAG, "PLease select the correct sd mode!, current mode is %d", mode);
// return ESP_FAIL;
// }
periph_sdcard_cfg_t sdcard_cfg = {
.root = "/sdcard",
.card_detect_pin = get_sdcard_intr_gpio(), // GPIO_NUM_34
.mode = mode,
};
esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg);
esp_err_t ret = esp_periph_start(set, sdcard_handle);
while (!periph_sdcard_is_mounted(sdcard_handle)) {
vTaskDelay(500 / portTICK_PERIOD_MS);
int retry_time = 5;
bool mount_flag = false;
while (retry_time --) {
if (periph_sdcard_is_mounted(sdcard_handle)) {
mount_flag = true;
break;
} else {
vTaskDelay(500 / portTICK_PERIOD_MS);
}
}
if (mount_flag == false) {
ESP_LOGE(TAG, "Sdcard mount failed");
return ESP_FAIL;
}
return ret;
}
Expand Down
10 changes: 9 additions & 1 deletion components/audio_board/ai_thinker_audio_kit_v2_2/board.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "board_pins_config.h"
#include "esp_peripherals.h"
#include "display_service.h"
#include "periph_sdcard.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -73,6 +74,13 @@ audio_hal_handle_t audio_board_adc_init(void);
*/
display_service_handle_t audio_board_led_init(void);

/**
* @brief Initialize led peripheral and display service
*
* @return The audio display service handle
*/
display_service_handle_t audio_board_blue_led_init(void);

/**
* @brief Initialize key peripheral
*
Expand All @@ -94,7 +102,7 @@ esp_err_t audio_board_key_init(esp_periph_set_handle_t set);
* - ESP_OK, success
* - Others, fail
*/
esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set);
esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, periph_sdcard_mode_t mode);


/**
Expand Down
2 changes: 2 additions & 0 deletions components/audio_board/ai_thinker_audio_kit_v2_2/board_def.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
#define TOUCH_SEL_PLAY GPIO_SEL_23
#define TOUCH_SEL_VOLUP GPIO_SEL_18
#define TOUCH_SEL_VOLDWN GPIO_SEL_5
#define TOUCH_SEL_REC GPIO_SEL_36
#define TOUCH_SEL_MODE GPIO_SEL_13

#define TOUCH_SET GPIO_NUM_19
#define TOUCH_PLAY GPIO_NUM_23
Expand Down
Empty file.
4 changes: 4 additions & 0 deletions components/audio_board/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,7 @@ COMPONENT_ADD_INCLUDEDIRS += ./ai_thinker_audio_kit_v2_2
COMPONENT_SRCDIRS += ./ai_thinker_audio_kit_v2_2
endif

ifdef CONFIG_HAMWIFI_BOARD
COMPONENT_ADD_INCLUDEDIRS += ./hamwifi
COMPONENT_SRCDIRS += ./hamwifi
endif
7 changes: 6 additions & 1 deletion components/audio_board/esp32_korvo_du1906/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,16 @@ esp_err_t audio_board_key_init(esp_periph_set_handle_t set)
return ret;
}

esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set)
esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, periph_sdcard_mode_t mode)
{
if (mode != SD_MODE_1_LINE) {
ESP_LOGE(TAG, "current board only support 1-line SD mode!");
return ESP_FAIL;
}
periph_sdcard_cfg_t sdcard_cfg = {
.root = "/sdcard",
.card_detect_pin = get_sdcard_intr_gpio(), // GPIO_NUM_34
.mode = mode
};
esp_periph_handle_t sdcard_handle = periph_sdcard_init(&sdcard_cfg);
esp_err_t ret = esp_periph_start(set, sdcard_handle);
Expand Down
3 changes: 2 additions & 1 deletion components/audio_board/esp32_korvo_du1906/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "board_pins_config.h"
#include "esp_peripherals.h"
#include "display_service.h"
#include "periph_sdcard.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -98,7 +99,7 @@ esp_err_t audio_board_key_init(esp_periph_set_handle_t set);
* - ESP_OK, success
* - Others, fail
*/
esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set);
esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, periph_sdcard_mode_t mode);

/**
* @brief Query audio_board_handle
Expand Down
2 changes: 1 addition & 1 deletion components/audio_board/esp32_korvo_du1906/board_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

#define SDCARD_OPEN_FILE_NUM_MAX 5
#define SDCARD_INTR_GPIO GPIO_NUM_39

#define ES7243_MCLK_GPIO GPIO_NUM_0

#define WS2812_LED_GPIO_PIN 3
#define WS2812_LED_BAR_NUMBERS 2
Expand Down
5 changes: 5 additions & 0 deletions components/audio_board/esp32_korvo_du1906/board_pins_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,8 @@ int8_t get_pa_enable_gpio(void)
{
return PA_ENABLE_GPIO;
}

int8_t get_es7243_mclk_gpio(void)
{
return ES7243_MCLK_GPIO;
}
Loading