From bf1b81075e58c46f298f0e3d10e3b95292e69e8c Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Tue, 22 Apr 2003 00:04:14 +0000 Subject: [PATCH] added apply_cal demo --- demo/Makefile | 3 ++- demo/apply_cal.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 demo/apply_cal.c diff --git a/demo/Makefile b/demo/Makefile index ec0be40..fb2f3d9 100644 --- a/demo/Makefile +++ b/demo/Makefile @@ -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) diff --git a/demo/apply_cal.c b/demo/apply_cal.c new file mode 100644 index 0000000..4c105c9 --- /dev/null +++ b/demo/apply_cal.c @@ -0,0 +1,55 @@ +/* + * demo for changing between different calibrations + * Part of Comedilib + * + * Copyright (c) 1999,2000 David A. Schleef + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#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; +} + -- 2.26.2