Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2S Fix Builtin DAC&PDM on ESP32 & compiling warning ESP32-C3 #461

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix PDM & DAC mode ESP32
The code for enabling compatibility with ESP32C3 had broken DAC builtin and PDM mode on ESP32. This should fix it again
  • Loading branch information
FedericoBusero authored Dec 7, 2021
commit 0399d1751127eb89d6635f46f0e1d24f94b375e4
10 changes: 3 additions & 7 deletions src/AudioOutputI2S.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,15 @@ bool AudioOutputI2S::begin(bool txDAC)
i2s_mode_t mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX);
if (output_mode == INTERNAL_DAC)
{
#ifdef I2S_MODE_DAC_BUILT_IN
#if CONFIG_IDF_TARGET_ESP32 || SOC_I2S_SUPPORTS_DAC
mode = (i2s_mode_t)(mode | I2S_MODE_DAC_BUILT_IN);
#else
return false;
#endif
}
if (output_mode == INTERNAL_PDM)
else if (output_mode == INTERNAL_PDM)
{
#ifdef I2S_MODE_PDM
mode = (i2s_mode_t)(mode | I2S_MODE_PDM);
#else
return false;
#endif
}

i2s_comm_format_t comm_fmt;
Expand Down Expand Up @@ -230,7 +226,7 @@ bool AudioOutputI2S::begin(bool txDAC)
}
if (output_mode == INTERNAL_DAC || output_mode == INTERNAL_PDM)
{
#ifdef I2S_DAC_CHANNEL_BOTH_EN
#if CONFIG_IDF_TARGET_ESP32 || SOC_I2S_SUPPORTS_DAC
i2s_set_pin((i2s_port_t)portNo, NULL);
i2s_set_dac_mode(I2S_DAC_CHANNEL_BOTH_EN);
#else
Expand Down