From 8cd207b805df8baafd29388d1cca89ab32399ae2 Mon Sep 17 00:00:00 2001 From: Joy Date: Mon, 22 Aug 2022 15:15:46 +0800 Subject: [PATCH] Optimize the code. --- os/hal/ports/WB32/LLD/ADCv1/hal_adc_lld.c | 2 +- os/hal/ports/WB32/LLD/DMAv1/wb32_dma.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/os/hal/ports/WB32/LLD/ADCv1/hal_adc_lld.c b/os/hal/ports/WB32/LLD/ADCv1/hal_adc_lld.c index 05e40cc6..e1f6de0f 100644 --- a/os/hal/ports/WB32/LLD/ADCv1/hal_adc_lld.c +++ b/os/hal/ports/WB32/LLD/ADCv1/hal_adc_lld.c @@ -265,7 +265,7 @@ void adc_lld_start_conversion(ADCDriver *adcp) { void adc_lld_stop_conversion(ADCDriver *adcp) { dmaStreamDisable(adcp->dmastp); - adcp->adc->CR2 = 0; + rccResetADC(); } #endif /* HAL_USE_ADC */ diff --git a/os/hal/ports/WB32/LLD/DMAv1/wb32_dma.c b/os/hal/ports/WB32/LLD/DMAv1/wb32_dma.c index fd9bbcf1..4d1a7400 100644 --- a/os/hal/ports/WB32/LLD/DMAv1/wb32_dma.c +++ b/os/hal/ports/WB32/LLD/DMAv1/wb32_dma.c @@ -466,6 +466,8 @@ void dmaServeInterrupt(const wb32_dma_stream_t *dmastp) { dma.streams[selfindex].func(dma.streams[selfindex].param, IT_flag); } } + + dmaStreamClearInterrupt(dmastp); } #endif /* WB32_DMA_REQUIRED */