Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
OPT3101PhaseOffset.h
00001 /*! 00002 * \file OPT3101PhaseOffset.h 00003 * \author Karthik Rajagopal <krthik@ti.com> 00004 * \version 0.9.1 00005 * 00006 * \section COPYRIGHT 00007 * TEXAS INSTRUMENTS TEXT FILE LICENSE 00008 * Copyright (c) 2018 Texas Instruments Incorporated 00009 * All rights reserved not granted herein. 00010 * Limited License. 00011 * Texas Instruments Incorporated grants a world-wide, royalty-free, non-exclusive license under copyrights and patents it now or hereafter owns or controls to make, have made, use, import, offer to sell and sell ("Utilize") this software subject to the terms herein. With respect to the foregoing patent license, such license is granted solely to the extent that any such patent is necessary to Utilize the software alone. The patent license shall not apply to any combinations which include this software, other than combinations with devices manufactured by or for TI ("TI Devices"). No hardware patent is licensed hereunder. 00012 * Redistributions must preserve existing copyright notices and reproduce this license (including the above copyright notice and the disclaimer and (if applicable) source code license limitations below) in the documentation and/or other materials provided with the distribution 00013 * Redistribution and use in binary form, without modification, are permitted provided that the following conditions are met: 00014 * * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any software provided in binary form. 00015 * * any redistribution and use are licensed by TI for use only with TI Devices. 00016 * * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code. 00017 * If software source code is provided to you, modification and redistribution of the source code are permitted provided that the following conditions are met: 00018 * * any redistribution and use of the source code, including any resulting derivative works, are licensed by TI for use only with TI Devices. 00019 * * any redistribution and use of any object code compiled from the source code and any resulting derivative works, are licensed by TI for use only with TI Devices. 00020 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or promote products derived from this software without specific prior written permission. 00021 * DISCLAIMER. 00022 * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00023 * 00024 * \section DESCRIPTION 00025 * This file contains the OPT3101::phaseOffsetC class declaration 00026 */ 00027 00028 #ifndef OPT3101PHASEOFFSET_H_ 00029 #define OPT3101PHASEOFFSET_H_ 00030 00031 #include <stdint.h> 00032 //#include "OPT3101device.h" 00033 #include "OPT3101frameData.h " 00034 00035 #ifdef OPT3101_USE_STREAMLIB 00036 #include <fstream> 00037 #include <iostream> 00038 #include <istream> 00039 #include <string> 00040 #endif 00041 00042 00043 namespace OPT3101{ 00044 /*! \class OPT3101::phaseOffsetC 00045 \brief Class that holds phase offset register data 00046 00047 The class contains the phase offset calibration registers and related snapshot from the device settings. 00048 Phase offset calibration is an important factory calibration that needs to be performed on every unit. The calibration is important to remove all the offsets and delays and read accurate distance or phase. 00049 The calibration involves having a target at a known distance and setting up offset register so that the device reads distance as expected. 00050 This class besides capturing the register settings also holds critical snapshot from device for analysis and debug. 00051 */ 00052 class phaseOffsetC { 00053 public: 00054 uint16_t phaseOffset; ///< This it the 16 bit phase offset register value to be written to the device registers for correcting the delays and offsets. 00055 uint16_t referenceDistanceInCodes; ///< Captures a snapshot of the distances measured in OPT3101::frameData::phase codes used during calibration 00056 uint8_t illumScale; ///< Captures the illumination scale used during phase offset measurement 00057 uint8_t illumDac; ///< Captures the illumination current setting used during phase offset measurement 00058 uint8_t illumDCdac; ///< Captures the illumination DC current setting used during phase offset measurement 00059 uint16_t freqCount; ///< Captures the frequency Count register OPT3101::registers::freq_count_read_reg during phase offset measurement 00060 uint8_t shiftIllumPhase; ///< Captures the register OPT3101::registers::shift_illum_phase during phase offset measurement 00061 frameData data; ///< Captures the OPT3101::frameData used to calculate the OPT3101::phaseOffsetC::phaseOffset register 00062 /*! 00063 * \brief initializes the members to 0 00064 * 00065 * \returns Nothing; 00066 */ 00067 phaseOffsetC(); 00068 /*! 00069 * \brief reports members of the instance 00070 * Print the members of the class instance on screen 00071 * \returns Nothing; 00072 */ 00073 void report(); 00074 /*! 00075 * \brief print header 00076 * Print the members of the class instance on screen 00077 * \returns Nothing; 00078 */ 00079 void printHeader(); 00080 /*! 00081 * \brief prints the contents of the class 00082 * Print the members of the class instance on screen 00083 * \returns Nothing; 00084 */ 00085 void print(); 00086 #ifdef OPT3101_USE_STDIOLIB 00087 /*! 00088 * \brief store phase offset values to file 00089 * This methods stores the phase offset values to a non-volatile memory. Storage to non-volatile memory is important to be able to calculate temperature coefficient OPT3101::crosstalkTempCoffC 00090 * \param[in] fileName; Path and name of the file to capture the crosstalk values to 00091 * \returns Nothing; 00092 */ 00093 void storeToFile(char *fileName); 00094 /*! 00095 * \brief load phase offset values from file 00096 * This methods loads the phase offset values to a non-volatile memory. Storage/Restoration to/from non-volatile memory is important to be able to calculate temperature coefficient OPT3101::crosstalkTempCoffC 00097 * \param[in] fileName; Path and name of the file from where the crosstalk values are loaded 00098 * \returns Nothing; 00099 */ 00100 void loadFromFile(char *fileName); 00101 #endif 00102 #ifdef OPT3101_USE_STREAMLIB 00103 /*! 00104 * \brief Operator overload to store class contents to a file 00105 * Casts all the class members for file storage 00106 * \param[out] os; os is data stream to serialize data 00107 * \param[in] data; data is pointer to the class to be serialized and stored 00108 * \returns std::ostream; Serialized std::ostream to be written to a file 00109 */ 00110 friend std::ostream& operator<<(std::ostream& os, const phaseOffsetC *data); 00111 /*! 00112 * \brief Operator overload to load class contents to from a file 00113 * Retreives all the class members from a stored file 00114 * \param[in] is; is input stream from where the data is loaded 00115 * \param[out] data; data is pointer to the class to be restored 00116 * \returns std::istream; Serialized Input stream loaded from file 00117 */ 00118 friend std::istream& operator>>(std::istream& is, phaseOffsetC *data); 00119 #endif 00120 }; 00121 } 00122 #endif /* OPT3101PHASEOFFSET_H_ */ 00123
Generated on Sun Jul 17 2022 05:22:03 by
