GPIOx->MODER |= (((uint32_t)GPIO_InitStruct->GPIO_Mode) << (pinpos * 2)); //如果是输出或复用模式,则可以配置下面几个参数,否则在初始化结构体中无论怎么配置都不会生效 if ((GPIO_InitStruct->GPIO_Mode == GPIO_Mode_OUT) || (GPIO_InitStruct->GPIO_Mode == GPIO_Mode_AF)) { /* ...
voidGPIO_DeInit(GPIO_TypeDef*GPIOx);可以写入GPIOA、GPIOB等//指定GPIO口外设复位voidGPIO_AFIODeInit(void);//复位AFIO外设voidGPIO_StructInit(GPIO_InitTypeDef*GPIO_InitStruct);填入结构体参数地//将结构体变量赋一个默认值voidGPIO_Init(GPIO_TypeDef*GPIOx,GPIO_InitTypeDef*GPIO_InitStruct);写入GPIOA、GPI...
CRL Configuration ---*/ /* Configure the eight low port pins */ if (((uint32_t)GPIO_InitStruct->GPIO_Pin & ((uint32_t)0x00FF)) != 0x00) { tmpreg = GPIOx->CRL; for (pinpos = 0x00; pinpos < 0x08; pinpos++) { pos = ((uint32_t)0x01) << pinpos; /* Get the port ...
开漏复用输出模式:GPIO_Mode_AF_OD 复用与不是复用的区别在于———非复用输出是cpu控制,复用功能则是从复用功能输出口上接受输出信号,可以是从外设接受输入信号输出。GPIO复用为其他外设,输出数据寄存器GPIOx_ODR无效; 输出的高低电平的来源于其它外设,施密特触发器打开,输入可用,通过输入数据寄存器可获取I/O实际状态...
* GPIO_InitStruct->GPIO_Mode = GPIO_Mode_AN; * - For other peripherals (TIM, USART...): * - Connect the pin to the desired peripherals' Alternate * Function (AF) using GPIO_PinAFConfig() function * - Configure the desired pin in alternate function mode using ...
* @brief AF 12 selection */ #define GPIO_AF_FSMC ((uint8_t)0xC) /* FSMC Alternate Function mapping */ #define GPIO_AF_OTG_HS_FS ((uint8_t)0xC) /* OTG HS configured in FS, Alternate Function mapping */ #define GPIO_AF_SDIO ((uint8_t)0xC) /* SDIO Alternate Function mapping...
DeinitializestheAlternateFunctions(remap,eventcontrolandEXTIconfiguration)registerstotheirdefaultresetvalues. RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO,ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_AFIO,DISABLE); voidGPIO_Init(GPIO_TypeDefGPIOx,GPIO_InitTypeDefGPIO_InitStruct); ...