|
/**********************************************************************************************
* 名稱:STM32。牵校桑蠋旌瘮到榻B及其使用
* 時間:2012/11/22
* 作者:1318857332
***********************************************************************************************/
/**********************************************************************************************
GPIO_DeInit(GPIO_TypeDef* GPIOx);
功能:將外設GPIOx 寄存器重設為缺省值
參數:GPIOx:x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
例子:GPIO_DeInit(GPIOA);
***********************************************************************************************/
/**********************************************************************************************
GPIO_AFIODeInit(void);
功能:將復用功能(重映射事件控制和EXTI設置)重設為缺省值
參數:無
例子:GPIO_AFIODeInit();
***********************************************************************************************/
/**********************************************************************************************
GPIO_Init(GPIO_TypeDef* GPIOx,GPIO_InitTypeDef* GPIO_InitStruct);
功能:根據GPIO_InitStruct 中指定的參數初始化外設 GPIOx 寄存器
參數:GPIOx:x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
GPIO_InitStruct:指向結構 GPIO_InitTypeDef 的指針,包含了外設GPIO的配置信息
例子:GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOA, &GPIO_InitStructure); //Configure all the GPIOA in Input Floating mode
***********************************************************************************************/
/**********************************************************************************************
GPIO_StructInit(GPIO_Ini tTypeDef* GPIO_InitStruct);
功能:把GPIO_InitStruct 中的每一個參數按缺省值填入
參數:GPIO_InitStruct:指向結構 GPIO_InitTypeDef 的指針,待初始化
例子:GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure); //Initialize the GPIO Init Structure parameters
***********************************************************************************************/
/**********************************************************************************************
GPIO_ReadInputDataBit(GPIO_TypeDef* GPIOx,u16 GPIO_Pin);
功能:讀取指定端口管腳的輸入
參數:GPIOx :x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
GPIO_Pin:待讀取的端口位
返回值: 輸入端口管腳值
例子:ReadValue=GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0);//Reads the seventh pin of the GPIOB and store it in ReadValue variable
***********************************************************************************************/
/**********************************************************************************************
GPIO_ReadInputData(GPIO_TypeDef* GPIOx);
功能:讀取指定的GPIO端口輸入
參數:GPIOx:x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
返回值: GPIO輸入數據端口值
例子:u16 ReadValue;
ReadValue=GPIO_ReadInputData(GPIOA);//Read the GPIOC input data port and store it in ReadValue
variable
***********************************************************************************************/
/**********************************************************************************************
GPIO_ReadOutputDataBit();
功能:讀取指定端口管腳的輸出
參數:GPIOx :x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
GPIO_Pin:待讀取的端口位
返回值:輸出端口管腳值
例子:u8 ReadValue;
ReadValue=GPIO_ReadOutputDataBit(GPIOA,GPIO_Pin_0);//Reads the seventh pin of the GPIOB and store it in ReadValue variable
***********************************************************************************************/
/**********************************************************************************************
GPIO_ReadOutput(GPIO_TypeDef* GPIOx);
功能:讀取指定的GPIO端口輸出
參數:GPIOx :x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
返回值:GPIO輸出數據端口值
例子:u16 ReadValue;
ReadValue=GPIO_ReadOutputData(GPIOC);//Read the GPIOC output data port and store it in ReadValue
variable
***********************************************************************************************/
/**********************************************************************************************
GPIO_SetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin);
功能:設置指定的數據端口位
參數:GPIOx :x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
GPIO_Pin:待設置的端口位
例子:GPIO_SetBits(GPIOA, GPIO_Pin_10 | GPIO_Pin_15);//Set the GPIOA port pin 10 and pin 15
***********************************************************************************************/
/**********************************************************************************************
GPIO_ResetBits(GPIO_TypeDef* GPIOx, u16 GPIO_Pin);
功能:清除指定的數據端口位
參數:GPIOx :x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
GPIO_Pin:待清除的端口位
例子:GPIO_ResetBits(GPIOA, GPIO_Pin_10 | GPIO_Pin_15);//Clears the GPIOA port pin 10 and pin 15
************************************************************************************************/
/***********************************************************************************************
GPIO_WriteBit(GPIO_TypeDef* GPIOx, u16 GPIO_Pin, BitAction BitVal);
功能:設置或者清除指定的數據端口位
參數:GPIOx :x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
GPIO_Pin:待設置或者清除指的端口位
BitVal: 該參數指定了待寫入的值 該參數必須取枚舉BitAction 的其中一個值
Bit_RESET: 清除數據端口位
Bit_SET: 設置數據端口位
例子:GPIO_WriteBit(GPIOA, GPIO_Pin_15, Bit_SET);//Set the GPIOA port pin 15
************************************************************************************************/
/***********************************************************************************************
GPIO_Write(GPIO_TypeDef* GPIOx, u16 PortVal);
功能:向指定GPIO數據端口寫入數據
參數:GPIOx :x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
PortVal: 待寫入端口數據寄存器的值
例子:GPIO_Write(GPIOA, 0x1101); //Write data to GPIOA data port
*************************************************************************************************/
/************************************************************************************************
GPIO_PinLockConfig(GPIO_TypeDef* GPIOx, u16 GPIO_Pin);
功能:鎖定GPIO管腳設置寄存器
參數:GPIOx :x 可以是A,B ,C ,D 或者E,來選擇GPIO外設
GPIO_Pin:待鎖定的端口位 該參數可以取GPIO_Pin_x(x 可以是 0-15)的任意組合
例子:GPIO_PinLockConfig(GPIOA, GPIO_Pin_0 | GPIO_Pin_1); //Lock GPIOA Pin0 and Pin1
*************************************************************************************************/
/************************************************************************************************
GPIO_EventOutputConfig(u8 GP IO_PortSource, u8 GPIO_PinSource)
功能:選擇GPIO管腳用作事件輸出
參數:GPIO_PortSource: 選擇用作事件輸出的 GPIO端口
GPIO_PinSource :事件輸出的管腳 ,該參數可以取GPIO_PinSourcex(x可以是 0-15)
例子:GPIO_EventOutputConfig(GPIO_PortSourceGPIOE, GPIO_PinSource5); //Selects the GPIOE pin 5 for EVENT output
*************************************************************************************************/
/*************************************************************************************************
GPIO_EventOutputCmd(FunctionalState NewState) ;
功能:使能或者失能事件輸出
參數:NewState: 事件輸出的新狀態 這個參數可以取:ENABLE 或者DISABLE
例子:GPIO_EventOutputConfig(GPIO_PortSourceGPIOC, GPIO_PinSource6);
GPIO_EventOutputCmd(ENABLE); //Enable Event Ouput to the GPIOC pin 6
**************************************************************************************************/
/*************************************************************************************************
GPIO_PinRemapConfig(u32 GPIO_Remap, FunctionalState NewState) ;
功能:改變指定管腳的映射
參數:GPIO_Remap: 選擇重映射的管腳
NewState: 管腳重映射的新狀態 這個參數可以取:ENABLE 或者DISABLE
例子:GPIO_PinRemapConfig(GPIO_Remap_I2C1, ENABLE);//I2C1_SCL on PB.08, I2C1_SDA on PB.09
**************************************************************************************************/
/*************************************************************************************************
GPIO_EXTILineConfig(u8 GPIO _PortSource, u8 GPIO_PinSource) ;
功能:選擇GPIO管腳用作外部中斷線路
參數:GPIO_PortSource: 選擇用作外部中斷線源的 GPIO端口
GPIO_PinSource :待設置的外部中斷線路
例子:GPIO_EXTILineConfig(GPIO_PortSource_GPIOB, GPIO_PinSource8);//Selects PB.08 as EXTI Line 8
**************************************************************************************************/
|
|