标题:
STM32F103的IO复用功能
[打印本页]
作者:
qinqin
时间:
2015-6-9 02:24
标题:
STM32F103的IO复用功能
重映射步骤为:
.打开重映射时钟和USART重映射后的I/O口引脚时钟,
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB |RCC_APB2Periph_AFIO,ENABLE);
2.I/O口重映射开启.
GPIO_PinRemapConfig(GPIO_Remap_USART1,ENABLE);
3.配制重映射引脚, 这里只需配置重映射后的I/O,原来的不需要去配置.
GPIO_InitStructure.GPIO_Pin =GPIO_Pin_6; GPIO_InitStructure.GPIO_Mode =GPIO_Mode_AF_PP; GPIO_InitStructure.GPIO_Speed =GPIO_Speed_50MHz; GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_InitStructure.GPIO_Pin =GPIO_Pin_7; GPIO_InitStructure.GPIO_Mode =GPIO_Mode_IN_FLOATING; GPIO_Init(GPIOB,&GPIO_InitStructure);
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1