forked from xiaozhi/xiaozhi-esp32
fix c3 compile
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2s_tdm.h>
|
||||
#include <driver/i2s.h>
|
||||
|
||||
static const char TAG[] = "Tcircles3AudioCodec";
|
||||
|
||||
@@ -21,7 +20,7 @@ Tcircles3AudioCodec::Tcircles3AudioCodec(int input_sample_rate, int output_sampl
|
||||
CreateVoiceHardware(mic_bclk, mic_ws, mic_data, spkr_bclk, spkr_lrclk, spkr_data);
|
||||
|
||||
gpio_config_t config;
|
||||
config.pin_bit_mask = BIT64(GPIO_NUM_45);
|
||||
config.pin_bit_mask = BIT64(45);
|
||||
config.mode = GPIO_MODE_OUTPUT;
|
||||
config.pull_up_en = GPIO_PULLUP_DISABLE;
|
||||
config.pull_down_en = GPIO_PULLDOWN_ENABLE;
|
||||
@@ -30,7 +29,7 @@ Tcircles3AudioCodec::Tcircles3AudioCodec(int input_sample_rate, int output_sampl
|
||||
config.hys_ctrl_mode = GPIO_HYS_SOFT_ENABLE;
|
||||
#endif
|
||||
gpio_config(&config);
|
||||
gpio_set_level(GPIO_NUM_45, 0);
|
||||
gpio_set_level(gpio_num_t(45), 0);
|
||||
ESP_LOGI(TAG, "Tcircles3AudioCodec initialized");
|
||||
}
|
||||
|
||||
@@ -46,9 +45,9 @@ Tcircles3AudioCodec::~Tcircles3AudioCodec() {
|
||||
void Tcircles3AudioCodec::CreateVoiceHardware(gpio_num_t mic_bclk, gpio_num_t mic_ws, gpio_num_t mic_data,
|
||||
gpio_num_t spkr_bclk, gpio_num_t spkr_lrclk, gpio_num_t spkr_data) {
|
||||
|
||||
i2s_chan_config_t mic_chan_config = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM_0, I2S_ROLE_MASTER);
|
||||
i2s_chan_config_t mic_chan_config = I2S_CHANNEL_DEFAULT_CONFIG(i2s_port_t(0), I2S_ROLE_MASTER);
|
||||
mic_chan_config.auto_clear = true; // Auto clear the legacy data in the DMA buffer
|
||||
i2s_chan_config_t spkr_chan_config = I2S_CHANNEL_DEFAULT_CONFIG(I2S_NUM_1, I2S_ROLE_MASTER);
|
||||
i2s_chan_config_t spkr_chan_config = I2S_CHANNEL_DEFAULT_CONFIG(i2s_port_t(1), I2S_ROLE_MASTER);
|
||||
spkr_chan_config.auto_clear = true; // Auto clear the legacy data in the DMA buffer
|
||||
|
||||
ESP_ERROR_CHECK(i2s_new_channel(&mic_chan_config, NULL, &rx_handle_));
|
||||
@@ -104,9 +103,9 @@ void Tcircles3AudioCodec::EnableInput(bool enable) {
|
||||
|
||||
void Tcircles3AudioCodec::EnableOutput(bool enable) {
|
||||
if (enable){
|
||||
gpio_set_level(GPIO_NUM_45, 1);
|
||||
gpio_set_level(gpio_num_t(45), 1);
|
||||
}else{
|
||||
gpio_set_level(GPIO_NUM_45, 0);
|
||||
gpio_set_level(gpio_num_t(45), 0);
|
||||
}
|
||||
AudioCodec::EnableOutput(enable);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user