1 #include "xparameters.h" //器件参数信息 2 #include "xstatus.h" //包含XST_FAILURE和XST_SUCCESS的宏定义 3 #include "xgpiops.h" //包含PS GPIO的函数 4 5 6 //宏定义GPIO_DEVICE_ID 7 #define GPIO_DEVICE_ID XPAR_XGPIOPS_0_DEVICE_ID 8 //连接到MIO的LED 9 #define MIOLED0 7 //连接到MIO7 10 #define MIOLED1 8 //连接到MIO8 11 #define MIOLED2 0 //连接到MIO0 12 13 14 XGpioPs Gpio; 15 XGpioPs_Config *ConfigPtr; 16 17 ConfigPtr = XGpioPs_LookupConfig(GPIO_DEVICE_ID); 18 Status = XGpioPs_CfgInitialize(&Gpio, ConfigPtr, 19 ConfigPtr->BaseAddr); 20 21 XGpioPs_SetDirectionPin(&Gpio, MIOLED0, 1); 22 XGpioPs_SetDirectionPin(&Gpio, MIOLED1, 1); 23 XGpioPs_SetDirectionPin(&Gpio, MIOLED2, 1); 24 //使能指定引脚输出:0禁止输出使能,1使能输出 25 XGpioPs_SetOutputEnablePin(&Gpio, MIOLED0, 1); 26 XGpioPs_SetOutputEnablePin(&Gpio, MIOLED1, 1); 27 XGpioPs_SetOutputEnablePin(&Gpio, MIOLED2, 1);
标签:Gpio,驱动,ConfigPtr,ZYNQ,XGpioPs,DEVICE,GPIO,define From: https://www.cnblogs.com/tuzki9611/p/16841324.html