Skip to content
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
14 changes: 7 additions & 7 deletions src/AdvancedADC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,19 @@ static void dac_descr_deinit(adc_descr_t *descr, bool dealloc_pool) {
HAL_TIM_Base_Stop(&descr->tim);
HAL_ADC_Stop_DMA(&descr->adc);

if (dealloc_pool) {
if (descr->pool) {
delete descr->pool;
}
descr->pool = nullptr;
}

for (size_t i=0; i<AN_ARRAY_SIZE(descr->dmabuf); i++) {
if (descr->dmabuf[i]) {
descr->dmabuf[i]->release();
descr->dmabuf[i] = nullptr;
}
}

if (dealloc_pool) {
if (descr->pool) {
delete descr->pool;
}
descr->pool = nullptr;
}
}
}

Expand Down
15 changes: 8 additions & 7 deletions src/AdvancedDAC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,20 @@ static void dac_descr_deinit(dac_descr_t *descr, bool dealloc_pool) {
HAL_TIM_Base_Stop(&descr->tim);
HAL_DAC_Stop_DMA(descr->dac, descr->channel);

for (size_t i=0; i<AN_ARRAY_SIZE(descr->dmabuf); i++) {
if (descr->dmabuf[i]) {
descr->dmabuf[i]->release();
descr->dmabuf[i] = nullptr;
}
}

if (dealloc_pool) {
if (descr->pool) {
delete descr->pool;
}
descr->pool = nullptr;
}

for (size_t i=0; i<AN_ARRAY_SIZE(descr->dmabuf); i++) {
if (descr->dmabuf[i]) {
descr->dmabuf[i]->release();
descr->dmabuf[i] = nullptr;
}
}
}
}

Expand Down Expand Up @@ -158,7 +159,7 @@ int AdvancedDAC::begin(uint32_t resolution, uint32_t frequency, size_t n_samples

int AdvancedDAC::stop()
{
dac_descr_deinit(descr, false);
dac_descr_deinit(descr, true);
return 1;
}

Expand Down