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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 26 additions & 4 deletions main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ elseif(CONFIG_BOARD_TYPE_XMINI_C3)
set(BOARD_TYPE "xmini-c3")
set(BUILTIN_TEXT_FONT font_puhui_basic_14_1)
set(BUILTIN_ICON_FONT font_awesome_14_1)
elseif(CONFIG_BOARD_TYPE_XMINI_C3_SUPERMINI)
set(BOARD_TYPE "xmini-c3-supermini")
set(BUILTIN_TEXT_FONT font_puhui_basic_14_1)
set(BUILTIN_ICON_FONT font_awesome_14_1)
elseif(CONFIG_BOARD_TYPE_ESP32S3_KORVO2_V3)
set(BOARD_TYPE "esp32s3-korvo2-v3")
set(BUILTIN_TEXT_FONT font_puhui_basic_20_4)
Expand Down Expand Up @@ -518,6 +522,17 @@ elseif(CONFIG_BOARD_TYPE_WTP4C5MP07S)
set(BUILTIN_TEXT_FONT font_puhui_basic_30_4)
set(BUILTIN_ICON_FONT font_awesome_30_4)
set(DEFAULT_EMOJI_COLLECTION twemoji_64)
elseif(CONFIG_BOARD_TYPE_DOGEPET_V2)
# Folder name for DogePetV2 board
set(BOARD_TYPE "dogepeV2")
set(BUILTIN_TEXT_FONT font_puhui_basic_16_4)
set(BUILTIN_ICON_FONT font_awesome_16_4)
set(DEFAULT_EMOJI_COLLECTION twemoji_32)
elseif(CONFIG_BOARD_TYPE_DOGEPET)
set(BOARD_TYPE "dogepet")
set(BUILTIN_TEXT_FONT font_puhui_basic_16_4)
set(BUILTIN_ICON_FONT font_awesome_16_4)
set(DEFAULT_EMOJI_COLLECTION twemoji_32)
endif()

file(GLOB BOARD_SOURCES
Expand All @@ -532,11 +547,19 @@ if(CONFIG_USE_AUDIO_PROCESSOR)
else()
list(APPEND SOURCES "audio/processors/no_audio_processor.cc")
endif()
# Include wake word sources only for the selected implementation and target
# Note: WAKE_WORD_TYPE is a Kconfig choice; only one of these will be set
if(CONFIG_IDF_TARGET_ESP32S3 OR CONFIG_IDF_TARGET_ESP32P4)
list(APPEND SOURCES "audio/wake_words/afe_wake_word.cc")
list(APPEND SOURCES "audio/wake_words/custom_wake_word.cc")
if(CONFIG_USE_AFE_WAKE_WORD)
list(APPEND SOURCES "audio/wake_words/afe_wake_word.cc")
endif()
if(CONFIG_USE_CUSTOM_WAKE_WORD)
list(APPEND SOURCES "audio/wake_words/custom_wake_word.cc")
endif()
else()
list(APPEND SOURCES "audio/wake_words/esp_wake_word.cc")
if(CONFIG_USE_ESP_WAKE_WORD)
list(APPEND SOURCES "audio/wake_words/esp_wake_word.cc")
endif()
endif()

# Select language directory according to Kconfig
Expand Down Expand Up @@ -662,7 +685,6 @@ endif()
idf_component_register(SRCS ${SOURCES}
EMBED_FILES ${LANG_SOUNDS} ${COMMON_SOUNDS}
INCLUDE_DIRS ${INCLUDE_DIRS}
WHOLE_ARCHIVE
)

# Use target_compile_definitions to define BOARD_TYPE, BOARD_NAME
Expand Down
13 changes: 12 additions & 1 deletion main/Kconfig.projbuild
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ choice BOARD_TYPE
config BOARD_TYPE_XMINI_C3
bool "Xmini C3"
depends on IDF_TARGET_ESP32C3
config BOARD_TYPE_XMINI_C3_SUPERMINI
bool "Xmini C3 SuperMini (MAX98357 + INMP441 + OLED 128x64)"
depends on IDF_TARGET_ESP32C3
config BOARD_TYPE_ESP32S3_KORVO2_V3
bool "ESP32S3 KORVO2 V3"
depends on IDF_TARGET_ESP32S3
Expand Down Expand Up @@ -421,6 +424,12 @@ choice BOARD_TYPE
config BOARD_TYPE_WTP4C5MP07S
bool "Wireless-Tag WTP4C5MP07S"
depends on IDF_TARGET_ESP32P4
config BOARD_TYPE_DOGEPET
bool "DogePet (ESP32-S3 SuperMini)"
depends on IDF_TARGET_ESP32S3
config BOARD_TYPE_DOGEPET_V2
bool "DogePetV2 (ESP32-S3 SuperMini)"
depends on IDF_TARGET_ESP32S3
endchoice

choice
Expand Down Expand Up @@ -468,8 +477,10 @@ choice DISPLAY_OLED_TYPE
endchoice

choice DISPLAY_LCD_TYPE
depends on BOARD_TYPE_BREAD_COMPACT_WIFI_LCD || BOARD_TYPE_BREAD_COMPACT_ESP32_LCD || BOARD_TYPE_ESP32_CGC || BOARD_TYPE_ESP32P4_NANO || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC || BOARD_TYPE_BREAD_COMPACT_WIFI_CAM
depends on BOARD_TYPE_BREAD_COMPACT_WIFI_LCD || BOARD_TYPE_BREAD_COMPACT_ESP32_LCD || BOARD_TYPE_ESP32_CGC || BOARD_TYPE_ESP32P4_NANO || BOARD_TYPE_ESP32P4_WIFI6_Touch_LCD_XC || BOARD_TYPE_BREAD_COMPACT_WIFI_CAM || BOARD_TYPE_DOGEBOARD || BOARD_TYPE_DOGEPET || BOARD_TYPE_DOGEPET_V2
prompt "LCD Type"
default LCD_ST7789_240X240 if BOARD_TYPE_DOGEPET
default LCD_ST7789_240X280 if BOARD_TYPE_DOGEPET_V2
default LCD_ST7789_240X320
help
LCD Display Type
Expand Down
27 changes: 22 additions & 5 deletions main/audio/audio_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
#include "processors/no_audio_processor.h"
#endif

#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
#if (CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4)
#if CONFIG_USE_AFE_WAKE_WORD
#include "wake_words/afe_wake_word.h"
#endif
#if CONFIG_USE_CUSTOM_WAKE_WORD
#include "wake_words/custom_wake_word.h"
#else
#endif
#endif
#if CONFIG_USE_ESP_WAKE_WORD
#include "wake_words/esp_wake_word.h"
#endif

Expand Down Expand Up @@ -652,20 +657,32 @@ void AudioService::CheckAndUpdateAudioPowerState() {
void AudioService::SetModelsList(srmodel_list_t* models_list) {
models_list_ = models_list;

#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
#if (CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4)
#if CONFIG_USE_CUSTOM_WAKE_WORD
if (esp_srmodel_filter(models_list_, ESP_MN_PREFIX, NULL) != nullptr) {
wake_word_ = std::make_unique<CustomWakeWord>();
} else if (esp_srmodel_filter(models_list_, ESP_WN_PREFIX, NULL) != nullptr) {
} else {
wake_word_ = nullptr;
}
#elif CONFIG_USE_AFE_WAKE_WORD
if (esp_srmodel_filter(models_list_, ESP_WN_PREFIX, NULL) != nullptr) {
wake_word_ = std::make_unique<AfeWakeWord>();
} else {
wake_word_ = nullptr;
}
#else
wake_word_ = nullptr;
#endif
#else
#if CONFIG_USE_ESP_WAKE_WORD
if (esp_srmodel_filter(models_list_, ESP_WN_PREFIX, NULL) != nullptr) {
wake_word_ = std::make_unique<EspWakeWord>();
} else {
wake_word_ = nullptr;
}
#else
wake_word_ = nullptr;
#endif
#endif

if (wake_word_) {
Expand All @@ -678,7 +695,7 @@ void AudioService::SetModelsList(srmodel_list_t* models_list) {
}

bool AudioService::IsAfeWakeWord() {
#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4
#if (CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4) && CONFIG_USE_AFE_WAKE_WORD
return wake_word_ != nullptr && dynamic_cast<AfeWakeWord*>(wake_word_.get()) != nullptr;
#else
return false;
Expand Down
63 changes: 63 additions & 0 deletions main/audio/codecs/no_audio_codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,69 @@ NoAudioCodecDuplex::NoAudioCodecDuplex(int input_sample_rate, int output_sample_
ESP_LOGI(TAG, "Duplex channels created");
}

NoAudioCodecDuplex::NoAudioCodecDuplex(int input_sample_rate, int output_sample_rate, gpio_num_t bclk, gpio_num_t ws, gpio_num_t dout, gpio_num_t din, i2s_std_slot_mask_t rx_slot_mask) {
duplex_ = true;
input_sample_rate_ = input_sample_rate;
output_sample_rate_ = output_sample_rate;

i2s_chan_config_t chan_cfg = {
.id = I2S_NUM_0,
.role = I2S_ROLE_MASTER,
.dma_desc_num = AUDIO_CODEC_DMA_DESC_NUM,
.dma_frame_num = AUDIO_CODEC_DMA_FRAME_NUM,
.auto_clear_after_cb = true,
.auto_clear_before_cb = false,
.intr_priority = 0,
};
ESP_ERROR_CHECK(i2s_new_channel(&chan_cfg, &tx_handle_, &rx_handle_));

i2s_std_config_t std_cfg = {
.clk_cfg = {
.sample_rate_hz = (uint32_t)output_sample_rate_,
.clk_src = I2S_CLK_SRC_DEFAULT,
.mclk_multiple = I2S_MCLK_MULTIPLE_256,
#ifdef I2S_HW_VERSION_2
.ext_clk_freq_hz = 0,
#endif

},
.slot_cfg = {
.data_bit_width = I2S_DATA_BIT_WIDTH_32BIT,
.slot_bit_width = I2S_SLOT_BIT_WIDTH_AUTO,
.slot_mode = I2S_SLOT_MODE_MONO,
.slot_mask = I2S_STD_SLOT_LEFT,
.ws_width = I2S_DATA_BIT_WIDTH_32BIT,
.ws_pol = false,
.bit_shift = true,
#ifdef I2S_HW_VERSION_2
.left_align = true,
.big_endian = false,
.bit_order_lsb = false
#endif

},
.gpio_cfg = {
.mclk = I2S_GPIO_UNUSED,
.bclk = bclk,
.ws = ws,
.dout = dout,
.din = din,
.invert_flags = {
.mclk_inv = false,
.bclk_inv = false,
.ws_inv = false
}
}
};
ESP_ERROR_CHECK(i2s_channel_init_std_mode(tx_handle_, &std_cfg));

// Configure RX channel with specified slot mask (e.g., I2S_STD_SLOT_RIGHT for INMP441)
std_cfg.slot_cfg.slot_mask = rx_slot_mask;
ESP_ERROR_CHECK(i2s_channel_init_std_mode(rx_handle_, &std_cfg));
ESP_LOGI(TAG, "Duplex channels created (TX: LEFT, RX: %s)",
rx_slot_mask == I2S_STD_SLOT_RIGHT ? "RIGHT" : "LEFT");
}


NoAudioCodecSimplex::NoAudioCodecSimplex(int input_sample_rate, int output_sample_rate, gpio_num_t spk_bclk, gpio_num_t spk_ws, gpio_num_t spk_dout, gpio_num_t mic_sck, gpio_num_t mic_ws, gpio_num_t mic_din) {
duplex_ = false;
Expand Down
1 change: 1 addition & 0 deletions main/audio/codecs/no_audio_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class NoAudioCodec : public AudioCodec {
class NoAudioCodecDuplex : public NoAudioCodec {
public:
NoAudioCodecDuplex(int input_sample_rate, int output_sample_rate, gpio_num_t bclk, gpio_num_t ws, gpio_num_t dout, gpio_num_t din);
NoAudioCodecDuplex(int input_sample_rate, int output_sample_rate, gpio_num_t bclk, gpio_num_t ws, gpio_num_t dout, gpio_num_t din, i2s_std_slot_mask_t rx_slot_mask);
};

class NoAudioCodecSimplex : public NoAudioCodec {
Expand Down
Loading