diff options
Diffstat (limited to 'lib/stm32/common/adc_common_v2.c')
-rw-r--r-- | lib/stm32/common/adc_common_v2.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/lib/stm32/common/adc_common_v2.c b/lib/stm32/common/adc_common_v2.c index fb22d273..7fd26476 100644 --- a/lib/stm32/common/adc_common_v2.c +++ b/lib/stm32/common/adc_common_v2.c @@ -155,7 +155,7 @@ void adc_power_off(uint32_t adc) */ void adc_calibrate_async(uint32_t adc) { - ADC_CR(adc) = ADC_CR_ADCAL; + ADC_CR(adc) |= ADC_CR_ADCAL; } /** @@ -389,4 +389,24 @@ void adc_start_conversion_regular(uint32_t adc) ADC_CR(adc) |= ADC_CR_ADSTART; } +/** @brief Enable circular mode for DMA transfers + * + * For this to work it needs to be ebabled on the DMA side as well. + * + * @param[in] adc Unsigned int32. ADC base address (@ref adc_reg_base) + */ +void adc_enable_dma_circular_mode(uint32_t adc) +{ + ADC_CFGR1(adc) |= ADC_CFGR1_DMACFG; +} + +/** @brief Disable circular mode for DMA transfers + * + * @param[in] adc Unsigned int32. ADC base address (@ref adc_reg_base) + */ +void adc_disable_dma_circular_mode(uint32_t adc) +{ + ADC_CFGR1(adc) &= ~ADC_CFGR1_DMACFG; +} + /**@}*/ |