库函数中有如下定义:
#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;
}
}
问题如下:
为什么使用CR2_EXTTRIG_SWSTART_Set,STM32不是将SWSTART也看做一个外部触发么,那么在ADC_CR2中的19至17位即EXTSEL[2:0]应该为111,才是选中SWSTART,可是库函数中CR2_EXTTRIG_SWSTART_Set显然是为其赋值000了?为什么?? |