Specifications
Comedi
42 / 148
5.4.1.12 comedi_from_phys
comedi_from_phys — convert physical units to sample
Synopsis
#include <comedilib.h>
lsampl_t comedi_from_phys(double data, comedi_range * range, lsampl_t maxdata);
Description
Converts parameter data given in physical units (double) into sample values (lsampl_t, between 0 and maxdata). The parameter
range represents the conversion information to use, and the parameter maxdata represents the maximum possible data value
for the channel that the data will be written to. The mapping between physical units and raw data is linear and assumes that the
converter has ideal characteristics.
Conversion is not affected by out-of-range behavior. Out-of-range data parameters are silently truncated to the range 0 to maxd-
ata.
5.4.1.13 comedi_from_physical
comedi_from_physical — convert physical units to sample using calibration data
Synopsis
#include <comedilib.h>
lsampl_t comedi_from_physical(double data, const comedi_polynomial_t * conversion_polynomial);
Description
Converts data given in physical units into Comedi’s integer sample values (lsampl_t, between 0 and maxdata — see comed-
i_get_maxdata()). The conversion_polynomial parameter is obtained from either comedi_get_hardcal_conv-
erter() or comedi_get_softcal_converter(). The allows non linear and board specific correction. The result will be
rounded using the C library’s current rounding direction. No range checking of the input data is performed. It is up to you to
ensure your data is within the limits of the output range you are using.
Return value
Comedi sample value corresponding to input physical value.
5.4.1.14 comedi_get_board_name
comedi_get_board_name — Comedi device name
Synopsis
#include <comedilib.h>
const char * comedi_get_board_name(comedi_t * device);