該函數原型是這樣的:
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)
功能描述: 根據GPIO_InitStruct中指定的參數初始化外設GPIOx寄存器
輸入參數1: GPIOx:x可以是A,B,C,D或者E,選擇GPIO外設
輸入參數2: GPIO_InitStruct:指向結構GPIO_InitTypeDef的指針,包含了外設GPIO的配置信息
主函數開頭我們進行了這樣一個私有數據聲明:GPIO_InitTypeDef GPIO_InitStructure;
在頭文件“stm32f10x_gpio.h”看到對GPIO_InitTypeDef 的定義:
typedef struct
{
uint16_t GPIO_Pin; /*!< Specifies the GPIO pins to be configured.
This parameter can be any value of @ref GPIO_pins_define */
GPIOSpeed_TypeDef GPIO_Speed; /*!< Specifies the speed for the selected pins.
This parameter can be a value of @ref GPIOSpeed_TypeDef */
GPIOMode_TypeDef GPIO_Mode; /*!< Specifies the operating mode for the selected pins.
This parameter can be a value of @ref GPIOMode_TypeDef */
}GPIO_InitTypeDef;
在前面已經對GPIO_InitTypeDef中的各個參數進行了定義,對應的正是void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)輸入參數2的描述“指向結構GPIO_InitTypeDef的指針,包含了外設GPIO的配置信息”。
具體函數分析:http://blog.chinaunix.net/uid-27021180-id-3230782.html