更多配套资料CSDN地址:点赞+关注,功德无量。更多配套资料,欢迎私信。
一、ARM LINUX 开发板LED灯GPIO的控制
~~~~~~~~~~~~~main.c
#include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<unistd.h>
#include<sys/ioctl.h>
#include<fcntl.h>
#include"gpio.h"
int main(int argc,char * argv[])
{
int gpg_fd;
gpg_fd = open("/dev/gpgdriver", O_RDWR);
ioctl(gpg_fd, GPIO_CFG_PIN_OUT, GPIO_PIN_AREA(0,2));
char led = 0x1;
while(1)
{
write(gpg_fd, &led, 1);
led = led << 1;
usleep(300*1000);
if(led == 0x08)
{