diff --git a/examples/examples-custom-boards/lyrat-mini/mic/mic.ino b/examples/examples-custom-boards/lyrat-mini/mic/mic.ino index d12b787af..8819d56c7 100644 --- a/examples/examples-custom-boards/lyrat-mini/mic/mic.ino +++ b/examples/examples-custom-boards/lyrat-mini/mic/mic.ino @@ -15,7 +15,7 @@ void setup(void) { auto cfg = i2s.defaultConfig(RX_MODE); cfg.copyFrom(info); - //cfg.input_device = ADC_INPUT_LINE2; + // cfg.i2s_function = CODEC; // or CODEC_ADC i2s.begin(cfg); // make sure that we have the correct number of channels set up diff --git a/examples/examples-custom-boards/lyrat-mini/sd/sd.ino b/examples/examples-custom-boards/lyrat-mini/sd/sd.ino index 09710b684..1494ab393 100644 --- a/examples/examples-custom-boards/lyrat-mini/sd/sd.ino +++ b/examples/examples-custom-boards/lyrat-mini/sd/sd.ino @@ -9,16 +9,24 @@ #define PIN_SD_CARD_MISO 2 #define PIN_SD_CARD_MOSI 15 #define PIN_SD_CARD_CLK 14 +#define PIN_SD_CARD_DET 34 + // Arduino Setup void setup(void) { Serial.begin(115200); // setup SPI - SPI.begin(PIN_SD_CARD_CLK, PIN_SD_CARD_MISO, PIN_SD_CARD_MOSI, PIN_SD_CARD_CLK); + SPI.begin(PIN_SD_CARD_CLK, PIN_SD_CARD_MISO, PIN_SD_CARD_MOSI, PIN_SD_CARD_CS); + + // Determin if there is an SD card + pinMode(PIN_SD_CARD_DET, INPUT); + if (digitalRead(PIN_SD_CARD_DET)!=0){ + Serial.println("No SD Card detected"); + } // Setup SD and open file - if (!SD.begin(PIN_SD_CARD_CLK, SPI)){ + if (!SD.begin(PIN_SD_CARD_CS)){ Serial.println("SD.begin failed"); while(true); } @@ -33,5 +41,4 @@ void setup(void) { } // Arduino loop - repeated processing -void loop() { -} \ No newline at end of file +void loop() {} \ No newline at end of file diff --git a/src/AudioTools/AudioLibs/I2SCodecStream.h b/src/AudioTools/AudioLibs/I2SCodecStream.h index c900d7489..dd0600e8d 100644 --- a/src/AudioTools/AudioLibs/I2SCodecStream.h +++ b/src/AudioTools/AudioLibs/I2SCodecStream.h @@ -26,7 +26,7 @@ struct I2SCodecConfig : public I2SConfig { output_device_t output_device = DAC_OUTPUT_ALL; // to be compatible with the AudioKitStream -> do not activate SD spi if false bool sd_active = true; - + PinFunction i2s_function = PinFunction::CODEC; bool operator==(I2SCodecConfig alt) { return input_device == alt.input_device && output_device == alt.output_device && *((AudioInfo *)this) == alt; @@ -253,23 +253,8 @@ class I2SCodecStream : public AudioStream, public VolumeSupport { audio_driver_local::Optional getI2SPins(){ TRACED(); audio_driver_local::Optional i2s; - // special logic if we have a board which has a dedicated microphone I2S port - if (cfg.rx_tx_mode == RX_MODE){ - i2s = p_board->getPins().getI2SPins(PinFunction::CODEC_ADC); -#ifdef ESP32 - if (i2s){ - cfg.port_no = i2s.value().port; - LOGI("Using port %d for input", cfg.port_no); - } -#endif - } - - // Deterine regular I2S pins - if (!i2s){ - // setup pins in i2s config - i2s = p_board->getPins().getI2SPins(); - } - return i2s; + // Deterine I2S pins + return p_board->getPins().getI2SPins(cfg.i2s_function); } bool beginCodec(I2SCodecConfig info) {