Skip to content

Commit 972a386

Browse files
authored
Merge pull request #28 from arduino-libraries/begin_stop_fix
Ensure that begin() is not called multiple times.
2 parents c93c1b2 + ffaa7a1 commit 972a386

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/AdvancedADC.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ int AdvancedADC::begin(uint32_t resolution, uint32_t sample_rate, size_t n_sampl
117117
ADCName instance = ADC_NP;
118118

119119
// Sanity checks.
120-
if (resolution >= AN_ARRAY_SIZE(ADC_RES_LUT)) {
120+
if (resolution >= AN_ARRAY_SIZE(ADC_RES_LUT) || (descr && descr->pool)) {
121121
return 0;
122122
}
123123

src/AdvancedDAC.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ void AdvancedDAC::write(DMABuffer<Sample> &dmabuf) {
135135

136136
int AdvancedDAC::begin(uint32_t resolution, uint32_t frequency, size_t n_samples, size_t n_buffers) {
137137
// Sanity checks.
138-
if (resolution >= AN_ARRAY_SIZE(DAC_RES_LUT)) {
138+
if (resolution >= AN_ARRAY_SIZE(DAC_RES_LUT) || (descr && descr->pool)) {
139139
return 0;
140140
}
141141

0 commit comments

Comments
 (0)