From ffcd9670d6e4663da654a4d10359a90a41b72e5c Mon Sep 17 00:00:00 2001 From: mcells <33664753+mcells@users.noreply.github.com> Date: Fri, 29 Mar 2024 18:57:06 +0000 Subject: [PATCH] Stop reading samples during readfifo for better speed & timing --- .../hardware_specific/esp32/esp32_i2s_driver.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/current_sense/hardware_specific/esp32/esp32_i2s_driver.cpp b/src/current_sense/hardware_specific/esp32/esp32_i2s_driver.cpp index 9a638024..006dfdc4 100644 --- a/src/current_sense/hardware_specific/esp32/esp32_i2s_driver.cpp +++ b/src/current_sense/hardware_specific/esp32/esp32_i2s_driver.cpp @@ -67,6 +67,8 @@ unsigned long IRAM_ATTR fifotime = 0; // The ADC counts get saved in uint32_t i2s_adc_buffer[]. void IRAM_ATTR readFiFo() { + CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); // Stop aquisition to buffer + // uint32_t readings[ADC1_CHANNEL_MAX][ADC1_CHANNEL_MAX*BUF_LEN]; uint32_t avgreadings[ADC1_CHANNEL_MAX] = {0}; uint32_t counts[ADC1_CHANNEL_MAX] = {0}; @@ -173,6 +175,8 @@ void IRAM_ATTR readFiFo() // Serial.printf(">Channel%d:%d\n", j, i2s_adc_buffer[j]); } }*/ + + SET_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); // Restart aquisition to buffer } #if I2S_USE_INTERRUPT == true