mirror of
https://github.com/EdgeTX/edgetx.git
synced 2025-07-19 06:15:08 +03:00
fix: ADC DMA clock enable and inhibit mask for internal channels (#4103)
This commit is contained in:
parent
bd9440daa3
commit
66b9bdd3e4
1 changed files with 6 additions and 1 deletions
|
@ -20,7 +20,10 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stm32_adc.h"
|
#include "stm32_adc.h"
|
||||||
|
#include "stm32_dma.h"
|
||||||
#include "stm32_gpio_driver.h"
|
#include "stm32_gpio_driver.h"
|
||||||
|
#include "timers_driver.h"
|
||||||
|
|
||||||
#include "opentx.h"
|
#include "opentx.h"
|
||||||
|
|
||||||
#define ADC_COMMON ((ADC_Common_TypeDef *) ADC_BASE)
|
#define ADC_COMMON ((ADC_Common_TypeDef *) ADC_BASE)
|
||||||
|
@ -235,7 +238,7 @@ static uint8_t adc_init_channels(const stm32_adc_t* adc,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Internal channels are inhibited until explicitely enabled
|
// Internal channels are inhibited until explicitely enabled
|
||||||
_adc_inhibit_mask |= mask;
|
_adc_inhibit_mask |= (1 << input_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// channel is already used, probably a secondary input
|
// channel is already used, probably a secondary input
|
||||||
|
@ -270,6 +273,8 @@ static bool adc_init_dma_stream(ADC_TypeDef* adc, DMA_TypeDef* DMAx,
|
||||||
uint32_t stream, uint32_t channel,
|
uint32_t stream, uint32_t channel,
|
||||||
uint16_t* dest, uint8_t nconv)
|
uint16_t* dest, uint8_t nconv)
|
||||||
{
|
{
|
||||||
|
stm32_dma_enable_clock(DMAx);
|
||||||
|
|
||||||
// Disable DMA before continuing (see ref. manual "Stream configuration procedure")
|
// Disable DMA before continuing (see ref. manual "Stream configuration procedure")
|
||||||
if (!adc_disable_dma(DMAx, stream))
|
if (!adc_disable_dma(DMAx, stream))
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue