给arm板的上的驱动设备写入数据
1.需要添加的头文件:
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <linux/spi/spidev.h>
2.实现代码
1 int fd = open("/dev/spidev",O_RDWR); 2 if (fd < 0) 3 qDebug()<<"can't open device"; 4 int ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, 500000); 5 if (ret == -1) 6 qDebug()<<"can't set max speed hz"; 7 unsigned char msg[1]; 8 write(fd,(char*)msg,sizeof(msg));