1COMEDI_APPLY_CALIBRA(3) Comedi reference COMEDI_APPLY_CALIBRA(3)
2
3
4
6 comedi_apply_calibration - set hardware calibration from file
7
9 #include <comedilib.h>
10
11 int comedi_apply_calibration(comedi_t * device, unsigned int subdevice,
12 unsigned int channel, unsigned int range,
13 unsigned int aref,
14 const char * file_path);
15
17 alpha
18
20 The function comedi_apply_calibration sets the hardware calibration for
21 the subdevice specified by device and subdevice so that it is in proper
22 calibration when using the channel specified by channel, range index
23 specified by range and analog reference specified by aref. It does so
24 by performing writes to the appropriate channels of the board's
25 calibration subdevice(s). Depending on the hardware, the calibration
26 settings used may or may not depend on the channel, range, or analog
27 reference. Furthermore, the calibrations appropriate for different
28 channel, range, and analog reference parameters may not be able to be
29 applied simultaneously. For example, some boards cannot have their
30 analog inputs calibrated for more than one input range simultaneously.
31 Applying a calibration for range 1 may blow away a previously applied
32 calibration for range 0. Or, applying a calibration for analog input
33 channel 0 may cause the same calibration to be applied to all the other
34 analog input channels as well. Your only guarantee is that calls to
35 comedi_apply_calibration on different subdevices will not interfere
36 with each other.
37
38 In practice, their are some rules of thumb on how calibrations behave.
39 No calibrations depend on the analog reference. A multiplexed analog
40 input will have calibration settings that do not depend on the channel,
41 and applying a setting for one channel will affect all channels
42 equally. Analog outputs, and analog inputs with independent a/d
43 converters for each input channel, will have calibration settings which
44 do depend on the channel, and the settings for each channel will be
45 independent of the other channels.
46
47 If you wish to investigate exactly what comedi_apply_calibration is
48 doing, you can perform reads on your board's calibration subdevice to
49 see which calibration channels it is changing. You can also try to
50 decipher the calibration file directly (it's a text file).
51
52 The file_path parameter can be used to specify the file which contains
53 the calibration information. If file_path is NULL, then Comedilib will
54 use a default file location. The calibration information used by this
55 function is generated by the comedi_calibrate program (see its man
56 page).
57
58 The functions comedi_parse_calibration_file,
59 comedi_apply_parsed_calibration, and comedi_cleanup_calibration provide
60 the same functionality at a slightly lower level.
61
63 Returns 0 on success, -1 on failure.
64
66 David Schleef <ds@schleef.org>
67 Author.
68
69 Frank Mori Hess <fmhess@users.sourceforge.net>
70 Author.
71
72 Herman Bruyninckx <Herman.Bruyninckx@mech.kuleuven.ac.be>
73 Author.
74
75 Bernd Porr <tech@linux-usb-daq.co.uk>
76 Author.
77
78 Ian Abbott <abbotti@mev.co.uk>
79 Author.
80
81 Éric Piel <piel@delmic.com>
82 Author.
83
85 Copyright © 1998-2003 David Schleef
86 Copyright © 2001-2003, 2005, 2008 Frank Mori Hess
87 Copyright © 2002-2003 Herman Bruyninckx
88 Copyright © 2012 Bernd Porr
89 Copyright © 2012 Ian Abbott
90 Copyright © 2012, 2015 Éric Piel
91
92 This document is part of Comedilib. In the context of this document,
93 the term "source code" as defined by the license is interpreted as the
94 XML source.
95
96 This library is free software; you can redistribute it and/or modify it
97 under the terms of the GNU Lesser General Public License as published
98 by the Free Software Foundation, version 2.1 of the License.
99
100 This library is distributed in the hope that it will be useful, but
101 WITHOUT ANY WARRANTY; without even the implied warranty of
102 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
103 General Public License for more details.
104
105 You should have received a copy of the GNU Lesser General Public
106 License along with this library; if not, write to the Free Software
107 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
108 USA.
109
110
111
112
113Comedi 05/11/2017 COMEDI_APPLY_CALIBRA(3)