GPIO_InitTypeDef InitStruct; /*選擇要控制的GPIO 引腳*/ InitStruct.GPIO_Pin = GPIO_Pin_10; /*設置引腳模式為輸出/輸入/復用/模擬模式*/ InitStruct.GPIO_Mode = GPIO_Mode_OUT; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AN; /*設置引腳的輸出類型為推挽/開漏輸出*/ InitStruct.GPIO_OType = GPIO_OType_PP; InitStruct.GPIO_OType = GPIO_OType_OD; /*設置引腳為上拉、下拉、既不上拉也不下拉模式*/ InitStruct.GPIO_PuPd = GPIO_PuPd_UP; InitStruct.GPIO_PuPd = GPIO_PuPd_DOWN; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL; /*設置引腳速率為2MHz */ InitStruct.GPIO_Speed = GPIO_Speed_2MHz; InitStruct.GPIO_Speed = GPIO_Speed_25MHz; InitStruct.GPIO_Speed = GPIO_Speed_50MHz; InitStruct.GPIO_Speed = GPIO_Speed_100MHz; | GPIO_InitTypeDef InitStruct; /*選擇要控制的GPIO 引腳*/ InitStructure.GPIO_Pin = GPIO_Pin_5; /*設置引腳模式/ InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;//推皖輸出 InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;//開漏輸出 InitStructure.GPIO_Mode = GPIO_Mode_AIN; //模擬輸入 InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;//浮空輸入 InitStructure.GPIO_Mode = GPIO_Mode_IPD; //下拉輸入 InitStructure.GPIO_Mode = GPIO_Mode_IPU; //上拉輸入 InitStructure.GPIO_Mode = GPIO_Mode_AF_OD; //復用開漏輸出 InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;//復用推挽輸出 /*設置引腳速率為2MHz */ InitStructure.GPIO_Speed = GPIO_Speed_2MHz; InitStructure.GPIO_Speed = GPIO_Speed_10MHz; InitStructure.GPIO_Speed = GPIO_Speed_50MHz; |