在 Set_System();中有调用以下这个子程序,但是这个子程序貌似只是将端口全部设置为输入,并且一开始将所有GPIO时钟使能之后又关闭了,理论上这个子程序是否运行都应该没有大碍。
可是如果在Set_System();中注释掉这个程序,USB插上电脑就会无法识别!
求问一下这其中的缘由,谢谢
void GPIO_AINConfig(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable all GPIOs Clock*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ALLGPIO, ENABLE);
/* Configure all GPIO port pins in Analog Input mode (floating input trigger OFF) */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_Init(GPIOE, &GPIO_InitStructure);
#ifdef USE_STM3210E_EVAL
GPIO_Init(GPIOF, &GPIO_InitStructure);
GPIO_Init(GPIOG, &GPIO_InitStructure);
#endif /* USE_STM3210E_EVAL */
/* Disable all GPIOs Clock*/
RCC_APB2PeriphClockCmd(RCC_APB2Periph_ALLGPIO, DISABLE);
} |