Replace external SPIRAM lib w/internal optimized (#250)
* Replace external SPIRAM lib w/internal optimized Instead of requiring everyone to download and install another Arduino library to use this lib, include an optimized, self-contained one from the 8266 VM PR: https://github.com/esp8266/Arduino/pull/6994 Does change the API as it now requires a HW chip select, so that parameter is removed from the SpiRAM buffer object. * Redo the FIFO to try and be faster * Fix the SPI interface, buffering. SPI FIFO needs special care so do all work in a RAM copy and the copy it over manually w/32b writes. Ensure the SPI command is done before touching the FIFO. Fix buffering organization. Make the buffer report status as a #### bar. * Fix infinite wait on EOF * Add SW chip select support * Update URL to one that's live today * Clean up metadata printout * Clean up readme refs to obsolete lib * Slow down the DIO->SIO reset sequence * Update readme to remove old SPIRam library ref Also add the resistor to the 1T circuit to avoid transistor overheating.
This commit is contained in:
1 parent
be0ee8283f
commit
0fd2d0413b
5 files changed
+372
-132
No files matched your search
@@ -16,7 +16,7 @@ const char *SSID = ".....";
|
||||
const char *PASSWORD = ".....";
|
||||
|
||||
// Randomly picked URL
|
||||
const char *URL="http://streaming.shoutcast.com/80sPlanet?lang=en-US";
|
||||
const char *URL="http://kvbstreams.dyndns.org:8000/wkvi-am";
|
||||
|
||||
AudioGeneratorMP3 *mp3;
|
||||
AudioFileSourceICYStream *file;
|
||||
@@ -29,25 +29,24 @@ void MDCallback(void *cbData, const char *type, bool isUnicode, const char *stri
|
||||
const char *ptr = reinterpret_cast<const char *>(cbData);
|
||||
(void) isUnicode; // Punt this ball for now
|
||||
// Note that the type and string may be in PROGMEM, so copy them to RAM for printf
|
||||
char s1[32], s2[64];
|
||||
strncpy_P(s1, type, sizeof(s1));
|
||||
s1[sizeof(s1)-1]=0;
|
||||
strncpy_P(s2, string, sizeof(s2));
|
||||
s2[sizeof(s2)-1]=0;
|
||||
Serial.printf("METADATA(%s) '%s' = '%s'\n", ptr, s1, s2);
|
||||
Serial.printf_P(PSTR("METADATA(%s) '%s' = '%s'\n"), ptr, type, string);
|
||||
Serial.flush();
|
||||
}
|
||||
|
||||
|
||||
// Called when there's a warning or error (like a buffer underflow or decode hiccup)
|
||||
void StatusCallback(void *cbData, int code, const char *string)
|
||||
{
|
||||
const char *ptr = reinterpret_cast<const char *>(cbData);
|
||||
// Note that the string may be in PROGMEM, so copy it to RAM for printf
|
||||
char s1[64];
|
||||
strncpy_P(s1, string, sizeof(s1));
|
||||
s1[sizeof(s1)-1]=0;
|
||||
Serial.printf("STATUS(%s) '%d' = '%s'\n", ptr, code, s1);
|
||||
Serial.flush();
|
||||
static uint32_t lastTime = 0;
|
||||
static int lastCode = -99999;
|
||||
uint32_t now = millis();
|
||||
if ((lastCode != code) || (now - lastTime > 1000)) {
|
||||
Serial.printf_P(PSTR("STATUS(%s) '%d' = '%s'\n"), ptr, code, string);
|
||||
Serial.flush();
|
||||
lastTime = now;
|
||||
lastCode = code;
|
||||
}
|
||||
}
|
||||
|
||||
void setup()
|
||||
@@ -73,7 +72,7 @@ void setup()
|
||||
file = new AudioFileSourceICYStream(URL);
|
||||
file->RegisterMetadataCB(MDCallback, (void*)"ICY");
|
||||
// Initialize 23LC1024 SPI RAM buffer with chip select ion GPIO4 and ram size of 128KByte
|
||||
buff = new AudioFileSourceSPIRAMBuffer(file, 4, 131072);
|
||||
buff = new AudioFileSourceSPIRAMBuffer(file, 4, 128*1024);
|
||||
buff->RegisterStatusCB(StatusCallback, (void*)"buffer");
|
||||
out = new AudioOutputI2SNoDAC();
|
||||
mp3 = new AudioGeneratorMP3();
|
||||
|
||||
Reference in new issue
Block a user