diff --git a/ESP32_Oscilloscope/i2s.ino b/ESP32_Oscilloscope/i2s.ino index a4c319a..6f17c62 100644 --- a/ESP32_Oscilloscope/i2s.ino +++ b/ESP32_Oscilloscope/i2s.ino @@ -32,9 +32,11 @@ void ADC_Sampling(uint16_t *i2s_buff){ } */ void ADC_Sampling(uint16_t *i2s_buff){ - size_t bytes_read; for (int i = 0; i < B_MULT; i++) { + size_t bytes_read; + for (int i = 0; i < B_MULT; i++) { i2s_read(I2S_NUM_0, (void*)&i2s_buff[i * NUM_SAMPLES], NUM_SAMPLES * sizeof(uint16_t), &bytes_read, portMAX_DELAY); - for(size_t ix = 0; ix < bytes_read/2; ix++) i2s_buff[(i * NUM_SAMPLES) + ix] &= 0x0FFF; // 16bit to 12bit conversionĀ  + for(size_t ix = 0; ix < bytes_read/2; ix++) + i2s_buff[(i * NUM_SAMPLES) + ix] &= 0x0FFF; // 16bit to 12bit conversionĀ  } }