Skip to content

Ensure that begin() is not called multiple times. #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/AdvancedADC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion src/AdvancedDAC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void AdvancedDAC::write(DMABuffer<Sample> &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;
}

Expand Down