//本来想自己弄个pwm驱动然后在测试下的,发现友善自带了
//那就不写了,测试下算了。
#include
#include
#include
#include
#include
#include
#include
#include
#define PWM_IOCTL_SET_FREQ 1
#define PWM_IOCTL_STOP 2
int main(int argc, char **argv)
{
int fd;
if (argc != 1) {
fprintf(stderr, "Usage: ./pwm\n");
exit(1);
}
fd = open("/dev/qq2440_pwm", 0);
if (fd < 0) {
perror("open device qq2440_pwm");
exit(1);
}
while(1){
ioctl(fd,PWM_IOCTL_SET_FREQ,1000);
usleep(500000);
ioctl(fd,PWM_IOCTL_STOP);
usleep(500000);
}
}
阅读(1584) | 评论(0) | 转发(0) |