From cda5011a87883e9e44b4474e3db1041fc61c13ab Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Fri, 11 May 2012 11:15:45 +0100 Subject: [PATCH] Moved comedi_to_phys and comedi_from_phys back to the main section. Both comedi_to_phys and comedi_to_physical complement each other. Comedi_to_phys is linear and very fast whereas comedi_to_physical is more precise but requires polynomials and calibration data. --- doc/deprecated_funcref.txt | 46 -------------------------- doc/funcref | 67 ++++++++++++++++++++++++++++++-------- 2 files changed, 53 insertions(+), 60 deletions(-) diff --git a/doc/deprecated_funcref.txt b/doc/deprecated_funcref.txt index 016b6cb..7c515f0 100644 --- a/doc/deprecated_funcref.txt +++ b/doc/deprecated_funcref.txt @@ -13,25 +13,6 @@ Description: with base_channel set to 0. -Function: comedi_from_phys -- convert physical units to sample -Retval: lsampl_t -Param: double data -Param: comedi_range * range -Param: lsampl_t maxdata -Status: deprecated -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. - - Conversion is not affected by out-of-range behavior. Out-of-range - data parameters are silently truncated to the range 0 - to maxdata. - Function: comedi_get_timer -- timer information (deprecated) Retval: int Param: comedi_t * device @@ -126,33 +107,6 @@ Status: deprecated Description: Not documented. -Function: comedi_to_phys -- convert sample to physical units -Retval: double -Param: lsampl_t data -Param: comedi_range * range -Param: lsampl_t maxdata -Status: deprecated -Description: - Converts parameter data given in sample values - (lsampl_t, between 0 and - maxdata) into physical units - (double). 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 was read. - - Conversion of endpoint sample values, that is, sample values - equal to 0 or maxdata, - is affected by the Comedilib out-of-range - behavior. If the out-of-range behavior is set to - COMEDI_OOR_NAN, - endpoint values are converted to NAN. If the out-of-range - behavior is set to COMEDI_OOR_NUMBER, the endpoint values are - converted similarly to other values. - - If there is an error, NAN is returned. - Function: comedi_trigger -- perform streaming input/output (deprecated) Retval: int Param: comedi_t * device diff --git a/doc/funcref b/doc/funcref index ffe484c..7620faf 100644 --- a/doc/funcref +++ b/doc/funcref @@ -49,8 +49,7 @@ Description: which can be determined using the function comedi_get_maxdata. Conversion of data values to physical units can be performed - by the function - comedi_to_physical. + by the functions comedi_to_phys (linear conversion) or comedi_to_physical (non-linear polynomial conversion). Returns: On success, comedi_data_read returns 1 (the number of samples read). If there is an error, -1 is returned. @@ -233,7 +232,27 @@ Returns: type, it returns its index. If there is an error, the function returns -1 and sets the appropriate error. -Function: comedi_from_physical -- convert physical units to sample +Function: comedi_from_phys -- convert physical units to sample +Retval: lsampl_t +Param: double data +Param: comedi_range * range +Param: 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 maxdata. + +Function: comedi_from_physical -- convert physical units to sample using calibration data Retval: lsampl_t Param: double data Param: const comedi_polynomial_t * conversion_polynomial @@ -245,17 +264,13 @@ Description: The conversion_polynomial parameter is obtained from either comedi_get_hardcal_converter or - comedi_get_softcal_converter. + 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. - - This function is intended to supplant - comedi_from_phys, - and was - introduced in order to support software calibrations. Returns: Comedi sample value corresponding to input physical value. @@ -593,7 +608,34 @@ Description: information, this function returns 1. Otherwise, this function returns 0. On error, this function returns -1. -Function: comedi_to_physical -- convert sample to physical units +Function: comedi_to_phys -- convert sample to physical units +Retval: double +Param: lsampl_t data +Param: comedi_range * range +Param: lsampl_t maxdata +Description: + Converts parameter data given in sample values + (lsampl_t, between 0 and + maxdata) into physical units + (double). 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 was read. The mapping between physical units + is linear and assumes ideal converter characteristics. + + Conversion of endpoint sample values, that is, sample values + equal to 0 or maxdata, + is affected by the Comedilib out-of-range + behavior. If the out-of-range behavior is set to + COMEDI_OOR_NAN, + endpoint values are converted to NAN. If the out-of-range + behavior is set to COMEDI_OOR_NUMBER, the endpoint values are + converted similarly to other values. + + If there is an error, NAN is returned. + +Function: comedi_to_physical -- convert sample to physical units using polynomials Retval: double Param: lsampl_t data Param: const comedi_polynomial_t * conversion_polynomial @@ -610,10 +652,7 @@ Description: you to check for data values of 0 or maxdata if you want to detect possibly out-of-range readings. - This function is intended to supplant - comedi_to_phys, - and was introduced in order to support software calibrations. -Returns: + Returns: Physical value corresponding to the input sample value. Function: comedi_unlock -- subdevice reservation -- 2.26.2