请问为什么使用标准库函数配置STM32F4的usart的rx和rt为什么都被配置为复用推挽输出,而F1的板子则配置为复用推挽输出和浮空输入呢?为什么F4板子的输入输出引脚都配置为同一个模式呢?
F4的USART的GPIO配置
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_PinAFConfig(GPIOA,GPIO_PinSource9,GPIO_AF_USART1); // 将PA9复用成串口1
GPIO_PinAFConfig(GPIOA,GPIO_PinSource10,GPIO_AF_USART1);// 将PA10复用成串口1
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_AF; // GPIO引脚模式为复用模式
GPIO_InitStruct.GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct.GPIO_Pin = GPIO_Pin_9 | GPIO_Pin_10;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(GPIOA,&GPIO_InitStruct); // 初始化GPIO
F1的USART的GPIO配置
GPIO_InitStruct.GPIO_Pin =GPIO_Pin_9;
GPIO_InitStruct.GPIO_Mode =GPIO_Mode_AF_PP ;
GPIO_InitStruct.GPIO_Speed =GPIO_Speed_50MHz ;
GPIO_InitStruct.GPIO_Pin =GPIO_Pin_10 ;
GPIO_InitStruct.GPIO_Mode =GPIO_Mode_IN_FLOATING ;//浮空输入
GPIO_InitStruct.GPIO_Speed =GPIO_Speed_50MHz ;
GPIO_Init (GPIOA, &GPIO_InitStruct);