1COMEDI_APPLY_CALIBRATION(3) COMEDI_APPLY_CALIBRATION(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, unsigned int aref, const char
13 *file_path);
14
16 alpha
17
19 This function sets the calibration of the specified subdevice so that
20 it is in proper calibration when using the specified channel, range and
21 aref. It does so by performing writes to the appropriate channels of
22 the board's calibration subdevice(s). Depending on the hardware, the
23 calibration settings used may or may not depend on the channel, range,
24 or aref. Furthermore, the calibrations appropriate for different chan‐
25 nel, range, and aref parameters may not be able to be applied simulta‐
26 neously. For example, some boards cannot have their analog inputs cal‐
27 ibrated for more than one input range simultaneously. Applying a cali‐
28 bration for range 1 may blow away a previously applied calibration for
29 range 0. Or, applying a calibration for analog input channel 0 may
30 cause the same calibration to be applied to all the other analog input
31 channels as well. Your only guarantee is that calls to
32 comedi_apply_calibration() on different subdevices will not interfere
33 with each other.
34
35 In practice, their are some rules of thumb on how calibrations behave.
36 No calibrations depend on the aref. A multiplexed analog input will
37 have calibration settings that do not depend on the channel, and apply‐
38 ing a setting for one channel will affect all channels equally. Analog
39 outputs, and analog inputs with independent a/d converters for each
40 input channel, will have calibrations settings which do depend on the
41 channel, and the settings for each channel will be independent of the
42 other channels.
43
44 If you wish to investigate exactly what comedi_apply_calibration() is
45 doing, you can perform reads on your board's calibration subdevice to
46 see which calibration channels it is changing. You can also try to
47 decipher the calibration file directly (it's a text file).
48
49 The file_path parameter can be used to specify the file which contains
50 the calibration information. If file_path is NULL, then comedilib will
51 use a default file location. The calibration information used by this
52 function is generated by the comedi_calibrate program (see its man
53 page).
54
55 The functions comedi_parse_calibration_file(), comedi_apply_parsed_cal‐
56 ibration(), and comedi_cleanup_calibration() provide the same function‐
57 ality at a slightly lower level.
58
60 Zero on success, a negative number on failure.
61
62 28 October 2007 COMEDI_APPLY_CALIBRATION(3)