这是一次长久的提交:
1. 应用界面增加了返回主页的按钮 2. 修复了gif渲染内存泄漏的严重bug 3. 将PetDao当中的cJSON API替换为cpp_json,完美通过测试 4. 整合已经实现的各种上层建筑,实现了一个宠物对话基本业务应用,用于样品测试展示用 5. 重构了音频播放类,使其更modern,更加便于移植和拓展
This commit is contained in:
@@ -1,8 +1,7 @@
|
||||
#include "PCM5101.h"
|
||||
|
||||
static const char *TAG = "AUDIO PCM5101";
|
||||
|
||||
static i2s_chan_handle_t i2s_tx_chan;
|
||||
i2s_chan_handle_t i2s_tx_chan = NULL;
|
||||
static i2s_chan_handle_t i2s_rx_chan;
|
||||
|
||||
uint8_t Volume = Volume_MAX - 2;
|
||||
@@ -24,8 +23,8 @@ static esp_err_t bsp_i2s_write(void *audio_buffer, size_t len, size_t *bytes_wri
|
||||
|
||||
return i2s_channel_write(i2s_tx_chan, (char *)audio_buffer, len, bytes_written, timeout_ms);
|
||||
}
|
||||
static esp_err_t bsp_i2s_reconfig_clk(uint32_t rate, uint32_t bits_cfg, i2s_slot_mode_t ch) { // I2S Init
|
||||
esp_err_t ret = ESP_OK;
|
||||
esp_err_t bsp_i2s_reconfig_clk(uint32_t rate, uint32_t bits_cfg, i2s_slot_mode_t ch) { // I2S Init
|
||||
esp_err_t ret = ESP_OK;
|
||||
i2s_std_config_t std_cfg = {
|
||||
.clk_cfg = I2S_STD_CLK_DEFAULT_CONFIG(rate),
|
||||
.slot_cfg = I2S_STD_PHILIP_SLOT_DEFAULT_CONFIG((i2s_data_bit_width_t)bits_cfg, ch),
|
||||
@@ -34,11 +33,11 @@ static esp_err_t bsp_i2s_reconfig_clk(uint32_t rate, uint32_t bits_cfg, i2s_slot
|
||||
ret |= i2s_channel_disable(i2s_tx_chan);
|
||||
ret |= i2s_channel_reconfig_std_clock(i2s_tx_chan, &std_cfg.clk_cfg);
|
||||
ret |= i2s_channel_reconfig_std_slot(i2s_tx_chan, &std_cfg.slot_cfg);
|
||||
ret |= i2s_channel_enable(i2s_tx_chan);
|
||||
ret |= i2s_channel_enable(i2s_tx_chan);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static esp_err_t audio_mute_function(AUDIO_PLAYER_MUTE_SETTING setting) { // audio mute function
|
||||
static esp_err_t audio_mute_function(AUDIO_PLAYER_MUTE_SETTING setting) { // audio mute function
|
||||
ESP_LOGI(TAG, "mute setting %d", setting);
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -214,3 +213,6 @@ void Volume_adjustment(uint8_t Vol) {
|
||||
Volume = Vol;
|
||||
ESP_LOGI(TAG, "Volume set to %d", Volume);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -57,6 +57,15 @@ uint32_t Music_Elapsed(void);
|
||||
uint16_t Music_Energy(void);
|
||||
void Volume_adjustment(uint8_t Volume);
|
||||
|
||||
|
||||
// 供 C++ 层调用的“重新配置时钟”包装
|
||||
esp_err_t bsp_i2s_reconfig_clk(uint32_t rate,
|
||||
uint32_t bits_cfg,
|
||||
i2s_slot_mode_t ch);
|
||||
|
||||
// 供 C++ 层直接用的 tx channel 句柄
|
||||
extern i2s_chan_handle_t i2s_tx_chan;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user