added apply_cal demo

This commit is contained in:
Frank Mori Hess 2003-04-22 00:04:14 +00:00
parent cb76a1cfb7
commit bf1b81075e
2 changed files with 57 additions and 1 deletions

View file

@ -8,7 +8,8 @@ LIBS += ../lib/libcomedi.a -lm
BINS=tut1 tut2 # sv
MBINS=inp inpn eeprom_dump info outp insn antialias ao_waveform \
dio mmap ledclock receiver sigio select sender cmd poll
dio mmap ledclock receiver sigio select sender cmd poll \
apply_cal
all: $(BINS) $(MBINS)

55
demo/apply_cal.c Normal file
View file

@ -0,0 +1,55 @@
/*
* demo for changing between different calibrations
* Part of Comedilib
*
* Copyright (c) 1999,2000 David A. Schleef <ds@schleef.org>
*
* This file may be freely modified, distributed, and combined with
* other software, as long as proper attribution is given in the
* source code.
*/
/*
* A little output demo
*/
#include <stdio.h>
#include <comedilib.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <getopt.h>
#include <ctype.h>
#include "examples.h"
comedi_t *device;
int main(int argc, char *argv[])
{
lsampl_t data;
int ret;
parse_options(argc,argv);
device=comedi_open(filename);
if(!device){
comedi_perror(filename);
exit(0);
}
data = value;
if(verbose){
printf("writing %d to device=%s subdevice=%d channel=%d range=%d analog reference=%d\n",
data,filename,subdevice,channel,range,aref);
}
ret=comedi_apply_calibration(device,subdevice,channel,range,aref,NULL);
if(ret<0){
comedi_perror(filename);
exit(0);
}
return 0;
}