Skip to content

Commit f6daea2

Browse files
committed
one more update of ESP8266Audio library
1 parent 2006d30 commit f6daea2

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

software/firmware/source/libraries/ESP8266Audio/src/AudioOutputI2S.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ AudioOutputI2S::AudioOutputI2S(long sampleRate, pin_size_t sck, pin_size_t data)
6868
doutPin = data;
6969
mclkPin = 0;
7070
use_mclk = false;
71+
swap_clocks = false;
7172
SetGain(1.0);
7273
}
7374
#endif
@@ -176,6 +177,15 @@ bool AudioOutputI2S::SetLsbJustified(bool lsbJustified)
176177
return true;
177178
}
178179

180+
bool AudioOutputI2S::SwapClocks(bool swap_clocks)
181+
{
182+
if (i2sOn) {
183+
return false; // Not allowed
184+
}
185+
this->swap_clocks = swap_clocks;
186+
return true;
187+
}
188+
179189
bool AudioOutputI2S::SetMclk(bool enabled){
180190
(void)enabled;
181191
#ifdef ESP32

software/firmware/source/libraries/ESP8266Audio/src/AudioOutputI2S.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class AudioOutputI2S : public AudioOutput
5252
bool SetOutputModeMono(bool mono); // Force mono output no matter the input
5353
bool SetLsbJustified(bool lsbJustified); // Allow supporting non-I2S chips, e.g. PT8211
5454
bool SetMclk(bool enabled); // Enable MCLK output (if supported)
55+
bool SwapClocks(bool swap_clocks); // Swap BCLK and WCLK
5556
#if defined(ARDUINO_ARCH_RP2040)
5657
bool SetBuffers(size_t buffers = 6, size_t bufferWords = 128);
5758
#endif /* ARDUINO_ARCH_RP2040 */
@@ -67,6 +68,7 @@ class AudioOutputI2S : public AudioOutput
6768
int dma_buf_count;
6869
int use_apll;
6970
bool use_mclk;
71+
bool swap_clocks;
7072
// We can restore the old values and free up these pins when in NoDAC mode
7173
uint32_t orig_bck;
7274
uint32_t orig_ws;

0 commit comments

Comments
 (0)