我的想法就是在label上显示采样的数据,
void ADC::disp_result()
{
int fd;
int ret,val;
// char *i;
// printf("\nstart adc test\n\n");
QFile fdd("/dev/pp_adc");
fd=fdd.open(IO_ReadWrite);
// fd=open(DEVICE_NAME,O_RDWR);
// printf("fd=%d\n",fd);
if(fd==-1)
{
// printf("open device error\n",DEVICE_NAME);
}
else
{
//ioctl(fdd, IOCTL_SET_MSG, &s);
// ioctl(fd);
//for(int j=0;j<50;j++)
while(1)
{
val=ioctl(fd,0,0);
label_result->setNum(val);
// printf("val=%d\n",val);
usleep(5000000);
}
// ret=close(fd);
// printf("close the device test!\n");
}
// return 0;
}