WM8978 support for PicoDSP, etc.

This commit is contained in:
TroyHacks
2023-10-20 01:23:10 -04:00
parent b2344ad219
commit 3ba2fe4ee0
3 changed files with 114 additions and 2 deletions

View File

@@ -1753,6 +1753,23 @@ class AudioReactive : public Usermod {
if (i2c_sda >= 0) sdaPin = -1; // -1 = use global
if (i2c_scl >= 0) sclPin = -1;
if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin);
break;
case 7:
#ifdef use_wm8978_mic
DEBUGSR_PRINTLN(F("AR: WM8978 Source (Mic)"));
#else
DEBUGSR_PRINTLN(F("AR: WM8978 Source (Line-In)"));
#endif
audioSource = new WM8978Source(SAMPLE_RATE, BLOCK_SIZE, 1.0f);
//useInputFilter = 0; // to disable low-cut software filtering and restore previous behaviour
delay(100);
// WLEDMM align global pins
if ((sdaPin >= 0) && (i2c_sda < 0)) i2c_sda = sdaPin; // copy usermod prefs into globals (if globals not defined)
if ((sclPin >= 0) && (i2c_scl < 0)) i2c_scl = sclPin;
if (i2c_sda >= 0) sdaPin = -1; // -1 = use global
if (i2c_scl >= 0) sclPin = -1;
if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin);
break;
@@ -2562,7 +2579,11 @@ class AudioReactive : public Usermod {
#else
oappend(SET_F("addOption(dd,'ES8388 ☾',6);"));
#endif
#if SR_DMTYPE==7
oappend(SET_F("addOption(dd,'WM8978 ☾ (⎌)',7);"));
#else
oappend(SET_F("addOption(dd,'WM8978 ☾',7);"));
#endif
#ifdef SR_SQUELCH
oappend(SET_F("addInfo('AudioReactive:config:squelch',1,'<i>&#9100; ")); oappendi(SR_SQUELCH); oappend("</i>');"); // 0 is field type, 1 is actual field
#endif