#define CR2_EXTTRIG_SWSTART_Set ((uint32_t)0x00500000)
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;
}
}
这里“#define CR2_EXTTRIG_SWSTART_Set ((uint32_t)0x00500000)”把ADC_CR2的位22SWSTART和位20EXTTRIG都使能了,为什么呀? |