1COMEDI_GET_SOFTCAL_C(3) Comedi reference COMEDI_GET_SOFTCAL_C(3)
2
3
4
6 comedi_get_softcal_converter - get converter for software-calibrated
7 subdevice
8
10 #include <comedilib.h>
11
12 int comedi_get_softcal_converter(unsigned subdevice, unsigned channel,
13 unsigned range,
14 enum comedi_conversion_direction direction,
15 const comedi_calibration_t * parsed_calibration,
16 comedi_polynomial_t * converter);
17
19 alpha
20
22 The function comedi_get_softcal_converter initializes the
23 comedi_polynomial_t pointed to by converter so it can be passed to
24 either comedi_to_physical or comedi_from_physical. The
25 comedi_polynomial_t pointed to by converter can then be used to convert
26 data for the specified subdevice, channel, and range. The direction
27 parameter specifies whether converter will be passed to
28 comedi_to_physical or comedi_from_physical. The parsed_calibration
29 parameter points to the software calibration values for your device,
30 and may be obtained by calling comedi_parse_calibration_file on a
31 calibration file generated by the comedi_soft_calibrate program.
32
33 This function is only useful for boards that perform their calibrations
34 in software on the host computer. A subdevice will advertise the fact
35 that it depends on a software calibration with the SDF_SOFT_CALIBRATED
36 subdevice flag.
37
38 Whether or not the result of this function actually depends on the
39 channel parameter is hardware dependent. For example, the calibration
40 of a multiplexed analog input will typically not depend on the channel,
41 only the range. Analog outputs will typically use different
42 calibrations for each output channel.
43
44 Software calibrations are implemented as polynomials (up to third
45 order). Since the inverse of a polynomial of order higher than one
46 can't be represented exactly as another polynomial, you may not be able
47 to get converters for the “reverse” direction. For example, you may be
48 able to get a converter for an analog input in the COMEDI_TO_PHYSICAL
49 direction, but not in the COMEDI_FROM_PHYSICAL direction.
50
52 Returns 0 on success, -1 on failure.
53
55 David Schleef <ds@schleef.org>
56 Author.
57
58 Frank Mori Hess <fmhess@users.sourceforge.net>
59 Author.
60
61 Herman Bruyninckx <Herman.Bruyninckx@mech.kuleuven.ac.be>
62 Author.
63
64 Bernd Porr <tech@linux-usb-daq.co.uk>
65 Author.
66
67 Ian Abbott <abbotti@mev.co.uk>
68 Author.
69
70 Éric Piel <piel@delmic.com>
71 Author.
72
74 Copyright © 1998-2003 David Schleef
75 Copyright © 2001-2003, 2005, 2008 Frank Mori Hess
76 Copyright © 2002-2003 Herman Bruyninckx
77 Copyright © 2012 Bernd Porr
78 Copyright © 2012 Ian Abbott
79 Copyright © 2012, 2015 Éric Piel
80
81 This document is part of Comedilib. In the context of this document,
82 the term "source code" as defined by the license is interpreted as the
83 XML source.
84
85 This library is free software; you can redistribute it and/or modify it
86 under the terms of the GNU Lesser General Public License as published
87 by the Free Software Foundation, version 2.1 of the License.
88
89 This library is distributed in the hope that it will be useful, but
90 WITHOUT ANY WARRANTY; without even the implied warranty of
91 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
92 General Public License for more details.
93
94 You should have received a copy of the GNU Lesser General Public
95 License along with this library; if not, write to the Free Software
96 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
97 USA.
98
99
100
101
102Comedi 05/11/2017 COMEDI_GET_SOFTCAL_C(3)