⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stepmotor.c

📁 这是pxa270的步进电机驱动程序
💻 C
字号:
#include <stdio.h>
#include <stdlib.h>	//system
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <linux/delay.h>
#include <sys/ioctl.h>

#define DEVICE "/dev/mgc270-stepmotor"

static char ctrl[3] = {"09f"}; //OK

int main(int argc, char *argv[])
{
	int fd;

	fd = open(DEVICE, O_RDWR);
	if( fd < 0 ) {
		perror(DEVICE " open failed.\n");
		exit(1);
	}
	
	ioctl(fd, 0, 100, 0);
	write(fd, "19f", 3);
	write(fd, &ctrl, 3);
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -