Vijayaraghavan Narayanan / VLX6180X_API
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ranging_driver.h Source File

ranging_driver.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 ################################################################################
00003 #                             (C) STMicroelectronics 2014
00004 #
00005 # This program is free software; you can redistribute it and/or modify it under
00006 # the terms of the GNU General Public License version 2 and only version 2 as
00007 # published by the Free Software Foundation.
00008 #
00009 # This program is distributed in the hope that it will be useful, but WITHOUT
00010 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00011 # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00012 # details.
00013 #
00014 # You should have received a copy of the GNU General Public License along with
00015 # this program; if not, write to the Free Software Foundation, Inc.,
00016 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017 #
00018 #------------------------------------------------------------------------------
00019 #                             Imaging Division
00020 ################################################################################
00021 ********************************************************************************/
00022 
00023 /*!
00024  *\file ranging_driver.h
00025  *\brief Application-level functions used for configuration and operation during ranging.
00026  */
00027 
00028 #ifndef RANGING_DRIVER
00029 #define RANGING_DRIVER
00030 
00031 #include "common_driver.h"
00032 
00033 //-----------------------------------------------------------------------------
00034 // constant definitions
00035 //-----------------------------------------------------------------------------
00036 
00037 #define ECE_FACTOR      (85/100)    //0.85
00038 #define ECE_FACTOR_M    85          //ECE factor Molecular
00039 #define ECE_FACTOR_D    100         //ECE factor Denominator
00040 
00041 // register addresses
00042 #define SYSRANGE_START                        0x18
00043 #define SYSRANGE_THRESH_HIGH                  0x19
00044 #define SYSRANGE_THRESH_LOW                   0x1A
00045 #define SYSRANGE_INTERMEASUREMENT_PERIOD      0x1B
00046 #define SYSRANGE_MAX_CONVERGENCE_TIME         0x1C
00047 #define SYSRANGE_CROSSTALK_COMPENSATION_RATE  0x1E
00048 #define SYSRANGE_CROSSTALK_COMPENSATION_RANGE 0x20
00049 #define SYSRANGE_CROSSTALK_VALID_HEIGHT       0x21
00050 #define SYSRANGE_EARLY_CONVERGENCE_ESTIMATE   0x22
00051 #define SYSRANGE_PART_TO_PART_RANGE_OFFSET    0x24
00052 #define SYSRANGE_RANGE_IGNORE_VALID_HEIGHT    0x25
00053 #define SYSRANGE_RANGE_IGNORE_THRESHOLD       0x26
00054 #define SYSRANGE_EMITTER_BLOCK_THRESHOLD      0x28
00055 #define SYSRANGE_MAX_AMBIENT_LEVEL_THRESH     0x2A
00056 #define SYSRANGE_MAX_AMBIENT_LEVEL_MULT       0x2C
00057 #define SYSRANGE_RANGE_CHECK_ENABLES          0x2D
00058 #define SYSRANGE_VHV_RECALIBRATE              0x2E
00059 #define SYSRANGE_VHV_REPEAT_RATE              0x31
00060 
00061 #define RESULT_RANGE_STATUS      0x4D
00062 #define RESULT_RANGE_VAL         0x62
00063 #define RESULT_RANGE_SIGNAL_RATE 0x66
00064 
00065 // SYSRANGE_START
00066 #define RANGE_START_SINGLESHOT 0x01 // bit 0 set / bit 1 clear
00067 #define RANGE_START_CONTINUOUS 0x03 // bit 0 set / bit 1 set
00068 #define RANGE_CONTINUOUS_MODE  0x02 // bit 0 clear / bit 1 set
00069 #define RANGE_STOP             0x00 // bit 0 set / bit 1 don't care
00070 
00071 // RESULT_RANGE_STATUS bit masks
00072 #define RANGE_DEVICE_READY       0x01
00073 #define RANGE_ERROR_CODE         0xF0 // covers bits [7:4]
00074 
00075 // SYSRANGE_RANGE_CHECK_ENABLES bit masks
00076 #define RANGE_EARLY_CONVERGENCE_ENABLE  0x01
00077 #define RANGE_EARLY_CONVERGENCE_DISABLE 0xFE
00078 #define RANGE_RANGE_IGNORE_ENABLE       0x02
00079 #define RANGE_RANGE_IGNORE_DISABLE      0xFD
00080 #define RANGE_MAX_AMBIENT_ENABLE        0x04
00081 #define RANGE_MAX_AMBIENT_DISABLE       0xFB
00082 #define RANGE_EMITTER_BLOCK_ENABLE      0x08
00083 #define RANGE_EMITTER_BLOCK_DISABLE     0xF7
00084 #define RANGE_SIGNAL_TO_NOISE_ENABLE    0x10
00085 #define RANGE_SIGNAL_TO_NOISE_DISABLE   0xEF
00086 
00087 #define USER_CONV_CTRL_RETURN_THRESHOLD_FINE 0xB8
00088 
00089 #define VERNIER_MEASUREMENTS              0x0109
00090 #define VERNIER_RIPPLE_AVE_SAMPLE_PERIOD 0x010A
00091 
00092 
00093 /**
00094  * @brief This data type defines range measurement data.
00095  */
00096 typedef struct
00097 {
00098     int32_t range_mm;
00099     /**< range distance measurement (mm). */
00100 
00101     float_t signalRate_mcps;
00102     /**<  signal rate (MCPS), which is effectively a measure of target reflectance.*/
00103 
00104     uint32_t errorStatus;
00105     /**< Error status of the current measurement. \n
00106      * No Error := 0. \n
00107      * Refer to product sheets for other error codes. */
00108 }sensor_RangeData;
00109 
00110 
00111 /*!
00112  *\brief Device setup, for Ranging operations, with parameters that require the system mode to be STARTed before being applied.
00113  *\param[in] device_base_address
00114  *\retval sensor_error
00115  */
00116 sensor_error range_set_dynamic_config(uint8_t device_base_address);
00117 
00118 /*!
00119  *\brief Set Mode and Operation commands in the sysrange_start register.
00120  *
00121  * Possible combinations are : \n
00122  *
00123  * RANGE_START_SINGLESHOT 0x01 # bit 0 set / bit 1 clear  \n
00124  * RANGE_START_CONTINUOUS 0x03 # bit 0 set / bit 1 set \n
00125  * RANGE_STOP             0x01 # bit 0 set / bit 1 don't care \n
00126  *
00127  *\param[in] device_base_address
00128  *\param[in] mode Mode select/operation command to be written to the SYSRANGE_START register.
00129  *
00130  *\retval Boolean. Return True if a valid command is applied, otherwise False.
00131  */
00132 sensor_error range_set_systemMode(uint8_t device_base_address, int32_t mode);
00133 
00134 /*!
00135  *\brief Report status of Range mode-select and Stop/Start.
00136  *
00137  * Range_Start_Singleshot \n
00138  * Range_Start_Continuous \n
00139  * Range_Stop \n
00140  *
00141  *\param[in] device_base_address
00142  *\retval Integer. Returns the contents of the SYSRANGE_START register.
00143  */
00144 uint8_t range_get_systemMode(uint8_t device_base_address);
00145 
00146 /*!
00147  *\brief Report basic result from last ranging operation.
00148  *
00149  * Accessing Result_Range_Val register \n
00150  *
00151  *\param[in] device_base_address
00152  *\retval 8-bit Integer. Returns the result of the last successfully completed ranging operation, by reading the RESULT_RANGE_VAL register.
00153  */
00154 uint8_t range_get_result(uint8_t device_base_address);
00155 
00156 /*!
00157  *\brief Report signal rate from last ranging operation.
00158  * Reads the RESULT_RANGE_SIGNAL_RATE register.
00159  *\param[in] device_base_address
00160  *\retval a uint32_t in 9.7 format.
00161  */
00162 uint32_t range_get_signal_rate(uint8_t device_base_address);
00163 
00164 /*!
00165  *\brief Report all results from last ranging operation.
00166  *
00167  * Report all results data associated with a ranging operation. \n\n
00168  *
00169  * Result_range_val \n
00170  * Result_range_stray \n
00171  * Result_range_raw \n
00172  * Result_range_return_rate \n
00173  * Result_range_reference_rate \n
00174  * Result_range_Return_VCSEL_count \n
00175  * Result_range_Reference_VCSEL_count \n
00176  * Result_range_Return_AMB_count \n
00177  * Result_range_Reference_AMB_count \n
00178  * Result_range_Return_Conv_time \n
00179  * Result_range_Reference_Conv_time \n
00180  *
00181  *\param[in] device_base_address
00182  *
00183  *\retval List. Returns a list of all the results data, from the last successfully completed ranging operation.
00184  */
00185 sensor_error range_get_full_result(uint8_t device_base_address);
00186 
00187 /*!
00188  *\brief Set min/max range thresholds (1 to 254mm) in SYSRANGE_THRESH_LOW & SYSRANGE_THRESH_HIGH registers.
00189  *
00190  *\param[in] device_base_address
00191  *\param[in] low_threshold Ranging low threshold to be written to the SYSRANGE_THRESH_LOW register (default = 0mm.)
00192  *\param[in] high_threshold Ranging high threshold to be written to the SYSRANGE_THRESH_HIGH register (default = 255mm.)
00193  *\retval sensor_error
00194  */
00195 sensor_error Range_Set_Thresholds(uint8_t device_base_address, int32_t low_threshold, int32_t high_threshold);
00196 
00197 /*!
00198  *\brief Set ranging high threshold in the SYSRANGE_THRESH_HIGH register.
00199  *
00200  * Range : 0-255 mm \n
00201  *
00202  *\param[in] device_base_address
00203  *\param[in] threshold Ranging high threshold to be written to the SYSRANGE_THRESH_HIGH register(0-255mm).
00204  *\retval sensor_error
00205  */
00206 sensor_error range_set_high_threshold(uint8_t device_base_address, uint8_t threshold);
00207 
00208 /*!
00209  *\brief Report ranging high threshold from the SYSRANGE_THRESH_HIGH register.
00210  *
00211  * Range : 0-255 mm \n
00212  *
00213  *\param[in] device_base_address
00214  *\retval Integer. Returns the contents of the SYSRANGE_THRESH_HIGH register.
00215  */
00216 uint8_t range_get_high_threshold(uint8_t device_base_address);
00217 
00218 /*!
00219  *\brief Set ranging low threshold in the SYSRANGE_THRESH_LOW register.
00220  *
00221  * Range : 0-255 mm \n
00222  *
00223  *\param[in] device_base_address
00224  *\param[in] threshold Ranging low threshold to be written to the SYSRANGE_THRESH_LOW register.
00225  *\retval sensor_error
00226  */
00227 sensor_error range_set_low_threshold(uint8_t device_base_address, uint8_t threshold);
00228 
00229 /*!
00230  *\brief Report ranging low threshold from the SYSRANGE_THRESH_LOW register.
00231  *
00232  * Range : 0-255 mm \n
00233  *
00234  *\param[in] device_base_address
00235  *\retval Integer. Returns the contents of the SYSRANGE_THRESH_LOW register.
00236  */
00237 uint8_t range_get_low_threshold(uint8_t device_base_address);
00238 
00239 /*!
00240  *\brief Set ranging intermeasurement period in the SYSRANGE_INTERMEASUREMENT_PERIOD register.
00241  *
00242  * Time delay between measurements in continuous ranging mode. Range 10ms - 2.55secs (1 code = 10ms. Code 0 = 10ms.).\n
00243  * Min (default) value stored in NVM.
00244  *
00245  *\param[in] device_base_address
00246  *\param[in] intermeasurement_period Time delay in ms between measurements in continuous-ranging mode. <0-2550ms>
00247  *\retval sensor_error
00248  */
00249 sensor_error range_set_interMeasurement_period(uint8_t device_base_address, uint16_t intermeasurement_period);
00250 
00251 /*!
00252  *\brief Report ranging intermeasurement period from the SYSRANGE_INTERMEASUREMENT_PERIOD register.
00253  *
00254  * Range 10ms-2.55s, 1 code = 10 ms, code 0 = 10ms. \n
00255  *
00256  *\param[in] device_base_address
00257  *\retval Integer. Returns the range inter measurement period in ms.
00258  */
00259 uint16_t range_get_interMeasurement_period(uint8_t device_base_address);
00260 
00261 /*!
00262  *\brief Set ranging maximum convergence time in the SYSRANGE_MAX_CONVERGENCE_TIME register.
00263  *
00264  * Maximum time to run measurements in ranging modes. \n
00265  *
00266  * Range 0-50ms, 1 code = 1 ms \n
00267  *
00268  *\param[in] device_base_address
00269  *\param[in] max_convergence_time Maximum time to run measurements in ranging modes (max = 50ms).
00270  *\retval sensor_error
00271  */
00272 sensor_error range_set_max_convergence_time(uint8_t device_base_address, int32_t max_convergence_time);
00273 
00274 /*!
00275  *\brief Report ranging maximum convergence time from the SYSRANGE_MAX_CONVERGENCE_TIME register.
00276  *
00277  * Range 0-50ms, 1 code = 1 ms \n
00278  *
00279  *\param[in] device_base_address
00280  *\retval Integer. Returns the contents of the SYSRANGE_MAX_CONVERGENCE_TIME register.
00281  */
00282 
00283 uint8_t range_get_max_convergence_time(uint8_t device_base_address);
00284 
00285 /*!
00286  *\brief Set ranging crosstalk compensation rate in the SYSRANGE_CROSSTALK_COMPENSATION_RATE register.
00287  *
00288  * User-controlled crosstalk compensation rate, in MHz. \n
00289  *
00290  *\param[in] device_base_address
00291  *\param[in] crosstalk_compensation_rate User-controlled crosstalk compensation rate, in ranging modes.
00292  *\retval sensor_error
00293  */
00294 sensor_error range_set_crosstalk_compensation_rate(uint8_t device_base_address, int32_t crosstalk_compensation_rate);
00295 
00296 /*!
00297  *\brief Report ranging crosstalk compensation rate (MHz) from the SYSRANGE_CROSSTALK_COMPENSATION_RATE register.
00298  *
00299  *\param[in] device_base_address
00300  *\retval Integer. Returns the contents of the SYSRANGE_CROSSTALK_COMPENSATION_RATE register.
00301  */
00302 int32_t range_get_crosstalk_compensation_rate(uint8_t device_base_address);
00303 
00304 /*!
00305  *\brief Set ranging crosstalk compensation range in the SYSRANGE_CROSSTALK_COMPENSATION_RANGE register.
00306  *
00307  * User-controlled crosstalk compensation range, in mm. \n
00308  *
00309  *\param[in] device_base_address
00310  *\param[in] crosstalk_compensation_range User-controlled crosstalk compensation range, in ranging modes.
00311  *\retval sensor_error
00312  */
00313 sensor_error range_set_crosstalk_compensation_range(uint8_t device_base_address, int32_t crosstalk_compensation_range);
00314 
00315 /*!
00316  *\brief Report ranging crosstalk compensation range (mm) from the SYSRANGE_CROSSTALK_COMPENSATION_RANGE register.
00317  *
00318  *\param[in] device_base_address
00319  *\retval Integer. Returns the contents of the SYSRANGE_CROSSTALK_COMPENSATION_RANGE register.
00320  */
00321 uint8_t range_get_crosstalk_compensation_range(uint8_t device_base_address);
00322 
00323 /*!
00324  *\brief Set ranging crosstalk valid height in the SYSRANGE_CROSSTALK_VALID_HEIGHT register.
00325  *
00326  * Minimum range at which to apply crosstalk compensation, in mm. \n
00327  *\param[in] device_base_address
00328  *\param[in] crosstalk_valid_height Minimum range at which to apply crosstalk compensation, in ranging modes.
00329  *\retval sensor_error
00330  */
00331 sensor_error range_set_crosstalk_valid_height(uint8_t device_base_address, int32_t crosstalk_valid_height);
00332 
00333 /*!
00334  *\brief Report ranging crosstalk valid height from the SYSRANGE_CROSSTALK_VALID_HEIGHT register.
00335  *\param[in] device_base_address
00336  *\retval Integer. Returns the contents of the SYSRANGE_CROSSTALK_VALID_HEIGHT register.
00337  */
00338 uint8_t range_get_crosstalk_valid_height(uint8_t device_base_address);
00339 
00340 /*!
00341  *\brief Set ranging ECE (early convergence estimate) Threshold in the SYSRANGE_EARLY_CONVERGENCE_ESTIMATE' register.
00342  *
00343  * User-set limit below which a ranging operation is aborted. \n
00344  * An estimate of convergence time is performed 1ms into a ranging operation. If the return rate is below this user-set limit, the ranging operation is aborted to save power. \n
00345  *
00346  *\param[in] device_base_address
00347  *\retval sensor_error
00348  */
00349 sensor_error range_set_early_convergence_estimate_threshold(uint8_t device_base_address);
00350 
00351 /*!
00352  *\brief Report ranging early convergence estimate from the SYSRANGE_EARLY_CONVERGENCE_ESTIMATE register.
00353  *
00354  *\param[in] device_base_address
00355  *\retval Integer. Returns the contents of the SYSRANGE_EARLY_CONVERGENCE_ESTIMATE register.
00356  */
00357 uint8_t range_get_early_convergence_estimate_threshold(uint8_t device_base_address);
00358 
00359 uint32_t range_get_vernier_ave_total_time(uint8_t device_base_address);
00360 
00361 /*!
00362  *\brief read convergence count threshold from USER_CONV_CTRL_RETURN_THRESHOLD_FINE register.
00363  *
00364  *\param[in] device_base_address
00365  *\retval Integer. Returns the formated reading of the USER_CONV_CTRL_RETURN_THRESHOLD_FINE register.
00366  */
00367 uint32_t range_get_converg_ctrl_rtn_thresh_fine(uint8_t device_base_address);
00368 
00369 /*!
00370  *\brief Set Ranging Ignore Valid Height threshold in the SYSRANGE_RANGE_IGNORE_VALID_HEIGHT register.
00371  *
00372  * Default : 256 \n
00373  *
00374  *\param[in] device_base_address
00375  *\param[in] ignore_valid_height User-set limit
00376  *\retval sensor_error
00377  */
00378 sensor_error range_set_ignore_valid_height(uint8_t device_base_address, int32_t ignore_valid_height);
00379 
00380 /*!
00381  *\brief Report ranging ignore valid height threshold from the SYSRANGE_RANGE_IGNORE_VALID_HEIGHT register.
00382  *
00383  *\param[in] device_base_address
00384  *\retval Integer. Returns the contents of the SYSRANGE_RANGE_IGNORE_VALID_HEIGHT register.
00385  */
00386 uint8_t range_get_ignore_valid_height(uint8_t device_base_address);
00387 
00388 /*!
00389  *\brief Set Range Ignore Threshold in the SYSRANGE_RANGE_IGNORE_THRESHOLD register.
00390  *
00391  * Minimum acceptable count rate of VCSEL counts on the return array. \n
00392  *
00393  * Default : 2. \n
00394  *
00395  *\param[in] device_base_address
00396  *\param[in] range_ignore_threshold Minimum acceptable count rate of VCSEL counts on the return array. in Mcps 9.7 format.
00397  *\retval sensor_error
00398  */
00399 sensor_error range_set_range_ignore_threshold(uint8_t device_base_address, uint32_t range_ignore_threshold);
00400 
00401 /*!
00402  *\brief Report Range Ignore Threshold from the SYSRANGE_RANGE_IGNORE_THRESHOLD register. in Mcps 9.7 format.
00403  *
00404  *\param[in] device_base_address
00405  *\retval Integer. Returns the contents of the SYSRANGE_RANGE_IGNORE_THRESHOLD register.
00406  */
00407 uint32_t range_get_range_ignore_threshold(uint8_t device_base_address);
00408 
00409 /*!
00410  *\brief Set Emitter Block Threshold in the SYSRANGE_EMITTER_BLOCK_THRESHOLD register.
00411  *
00412  * Maximum Reference Array VCSEL returns allowed before reporting that the emitter is blocked. \n
00413  * MHz, 9.7 format \n
00414  *
00415  *\param[in] device_base_address
00416  *\param[in] emitter_block_threshold Minimum acceptable count rate of VCSEL counts on the return array.
00417  *\retval sensor_error
00418  */
00419 sensor_error range_set_emitter_block_threshold(uint8_t device_base_address, int32_t emitter_block_threshold);
00420 
00421 /*!
00422  *\brief Report Emitter Block Threshold from the SYSRANGE_EMITTER_BLOCK_THRESHOLD register.
00423  *
00424  * MHz, 9.7 format \n
00425  *
00426  *\param[in] device_base_address
00427  *\retval Integer. Returns the contents of the SYSRANGE_EMITTER_BLOCK_THRESHOLD register.
00428  */
00429 uint8_t range_get_emitter_block_threshold(uint8_t device_base_address);
00430 
00431 /**
00432  * @brief Function to set the SNR threshold.
00433  *
00434  *\param[in] device_base_address
00435  *\param[in] snrThresh
00436  *\retval sensor_error
00437  */
00438 sensor_error range_set_snr_thresh(uint8_t device_base_address, float_t snrThresh);
00439 
00440 /**
00441  * @brief Function to get the SNR threshold.
00442  *
00443  *\param[in] device_base_address
00444  *\retval Float. Returns the SNR threshold.
00445  */
00446 float_t range_get_snr_thresh(uint8_t device_base_address);
00447 
00448 
00449 /*!
00450  *\brief Set Range Check Enables in the SYSRANGE_RANGE_CHECK_ENABLES register.
00451  *
00452  *\param[in] device_base_address
00453  *\param[in] range_check_enables
00454  *\retval sensor_error
00455  */
00456 sensor_error range_set_range_check_enables(uint8_t device_base_address, int32_t range_check_enables);
00457 
00458 /*!
00459  *\brief Report Range Check Enables from the SYSRANGE_RANGE_CHECK_ENABLES register.
00460  *
00461  *\param[in] device_base_address
00462  *\retval Integer. Returns the contents of the SYSRANGE_RANGE_CHECK_ENABLES register.
00463  */
00464 uint8_t range_get_range_check_enables(uint8_t device_base_address);
00465 
00466 /*!
00467  *\brief Set Range Check Enables in the SYSRANGE_VHV_RECALIBRATE register.
00468  *
00469  *\param[in] device_base_address
00470  *\param[in] VHV_Recalibrate
00471  *\retval sensor_error
00472  */
00473 sensor_error range_set_vhv_recalibrate(uint8_t device_base_address, int32_t VHV_Recalibrate);
00474 
00475 /*!
00476  *\brief Report Range Check Enables from the SYSRANGE_VHV_RECALIBRATE register.
00477  *
00478  *\param[in] device_base_address
00479  *\retval Integer.
00480  */
00481 uint8_t range_get_vhv_recalibrate(uint8_t device_base_address);
00482 
00483 /*!
00484  *\brief Set VHV Repeat Rate.
00485  *
00486  * Repeat rate of autoVHV task \n
00487  * measurements, 0 = off, 255 = after every 255 measurements \n
00488  *
00489  *\param[in] device_base_address
00490  *\param[in] VHV_repeat_rate Repeat rate of autoVHV task
00491  *\retval sensor_error
00492  */
00493 sensor_error range_set_vhv_repeat_rate(uint8_t device_base_address, int32_t VHV_repeat_rate);
00494 
00495 /*!
00496  *\brief Report VHV Repeat Rate.
00497  *
00498  *\param[in] device_base_address
00499  *\retval Integer. Repeat rate of autoVHV task, in measurements. 0 = off, 255 = after every 255 measurements.
00500  */
00501 uint8_t range_get_vhv_repeat_rate(uint8_t device_base_address);
00502 
00503 /*!
00504  *\brief Report contents of the RESULT_RANGE_STATUS register.
00505  *
00506  *\param[in] device_base_address
00507  *\retval Integer
00508  */
00509 int32_t range_get_result_status(uint8_t device_base_address);
00510 
00511 /*!
00512  *\brief Report result_range_device_ready status in the RESULT_RANGE_STATUS register.
00513  *
00514  *\param[in] device_base_address
00515  *\retval Boolean. Return True if the result_range_device_ready bit in the RESULT_RANGE_STATUS register is set, otherwise False.
00516  */
00517 bool_t range_get_device_ready(uint8_t device_base_address);
00518 
00519 /*!
00520  *\brief Report result_range_error_codes status.
00521  *
00522  *\param[in] device_base_address
00523  *\retval Integer. Return True if the result_range_error_codes bit in the RESULT_RANGE_STATUS register is set, otherwise False.
00524  */
00525 uint8_t range_get_result_error_codes(uint8_t device_base_address);
00526 
00527 /*!
00528  *\brief Set the ECE Factor Molecular and Demoninator.
00529  *
00530  * (< 1.00 for maximum detection, > 1.00 for minimizing red glow)
00531  *
00532  *\param[in] device_base_address
00533  *\param[in] ECE_Factor_M
00534  *\param[in] ECE_Factor_D
00535  *\retval sensor_error
00536  */
00537 sensor_error range_set_ece_factor(uint8_t device_base_address, uint32_t ECE_Factor_M, uint32_t ECE_Factor_D);
00538 
00539 /*!
00540  *\brief Store the ECE Margin Molecular and Demoninator to provided variables.
00541  *
00542  * (< 1.00 for maximum detection, > 1.00 for minimizing red glow)
00543  *
00544  *\param[in] pece_factor_m pointer to ECE_Factor_M variable
00545  *\param[in] pece_factor_d pointer to ECE_Factor_D variable
00546  *\retval sensor_error.
00547  */
00548 sensor_error range_get_ece_factor(uint32_t *pece_factor_m, uint32_t *pece_factor_d);
00549 
00550 
00551 /*!
00552  *\brief Set System Interrupt Config GPIO for Ranging operations.
00553 
00554     Returns True if a command is successfully applied to the SYSTEM_INTERRUPT_CONFIG_GPIO register, otherwise False. \n
00555     Possible settings are : \n
00556       CONFIG_GPIO_INTERRUPT_DISABLED = 0x00 \n
00557       CONFIG_GPIO_INTERRUPT_LEVEL_LOW = 0x01 \n
00558       CONFIG_GPIO_INTERRUPT_LEVEL_HIGH = 0x02 \n
00559       CONFIG_GPIO_INTERRUPT_OUT_OF_WINDOW = 0x03 \n
00560       CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY = 0x04 \n
00561  *\param[in] device_base_address
00562  *\param[in] Ranging_GPIO_interrupt_config
00563  *\retval sensor_error
00564 */
00565 sensor_error range_set_system_interrupt_config_gpio(uint8_t device_base_address, uint8_t Ranging_GPIO_interrupt_config);
00566 
00567 /*!
00568  *\brief Report System Interrupt Config GPIO Ranging.
00569 
00570     Returns the ranging-only portion of the SYSTEM_INTERRUPT_CONFIG_GPIO register. \n
00571     Possible returns are : \n
00572       CONFIG_GPIO_INTERRUPT_DISABLED = 0x00 \n
00573       CONFIG_GPIO_INTERRUPT_LEVEL_LOW = 0x01 \n
00574       CONFIG_GPIO_INTERRUPT_LEVEL_HIGH = 0x02 \n
00575       CONFIG_GPIO_INTERRUPT_OUT_OF_WINDOW = 0x03 \n
00576       CONFIG_GPIO_INTERRUPT_NEW_SAMPLE_READY = 0x04 \n
00577  *\param[in] device_base_address
00578  *\retval Integer
00579 */
00580 uint8_t range_get_system_interrupt_config_gpio(uint8_t device_base_address);
00581 
00582 /*!
00583  *\brief Clear Ranging System Interrupt.
00584  *\param[in] device_base_address
00585  *\retval sensor_error
00586 */
00587 sensor_error range_set_system_interrupt_clear(uint8_t device_base_address);
00588 
00589 
00590 sensor_error Get_Range_History_Buffer(uint8_t device_base_address);
00591 
00592 /*!
00593  *\brief Report GPIO Interrupt Result Status for a Ranging operation.
00594 
00595     Returns the Ranging-only portion of the RESULT_INTERRUPT_STATUS_GPIO register. \n
00596     Possible returns are : \n
00597     0: No threshold events reported \n
00598     1: Level Low threshold event \n
00599     2: Level High threshold event \n
00600     3: Out Of Window threshold event \n
00601     4: New Sample Ready threshold event \n
00602  *\param[in] device_base_address
00603  *\retval Integer
00604 */
00605 uint8_t range_get_result_interrupt_status_gpio(uint8_t device_base_address);
00606 
00607 /*!
00608  *\brief Set history buffer to range mode and enable.
00609  *\param[in] device_base_address
00610  *\retval sensor_error
00611 */
00612 sensor_error range_set_history_buffer_mode_enable(uint8_t device_base_address);
00613 
00614 
00615 /**
00616  * @brief Function to return the Maximum range reported by the
00617  * sensor.
00618  */
00619 uint32_t range_get_upper_limit(uint8_t device_base_address);
00620 
00621 /**
00622  * @brief Function to return the Minimum range reported by the
00623  * sensor.
00624  */
00625 uint32_t range_get_lower_limit(uint8_t device_base_address);
00626 
00627 #endif
00628 
00629