Free BCK and WS pins for general use with NoDAC (#251)

The BCK and WS pins aren't needed or used when using the I2SNoDAC
option.  Restore their settings to whatever they were before, leaving
them untouched.  Apps may configure the additional pins either before or
after the I2SNoDac is created.
This commit is contained in:
Earle F. Philhower, III authored and GitHub committed 2020-04-14 11:49:12 -07:00
1 parent aba310d3a0
commit be0ee8283f
3 files changed
+9

No files matched your search

+2
View File
@@ -85,6 +85,8 @@ AudioOutputI2S::AudioOutputI2S(int port, int output_mode, int dma_buf_count, int
(void) dma_buf_count;
(void) use_apll;
if (!i2sOn) {
orig_bck = READ_PERI_REG(PERIPHS_IO_MUX_MTDO_U);
orig_ws = READ_PERI_REG(PERIPHS_IO_MUX_GPIO2_U);
i2s_begin();
}
#endif
+3
View File
@@ -47,6 +47,9 @@ class AudioOutputI2S : public AudioOutput
int output_mode;
bool mono;
bool i2sOn;
// We can restore the old values and free up these pins when in NoDAC mode
uint32_t orig_bck;
uint32_t orig_ws;
};
#endif
+4
View File
@@ -32,6 +32,10 @@ AudioOutputI2SNoDAC::AudioOutputI2SNoDAC(int port) : AudioOutputI2S(port, false)
SetOversampling(32);
lastSamp = 0;
cumErr = 0;
#ifndef ESP32
WRITE_PERI_REG(PERIPHS_IO_MUX_MTDO_U, orig_bck);
WRITE_PERI_REG(PERIPHS_IO_MUX_GPIO2_U, orig_ws);
#endif
}
AudioOutputI2SNoDAC::~AudioOutputI2SNoDAC()