From ccb60fe9bc2a04e7f3338d05d33874be8165ecc5 Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Mon, 22 May 2023 22:18:09 +0200 Subject: [PATCH 01/10] Update ADCSampler.cpp --- lib/audio_input/src/ADCSampler.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/audio_input/src/ADCSampler.cpp b/lib/audio_input/src/ADCSampler.cpp index 402eef3..ca618d1 100644 --- a/lib/audio_input/src/ADCSampler.cpp +++ b/lib/audio_input/src/ADCSampler.cpp @@ -16,6 +16,12 @@ void ADCSampler::configureI2S() i2s_adc_enable(m_i2sPort); } +void ADCSampler::endconfigureI2S() +{ + // disable the adc + i2s_adc_disable(m_i2sPort); +} + int ADCSampler::read(int16_t *samples, int count) { // read from i2s From 80cf8de8f16398b98e7171f8180ec63d4927cfcd Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Mon, 22 May 2023 22:18:47 +0200 Subject: [PATCH 02/10] Update ADCSampler.h --- lib/audio_input/src/ADCSampler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/audio_input/src/ADCSampler.h b/lib/audio_input/src/ADCSampler.h index 8aad4b2..5c680d2 100644 --- a/lib/audio_input/src/ADCSampler.h +++ b/lib/audio_input/src/ADCSampler.h @@ -11,6 +11,7 @@ class ADCSampler : public I2SSampler protected: void configureI2S(); + void endconfigureI2S(); public: ADCSampler(adc_unit_t adc_unit, adc1_channel_t adc_channel, const i2s_config_t &i2s_config); From 2ff06fd7c5b8ceb554a5bb4c4ccbb40bac1a2281 Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Mon, 22 May 2023 22:19:58 +0200 Subject: [PATCH 03/10] Update I2SSampler.h --- lib/audio_input/src/I2SSampler.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/audio_input/src/I2SSampler.h b/lib/audio_input/src/I2SSampler.h index ac9268b..6998fc9 100644 --- a/lib/audio_input/src/I2SSampler.h +++ b/lib/audio_input/src/I2SSampler.h @@ -12,6 +12,7 @@ class I2SSampler i2s_port_t m_i2sPort = I2S_NUM_0; i2s_config_t m_i2s_config; virtual void configureI2S() = 0; + virtual void endconfigureI2S() = 0; virtual void processI2SData(void *samples, size_t count){ // nothing to do for the default case }; From 9fd6eec9d62c312057787ba3cc6d780e31dcf189 Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Mon, 22 May 2023 22:21:07 +0200 Subject: [PATCH 04/10] Update I2SSampler.cpp --- lib/audio_input/src/I2SSampler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/audio_input/src/I2SSampler.cpp b/lib/audio_input/src/I2SSampler.cpp index e6311e7..6ef04ae 100644 --- a/lib/audio_input/src/I2SSampler.cpp +++ b/lib/audio_input/src/I2SSampler.cpp @@ -16,6 +16,8 @@ void I2SSampler::start() void I2SSampler::stop() { + // end configuration of I2S (e.g. to release lock on adc) + endconfigureI2S(); // stop the i2S driver i2s_driver_uninstall(m_i2sPort); } From 4001b7b6b08a1890ee1093fe7920bc285d799a5b Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Mon, 22 May 2023 22:24:38 +0200 Subject: [PATCH 05/10] Update I2SMEMSSampler.h --- lib/audio_input/src/I2SMEMSSampler.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/audio_input/src/I2SMEMSSampler.h b/lib/audio_input/src/I2SMEMSSampler.h index a09f284..83afaed 100644 --- a/lib/audio_input/src/I2SMEMSSampler.h +++ b/lib/audio_input/src/I2SMEMSSampler.h @@ -12,7 +12,8 @@ class I2SMEMSSampler : public I2SSampler protected: void configureI2S(); - + void endconfigureI2S() {} + public: I2SMEMSSampler( i2s_port_t i2s_port, From 206bec3432fe15f39b18918f1f648e58352ca37b Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Tue, 23 May 2023 20:16:12 +0200 Subject: [PATCH 06/10] Update ADCSampler.cpp --- lib/audio_input/src/ADCSampler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/audio_input/src/ADCSampler.cpp b/lib/audio_input/src/ADCSampler.cpp index ca618d1..d02b3e0 100644 --- a/lib/audio_input/src/ADCSampler.cpp +++ b/lib/audio_input/src/ADCSampler.cpp @@ -16,9 +16,9 @@ void ADCSampler::configureI2S() i2s_adc_enable(m_i2sPort); } -void ADCSampler::endconfigureI2S() +void ADCSampler::unConfigureI2S() { - // disable the adc + // make sure ot do this or the ADC is locked i2s_adc_disable(m_i2sPort); } From ed9355f1290c8e23122b7fce5126583a70d07809 Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Tue, 23 May 2023 20:16:52 +0200 Subject: [PATCH 07/10] Update ADCSampler.h --- lib/audio_input/src/ADCSampler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/audio_input/src/ADCSampler.h b/lib/audio_input/src/ADCSampler.h index 5c680d2..1351a09 100644 --- a/lib/audio_input/src/ADCSampler.h +++ b/lib/audio_input/src/ADCSampler.h @@ -11,7 +11,7 @@ class ADCSampler : public I2SSampler protected: void configureI2S(); - void endconfigureI2S(); + void unConfigureI2S(); public: ADCSampler(adc_unit_t adc_unit, adc1_channel_t adc_channel, const i2s_config_t &i2s_config); From dd0bda51eff3aa08c117a6cc373135b43a9594a3 Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Tue, 23 May 2023 20:17:31 +0200 Subject: [PATCH 08/10] Update I2SMEMSSampler.h --- lib/audio_input/src/I2SMEMSSampler.h | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/audio_input/src/I2SMEMSSampler.h b/lib/audio_input/src/I2SMEMSSampler.h index 83afaed..ac6b2c3 100644 --- a/lib/audio_input/src/I2SMEMSSampler.h +++ b/lib/audio_input/src/I2SMEMSSampler.h @@ -12,7 +12,6 @@ class I2SMEMSSampler : public I2SSampler protected: void configureI2S(); - void endconfigureI2S() {} public: I2SMEMSSampler( From a4b330ef05fc49efc551f27ac373efef5bd34c1a Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Tue, 23 May 2023 20:18:24 +0200 Subject: [PATCH 09/10] Update I2SSampler.cpp --- lib/audio_input/src/I2SSampler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/audio_input/src/I2SSampler.cpp b/lib/audio_input/src/I2SSampler.cpp index 6ef04ae..c5a3899 100644 --- a/lib/audio_input/src/I2SSampler.cpp +++ b/lib/audio_input/src/I2SSampler.cpp @@ -16,8 +16,8 @@ void I2SSampler::start() void I2SSampler::stop() { - // end configuration of I2S (e.g. to release lock on adc) - endconfigureI2S(); + // clear any I2S configuration + unConfigureI2S(); // stop the i2S driver i2s_driver_uninstall(m_i2sPort); } From 4511eb6766906f29d240e79fb9aa82e177232fb5 Mon Sep 17 00:00:00 2001 From: FedericoBusero <35894905+FedericoBusero@users.noreply.github.com> Date: Tue, 23 May 2023 20:19:12 +0200 Subject: [PATCH 10/10] Update I2SSampler.h --- lib/audio_input/src/I2SSampler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/audio_input/src/I2SSampler.h b/lib/audio_input/src/I2SSampler.h index 6998fc9..8d27ad7 100644 --- a/lib/audio_input/src/I2SSampler.h +++ b/lib/audio_input/src/I2SSampler.h @@ -12,7 +12,7 @@ class I2SSampler i2s_port_t m_i2sPort = I2S_NUM_0; i2s_config_t m_i2s_config; virtual void configureI2S() = 0; - virtual void endconfigureI2S() = 0; + virtual void unConfigureI2S(){}; virtual void processI2SData(void *samples, size_t count){ // nothing to do for the default case };