Limit speed SerialWAV can send samples, avoid WDT

This commit is contained in:
Earle F. Philhower, III committed 2018-03-26 07:15:58 -07:00
1 parent 1e584d141a
commit abeba9dd89
2 files changed
+7

No files matched your search

+5
View File
@@ -45,11 +45,16 @@ bool AudioOutputSerialWAV::begin()
wavHeader[34] = bps;
wavHeader[35] = 0;
Serial.write(wavHeader, sizeof(wavHeader));
count = 0;
return true;
}
bool AudioOutputSerialWAV::ConsumeSample(int16_t sample[2])
{
if (++count == 200) {
count = 0;
return false;
}
for (int i=0; i<channels; i++) {
if (bps == 8) {
uint8_t l = sample[i] & 0xff;