2.GPIO库函数
- // 参数写入GPIOX,所指定的GPIO外设就会被复位
- void GPIO_DeInit(GPIO_TypeDef* GPIOx);
-
- //可以复位AFIO外设
- void GPIO_AFIODeInit(void);
-
- //GPIO初始化函数,我们需要先定义一个结构体变量,然后赋值,最后调用这个函数
- void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct);
-
- //可以把结构体变量变成一个默认值
- void GPIO_StructInit(GPIO_InitTypeDef* GPIO_InitStruct);
-
- /***********下面四个为GPIO的读取函数********/
- uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
- uint16_t GPIO_ReadInputData(GPIO_TypeDef* GPIOx);
- uint8_t GPIO_ReadOutputDataBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
- uint16_t GPIO_ReadOutputData(GPIO_TypeDef* GPIOx);
-
- /*************读写GPIO口的函数**************/
- //设置指定的端口为高电平
- void GPIO_SetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
- //设定指定的端口为低电平
- void GPIO_ResetBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
- //前面的参数为选择端口,最后为指定写入数据值(Bit_SET / Bit_RESET)
- void GPIO_WriteBit(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin, BitAction BitVal);
- void GPIO_Write(GPIO_TypeDef* GPIOx, uint16_t PortVal);
-
-
- //剩下的这些我们现在还不会用到
- //锁定GPIO配置
- void GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
-
- //配置AFIO的事件输出功能函数
- void GPIO_EventOutputConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
- void GPIO_EventOutputCmd(FunctionalState NewState);
-
- //配置引脚重映射函数
- void GPIO_PinRemapConfig(uint32_t GPIO_Remap, FunctionalState NewState);
-
- //EXTI GPIO开启
- void GPIO_EXTILineConfig(uint8_t GPIO_PortSource, uint8_t GPIO_PinSource);
- void GPIO_ETH_MediaInterfaceConfig(uint32_t GPIO_ETH_MediaInterface);
|