二、GPIO的相关库函数:
GPIO_DeInit(GPIO_TypeDef* GPIOx)
:复位指定的GPIO端口,将其所有寄存器恢复为默认值。
GPIO_AFIODeInit()
:复位AFIO模块,将其所有寄存器恢复为默认值。
GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
:初始化GPIO端口的引脚功能和模式,通过传递一个结构体参数来配置引脚的详细设置。
GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct)
:将GPIO初始化结构体的成员变量初始化为默认值。
GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
:读取指定引脚的输入电平(高电平或低电平)。
GPIO_ReadInputData(GPIO_TypeDef* GPIOx)
:读取整个GPIO端口的输入电平。
GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
:读取指定引脚的输出电平(高电平或低电平)。
GPIO_ReadOutputData(GPIO_TypeDef* GPIOx)
:读取整个GPIO端口的输出电平。
GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
:将指定引脚的输出电平设置为高电平。
GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
:将指定引脚的输出电平设置为低电平。
GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal)
:将指定引脚的输出电平设置为指定的BitVal(高电平或低电平)。
GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal)
:将整个GPIO端口的输出电平设置为指定的PortVal。
GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin)
:对指定引脚进行锁定,防止意外更改其配置。
GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
:配置GPIO事件输出选择。
GPIO_EventOutputCmd(FunctionalState NewState)
:使能或禁用GPIO事件输出。
GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState)
:配置GPIO引脚的重映射。
GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource)
:配置外部中断引脚的GPIO端口源和引脚源。
GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface)
|