rp2040-rx : add Fritzing sketch

This commit is contained in:
Georgi Gerganov
2022-07-23 15:55:15 +03:00
parent 84cdf0a0bd
commit 6d45899b80
5 changed files with 11 additions and 6 deletions

View File

@@ -261,6 +261,11 @@ void loop() {
// Main loop ..
while (true) {
while (qsize >= samplesPerFrame) {
// Use this with the serial plotter to observe real-time audio signal
//for (int i = 0; i < samplesPerFrame; i++) {
// Serial.println(sampleBuffer[qhead + i]);
//}
// We have enough captured samples - try to decode any "ggwave" data:
auto tStart = millis();

View File

@@ -328,15 +328,15 @@ void loop() {
size_t bytes_read = 0;
i2s_read(i2s_port, sampleBufferRaw, sizeof(TSampleInput)*samplesPerFrame, &bytes_read, portMAX_DELAY);
int samples_read = bytes_read/sizeof(TSampleInput);
if (samples_read != samplesPerFrame) {
int nSamples = bytes_read/sizeof(TSampleInput);
if (nSamples != samplesPerFrame) {
Serial.println("Failed to read samples");
return;
}
#if defined(MIC_ANALOG)
// the ADC samples are 12-bit so we need to do some massaging to make them 16-bit
for (int i = 0; i < samples_read; i += 2) {
for (int i = 0; i < nSamples; i += 2) {
auto & s0 = sampleBuffer[i];
auto & s1 = sampleBuffer[i + 1];
@@ -350,14 +350,14 @@ void loop() {
#endif
#if defined(MIC_I2S) || defined(MIC_I2S_SPH0645)
for (int i = 0; i < samples_read; ++i) {
for (int i = 0; i < nSamples; ++i) {
sampleBuffer[i] = (sampleBufferRaw[i] & 0xFFFFFFF0) >> 11;
}
#endif
}
// Use this with the serial plotter to observe real-time audio signal
//for (int i = 0; i < samples_read; i++) {
//for (int i = 0; i < nSamples; i++) {
// Serial.println(sampleBuffer[i]);
//}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 KiB

View File

@@ -203,7 +203,7 @@ void loop() {
int nSamples = samplesRead;
samplesRead = 0;
//// loop through any new collected samples
// Use this with the serial plotter to observe real-time audio signal
//for (int i = 0; i < nSamples; i++) {
// Serial.printf("%d\n", sampleBuffer[i]);
//}