AnsweredAssumed Answered

ADC_SoftwareStartConvCmd will enable external trigger?

Question asked by gu.rui on Nov 17, 2011
Hi all,

I'm using StdPeriph lib and saw there is such code in stm32f10x_adc.c:

#define CR2_EXTTRIG_SWSTART_Set     ((uint32_t)0x00500000)

and 

/**
* @brief Enables or disables the selected ADC software start conversion .
* @param ADCx: where x can be 1, 2 or 3 to select the ADC peripheral.
* @param NewState: new state of the selected ADC software start conversion.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void ADC_SoftwareStartConvCmd(ADC_TypeDef* ADCx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected ADC conversion on external event and start the selected
ADC conversion */
ADCx->CR2 |= CR2_EXTTRIG_SWSTART_Set;
}
else
{
/* Disable the selected ADC conversion on external event and stop the selected
ADC conversion */
ADCx->CR2 &= CR2_EXTTRIG_SWSTART_Reset;
}
}

IIRC, set the bit 20 will enable the external trigger. So, why enable the external trigger when ADC_SoftwareStart ?

Thanks in advance.

Outcomes