From ffaa7a1ecb3172c523d38eac317e22869d1a215d Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Fri, 3 Mar 2023 12:30:58 +0100 Subject: [PATCH] Ensure that begin() is not called multiple times. --- src/AdvancedADC.cpp | 2 +- src/AdvancedDAC.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AdvancedADC.cpp b/src/AdvancedADC.cpp index 9078be4..e01c894 100644 --- a/src/AdvancedADC.cpp +++ b/src/AdvancedADC.cpp @@ -117,7 +117,7 @@ int AdvancedADC::begin(uint32_t resolution, uint32_t sample_rate, size_t n_sampl ADCName instance = ADC_NP; // Sanity checks. - if (resolution >= AN_ARRAY_SIZE(ADC_RES_LUT)) { + if (resolution >= AN_ARRAY_SIZE(ADC_RES_LUT) || (descr && descr->pool)) { return 0; } diff --git a/src/AdvancedDAC.cpp b/src/AdvancedDAC.cpp index fc04461..443336f 100644 --- a/src/AdvancedDAC.cpp +++ b/src/AdvancedDAC.cpp @@ -135,7 +135,7 @@ void AdvancedDAC::write(DMABuffer &dmabuf) { int AdvancedDAC::begin(uint32_t resolution, uint32_t frequency, size_t n_samples, size_t n_buffers) { // Sanity checks. - if (resolution >= AN_ARRAY_SIZE(DAC_RES_LUT)) { + if (resolution >= AN_ARRAY_SIZE(DAC_RES_LUT) || (descr && descr->pool)) { return 0; }