Debian Codegraph @

demo/apply_cal.c

raw symbols SCIP
1 /*
2 * demo for changing between different (hardware-based) calibrations
3 * Part of Comedilib
4 *
5 * Copyright (c) 1999,2000 David A. Schleef <[email protected]>
6 *
7 * This file may be freely modified, distributed, and combined with
8 * other software, as long as proper attribution is given in the
9 * source code.
10 */
11 /*
12 * A little output demo
13 */
14
15 #include <stdio.h>
16 #include <comedilib.h>cxx . . $ `<file>/include/comedilib.h`/
17 #include <fcntl.h>
18 #include <unistd.h>
19 #include <stdlib.h>
20 #include <errno.h>
21 #include <getopt.h>
22 #include <ctype.h>
23 #include "examples.h"cxx . . $ `<file>/demo/examples.h`/
24
25 comedi_tcxx . . $ comedi_t# *devicecxx . . $ device.;
26
27
28 int maincxx . . $ main(afcd3168fc1188a4).(int argc, char *argv[])
29 {
30 lsampl_tcxx . . $ lsampl_t# data;
31 int ret;
32 struct parsed_optionscxx . . $ parsed_options# options;
33
34 init_parsed_optionscxx . . $ init_parsed_options(8caace97c9c42d8f).(&options);
35 parse_optionscxx . . $ parse_options(b6aabb1543a6f628).(&options, argc, argv);
36
37 devicecxx . . $ device.=comedi_opencxx . . $ comedi_open(d67864c6c007fe39).(options.filenamecxx . . $ parsed_options#filename.);
38 if(!devicecxx . . $ device.){
39 comedi_perrorcxx . . $ comedi_perror(85c52e162fed56f9).(options.filenamecxx . . $ parsed_options#filename.);
40 exitcxx . . $ exit(3ca292c338df9bb3).(-1);
41 }
42
43 data = options.valuecxx . . $ parsed_options#value.;
44 if(options.verbosecxx . . $ parsed_options#verbose.){
45 printfcxx . . $ printf(581fddd72a8db8fc).("writing %d to device=%s subdevice=%d channel=%d range=%d analog reference=%d\n",
46 data, options.filenamecxx . . $ parsed_options#filename., options.subdevicecxx . . $ parsed_options#subdevice., options.channelcxx . . $ parsed_options#channel., options.rangecxx . . $ parsed_options#range., options.arefcxx . . $ parsed_options#aref.);
47 }
48
49 ret = comedi_apply_calibrationcxx . . $ comedi_apply_calibration(b160c8755f4ab469).(devicecxx . . $ device., options.subdevicecxx . . $ parsed_options#subdevice., options.channelcxx . . $ parsed_options#channel., options.rangecxx . . $ parsed_options#range., options.arefcxx . . $ parsed_options#aref., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
50 if(ret < 0){
51 comedi_perrorcxx . . $ comedi_perror(85c52e162fed56f9).(options.filenamecxx . . $ parsed_options#filename.);
52 exitcxx . . $ exit(3ca292c338df9bb3).(0);
53 }
54
55 return 0;
56 }
57