Commit new test.

This commit is contained in:
Colin 2025-12-25 22:10:47 +08:00
parent 138552e4eb
commit 9b6a91f04c
1 changed files with 23 additions and 18 deletions

View File

@ -13,6 +13,7 @@
#include "esp32_s3_szp.h"
#include "esp_check.h"
#include "esp_netif_sntp.h"
#include "esp_sleep.h"
#include "esp_sntp.h"
#include "esp_vfs_fat.h"
#include "esp_wifi.h"
@ -41,7 +42,7 @@
/* I2S configurations */
#define I2S_TDM_FORMAT (ES7210_I2S_FMT_I2S)
#define I2S_CHAN_NUM (2)
#define I2S_SAMPLE_RATE (48000)
#define I2S_SAMPLE_RATE (16000)
#define I2S_MCLK_MULTIPLE (I2S_MCLK_MULTIPLE_256)
#define I2S_SAMPLE_BITS (I2S_DATA_BIT_WIDTH_16BIT)
#define I2S_TDM_SLOT_MASK (I2S_TDM_SLOT0 | I2S_TDM_SLOT1)
@ -54,7 +55,7 @@
#define ES7210_ADC_VOLUME (0)
/* SD card & recording configurations */
#define RECORD_TIME_SEC (60)
#define RECORD_TIME_SEC (20)
#define SD_MOUNT_POINT "/sdcard"
static const char* TAG = "main";
@ -311,26 +312,30 @@ void app_main(void) {
// pca9557_init(); // IO扩展芯片初始化
// bsp_lvgl_start(); // 初始化液晶屏lvgl接口
bsp_spiffs_mount(); // SPIFFS文件系统初始化
bsp_codec_init(); // 音频初始化
// bsp_spiffs_mount(); // SPIFFS文件系统初始化
bsp_codec_init(); // 音频初始化
// mp3_player_init(); // MP3播放器初始化
app_sr_init(); // 语音识别初始化
// app_sr_init(); // 语音识别初始化
// esp_deep_sleep_start();
// esp_light_sleep_start();
i2s_chan_handle_t i2s_rx_chan = es7210_i2s_init();
es7210_codec_init();
wifi_connect();
record_file_name = malloc(64);
for (int i = 0; i < 2; i++) {
esp_err_t err = record_wav(i2s_rx_chan);
if (err == ESP_OK) {
ESP_LOGI(TAG, "Audio success recorded into %s.", record_file_name);
} else {
ESP_LOGE(TAG, "Record failed, %s .", record_file_name);
}
}
init_msc(sdmmc_card);
// i2s_chan_handle_t i2s_rx_chan = es7210_i2s_init();
// es7210_codec_init();
// wifi_connect();
// record_file_name = malloc(64);
// while (1) {
// esp_err_t err = record_wav(i2s_rx_chan);
// if (err == ESP_OK) {
// ESP_LOGI(TAG, "Audio success recorded into %s.", record_file_name);
// } else {
// ESP_LOGE(TAG, "Record failed, %s .", record_file_name);
// }
// }
// esp_vfs_fat_sdcard_unmount(SD_MOUNT_POINT, sdmmc_card);
esp_vfs_fat_sdcard_unmount(SD_MOUNT_POINT, sdmmc_card);
while (1) {
vTaskDelay(pdMS_TO_TICKS(10));