Skip to content

Commit ffcd967

Browse files
authored
Stop reading samples during readfifo for better speed & timing
1 parent 3f3aba8 commit ffcd967

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/current_sense/hardware_specific/esp32/esp32_i2s_driver.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ unsigned long IRAM_ATTR fifotime = 0;
6767
// The ADC counts get saved in uint32_t i2s_adc_buffer[].
6868
void IRAM_ATTR readFiFo()
6969
{
70+
CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); // Stop aquisition to buffer
71+
7072
// uint32_t readings[ADC1_CHANNEL_MAX][ADC1_CHANNEL_MAX*BUF_LEN];
7173
uint32_t avgreadings[ADC1_CHANNEL_MAX] = {0};
7274
uint32_t counts[ADC1_CHANNEL_MAX] = {0};
@@ -173,6 +175,8 @@ void IRAM_ATTR readFiFo()
173175
// Serial.printf(">Channel%d:%d\n", j, i2s_adc_buffer[j]);
174176
}
175177
}*/
178+
179+
SET_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); // Restart aquisition to buffer
176180
}
177181

178182
#if I2S_USE_INTERRUPT == true

0 commit comments

Comments
 (0)