📄 testpe4302.c
字号:
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#define DEVICE "/dev/PE4302"
int main()
{
int fd,ret;
unsigned short send,tmp;
if((fd=open(DEVICE,O_RDWR | O_NONBLOCK))<0)
{
perror("can not open device");
exit(1);
}
printf("open device: %s\n",DEVICE);
printf("now input your data to be send:");
scanf("%x",&tmp);
send=tmp&0x00ff;
printf("send: %x\n",send);
ret=write(fd,&send,1);
if (ret!=1)
{
printf("write error\n");
}
else
{
printf("send data ok\n");
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -