Export to MBED Studio

Dependencies:   mbed

Committer:
tgrosch
Date:
Sun Oct 25 00:58:24 2020 +0000
Revision:
0:62b846b3988a
First successful compile.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tgrosch 0:62b846b3988a 1 /*!
tgrosch 0:62b846b3988a 2 * \file OPT3101device.h
tgrosch 0:62b846b3988a 3 * \author Karthik Rajagopal <krthik@ti.com>
tgrosch 0:62b846b3988a 4 * \version 0.9.1
tgrosch 0:62b846b3988a 5 *
tgrosch 0:62b846b3988a 6 * \section COPYRIGHT
tgrosch 0:62b846b3988a 7 * TEXAS INSTRUMENTS TEXT FILE LICENSE
tgrosch 0:62b846b3988a 8 * Copyright (c) 2018 Texas Instruments Incorporated
tgrosch 0:62b846b3988a 9 * All rights reserved not granted herein.
tgrosch 0:62b846b3988a 10 * Limited License.
tgrosch 0:62b846b3988a 11 * 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.
tgrosch 0:62b846b3988a 12 * 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
tgrosch 0:62b846b3988a 13 * Redistribution and use in binary form, without modification, are permitted provided that the following conditions are met:
tgrosch 0:62b846b3988a 14 * * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any software provided in binary form.
tgrosch 0:62b846b3988a 15 * * any redistribution and use are licensed by TI for use only with TI Devices.
tgrosch 0:62b846b3988a 16 * * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
tgrosch 0:62b846b3988a 17 * If software source code is provided to you, modification and redistribution of the source code are permitted provided that the following conditions are met:
tgrosch 0:62b846b3988a 18 * * any redistribution and use of the source code, including any resulting derivative works, are licensed by TI for use only with TI Devices.
tgrosch 0:62b846b3988a 19 * * 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.
tgrosch 0:62b846b3988a 20 * 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.
tgrosch 0:62b846b3988a 21 * DISCLAIMER.
tgrosch 0:62b846b3988a 22 * 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.
tgrosch 0:62b846b3988a 23 *
tgrosch 0:62b846b3988a 24 * \section DESCRIPTION
tgrosch 0:62b846b3988a 25 * This file contains the OPT3101::device class declaration. This is the master class that integrates all the components of the SDK
tgrosch 0:62b846b3988a 26 */
tgrosch 0:62b846b3988a 27
tgrosch 0:62b846b3988a 28
tgrosch 0:62b846b3988a 29 #ifndef OPT3101DEVICE_H_
tgrosch 0:62b846b3988a 30 #define OPT3101DEVICE_H_
tgrosch 0:62b846b3988a 31
tgrosch 0:62b846b3988a 32 #include "OPT3101RegisterDefinition.h"
tgrosch 0:62b846b3988a 33 #include "OPT3101Calibration.h"
tgrosch 0:62b846b3988a 34 #include "OPT3101DesignCoefficients.h"
tgrosch 0:62b846b3988a 35 #include "OPT3101PhaseOffset.h"
tgrosch 0:62b846b3988a 36 //#include "OPT3101frameData.h"
tgrosch 0:62b846b3988a 37 #include "definitions.h"
tgrosch 0:62b846b3988a 38
tgrosch 0:62b846b3988a 39 /*! \namespace OPT3101
tgrosch 0:62b846b3988a 40 \brief OPT3101 name space is used to classify and segregate all OPT3101SDK related methods and class definitions.
tgrosch 0:62b846b3988a 41
tgrosch 0:62b846b3988a 42 OPT3101SDK is intended to be used on various different host configurations. Having a segregated name space helps isolate and manage the structure of the classes and methods better.
tgrosch 0:62b846b3988a 43 */
tgrosch 0:62b846b3988a 44 namespace OPT3101 {
tgrosch 0:62b846b3988a 45
tgrosch 0:62b846b3988a 46 /**
tgrosch 0:62b846b3988a 47 \class OPT3101::device
tgrosch 0:62b846b3988a 48 \brief This is the master class that integrates all the OPT3101SDK functions
tgrosch 0:62b846b3988a 49
tgrosch 0:62b846b3988a 50 OPT3101::device is at the apex of the OPT3101SDK providing all the methods and functionality required for a full system bring up calibration and debug<br>
tgrosch 0:62b846b3988a 51 The register control for the device, calibration routines are instantiated in this call for user assess.
tgrosch 0:62b846b3988a 52 */
tgrosch 0:62b846b3988a 53 class device {
tgrosch 0:62b846b3988a 54 private:
tgrosch 0:62b846b3988a 55 void writeDataToEEPROM(uint8_t location, uint8_t data);
tgrosch 0:62b846b3988a 56 uint8_t readDataFromEEPROM(uint8_t location);
tgrosch 0:62b846b3988a 57 void measurePhaseOffset(OPT3101::phaseOffsetC *phaseOffset, uint16_t refDistanceInCodes);
tgrosch 0:62b846b3988a 58 void measureIllumCrosstalk(OPT3101::crosstalkC *illumXtalk);
tgrosch 0:62b846b3988a 59 uint8_t determineConfigCount();
tgrosch 0:62b846b3988a 60 OPT3101::frameData data[3];
tgrosch 0:62b846b3988a 61 public:
tgrosch 0:62b846b3988a 62 /*!
tgrosch 0:62b846b3988a 63 * \brief Constructor for class OPT3101::device
tgrosch 0:62b846b3988a 64 * Constructor definition for which is generated by OPT3101 configurator tool. Mainly the OPT3101::device::configurationFlags_isTXChannelActive and OPT3101::device::configurationFlags_isRegisterSetActive are set in the constructor
tgrosch 0:62b846b3988a 65 * \returns Nothing;
tgrosch 0:62b846b3988a 66 */
tgrosch 0:62b846b3988a 67 device();
tgrosch 0:62b846b3988a 68 OPT3101::registers reg; ///< Instance of the register class OPT3101::registers control for the device dev.reg.{registerName}=value initiates I2C register writes.
tgrosch 0:62b846b3988a 69 OPT3101::calibrationC calibration[1]; ///< Instance of the calibration class OPT3101::calibrationC. This instance acts a staging area to load, save and calculate calibration coefficients during initial bring up, debug and factory calibration steps.
tgrosch 0:62b846b3988a 70 /*!
tgrosch 0:62b846b3988a 71 * \brief resets device
tgrosch 0:62b846b3988a 72 * Template function which involves hostController::resetDevice method
tgrosch 0:62b846b3988a 73 * \returns Nothing;
tgrosch 0:62b846b3988a 74 */
tgrosch 0:62b846b3988a 75 void reset();
tgrosch 0:62b846b3988a 76 /*!
tgrosch 0:62b846b3988a 77 * \brief initializes the device
tgrosch 0:62b846b3988a 78 * Definition for the method is generated by the OPT3101 configuration generator tool. This method consists for all the register writes and sequences required to bring the device to desired operating condition
tgrosch 0:62b846b3988a 79 * \returns Nothing;
tgrosch 0:62b846b3988a 80 */
tgrosch 0:62b846b3988a 81 void initialize();
tgrosch 0:62b846b3988a 82 /*!
tgrosch 0:62b846b3988a 83 * \brief validates I2C communication
tgrosch 0:62b846b3988a 84 * This methods verifies if I2C protocol is working on the host
tgrosch 0:62b846b3988a 85 * \returns status; Status bit if True I2C is working and if False its not working
tgrosch 0:62b846b3988a 86 */
tgrosch 0:62b846b3988a 87 bool validateI2C();
tgrosch 0:62b846b3988a 88 /*!
tgrosch 0:62b846b3988a 89 * \brief validates if design ID is correct
tgrosch 0:62b846b3988a 90 * This methods verifies if design ID matches with what is expected from the device
tgrosch 0:62b846b3988a 91 * \returns status; Status bit if True Design ID matches and if False the design ID doesnt match up
tgrosch 0:62b846b3988a 92 */
tgrosch 0:62b846b3988a 93 bool validateDesignID();
tgrosch 0:62b846b3988a 94
tgrosch 0:62b846b3988a 95 /*!
tgrosch 0:62b846b3988a 96 * \brief Measures and corrects internal crosstalk
tgrosch 0:62b846b3988a 97 * Method abstracts the internal crosstalk measurement. There are bunch of steps and register read/writes involved to measure and correct internal crosstalk which this method handles. This method is recommended to be run every time after power-up
tgrosch 0:62b846b3988a 98 * \param[out] internalXtalk; internalXtalk in pointer to the instance of class OPT3101::crosstalkC where the internal crosstalk values gets loaded. This is used to understand and analyze system performance.
tgrosch 0:62b846b3988a 99 * \returns Nothing;
tgrosch 0:62b846b3988a 100 */
tgrosch 0:62b846b3988a 101 void measureAndCorrectInternalCrosstalk(crosstalkC *internalXtalk);
tgrosch 0:62b846b3988a 102 /*!
tgrosch 0:62b846b3988a 103 * \brief Measures illum crosstalk for a given channel and register set
tgrosch 0:62b846b3988a 104 * Method abstracts the illum crosstalk measurement. The measurement of illum crosstalk for a given channel and register set involves configuring the device with bunch of register writes and reads. This method abstracts the procedure to make it simple for users to adopt<br>
tgrosch 0:62b846b3988a 105 * This calibration procedure demands a very specific target/environmental requirement. This method invokes the appropriate template method from the envController class. Users needs to implement the method which achieves the specific requirement
tgrosch 0:62b846b3988a 106 * \param[out] illumXtalk; illumXtalk in pointer to the instance of class OPT3101::crosstalkC where the illum crosstalk values gets loaded. This is used to understand and analyze system performance besides being used for temp coff estimation and factory calibration.
tgrosch 0:62b846b3988a 107 * \param[in] txChannel; txChannel is the number denoting the channel for which the crosstalk measurement has to be performed. For eg: illumXtalk=0 does measurement for TX0 channel
tgrosch 0:62b846b3988a 108 * \param[in] registerSet; registerSet is a char 'h' or 'l' specifying register set on which the illum crosstalk measurement needs to be performed. For eg: registerSet='h' would perform measurement on registers related to illum_dac_h_tx*
tgrosch 0:62b846b3988a 109 * \param[in] shiftIllumPhase; shiftIllumPhase is the register value to set the OPT3101::registers::shift_illum_phase. This modifies the relative phase between the TX channels and the AFE helping perform non-linear calibration without moving the target.
tgrosch 0:62b846b3988a 110 * \returns Nothing;
tgrosch 0:62b846b3988a 111 */
tgrosch 0:62b846b3988a 112 void measureIllumCrosstalk(crosstalkC *illumXtalk, uint8_t txChannel, char registerSet, uint8_t shiftIllumPhase = 0);
tgrosch 0:62b846b3988a 113 /*!
tgrosch 0:62b846b3988a 114 * \brief Measures illum crosstalk for set of all the registers which are valid
tgrosch 0:62b846b3988a 115 * Method abstracts the illum crosstalk measurement. This measures all the cross talk values for the given set<br>
tgrosch 0:62b846b3988a 116 * This calibration procedure demands a very specific target/environmental requirement. This method invokes the appropriate template method from the envController class. Users needs to implement the method which achieves the specific requirement
tgrosch 0:62b846b3988a 117 * \returns Nothing;
tgrosch 0:62b846b3988a 118 */
tgrosch 0:62b846b3988a 119 void measureIllumCrosstalkSet(bool saveToFile=true);
tgrosch 0:62b846b3988a 120 /*!
tgrosch 0:62b846b3988a 121 * \brief Measures phase offset for a given channel and register set
tgrosch 0:62b846b3988a 122 * Method abstracts the phase offset measurement. The measurement of phase offset is for a given channel and register set involves configuring the device with bunch of register writes and reads. This method abstracts the procedure to make it simple for users to adopt<br>
tgrosch 0:62b846b3988a 123 * This calibration procedure demands a very specific target/environmental requirement. This method invokes the appropriate template method from the envController class. Users needs to implement the method which achieves the specific requirement
tgrosch 0:62b846b3988a 124 * \param[out] phaseOffset; phaseOffset in pointer to the instance of class OPT3101::phaseOffsetC where the phase offset values gets loaded. This is used to understand and analyze system performance besides being used for temp coff estimation and factory calibration.
tgrosch 0:62b846b3988a 125 * \param[in] txChannel; txChannel is the number denoting the channel for which the measurement has to be performed. For eg: illumXtalk=0 does measurement for TX0 channel
tgrosch 0:62b846b3988a 126 * \param[in] registerSet; registerSet is a char 'h' or 'l' specifying register set on which the measurement needs to be performed. For eg: registerSet='h' would perform measurement on registers related to illum_dac_h_tx*
tgrosch 0:62b846b3988a 127 * \param[in] refDistanceInCodes; refDistanceInCodes is reference distance of the target specified in codes OPT3101::frameData::phase codes. The conversion for the distance in mm to codes documented in the method OPT3101::device::calibrationSession_perDesignCalibrationPhaseTemp
tgrosch 0:62b846b3988a 128 * \param[in] shiftIllumPhase; shiftIllumPhase is the register value to set the OPT3101::registers::shift_illum_phase. This modifies the relative phase between the TX channels and the AFE helping perform non-linear calibration without moving the target.
tgrosch 0:62b846b3988a 129 * \returns Nothing;
tgrosch 0:62b846b3988a 130 */
tgrosch 0:62b846b3988a 131 void measurePhaseOffset(phaseOffsetC *phaseOffset, uint8_t txChannel, char registerSet, uint16_t refDistanceInCodes, uint8_t shiftIllumPhase = 0);
tgrosch 0:62b846b3988a 132 /*!
tgrosch 0:62b846b3988a 133 * \brief Measures phase offset for a set of all registers
tgrosch 0:62b846b3988a 134 * Method abstracts the phase offset measurement. The measurement of phase offset is for a given channel and register set involves configuring the device with bunch of register writes and reads. This method abstracts the procedure to make it simple for users to adopt<br>
tgrosch 0:62b846b3988a 135 * This calibration procedure demands a very specific target/environmental requirement. This method invokes the appropriate template method from the envController class. Users needs to implement the method which achieves the specific requirement
tgrosch 0:62b846b3988a 136 * \returns Nothing;
tgrosch 0:62b846b3988a 137 */
tgrosch 0:62b846b3988a 138 void measurePhaseOffsetSet(bool saveToFile=true);
tgrosch 0:62b846b3988a 139 /*!
tgrosch 0:62b846b3988a 140 * \brief load illum crosstalk from OPT3101::crosstalkC class to the h/w
tgrosch 0:62b846b3988a 141 * Method loads the registers from OPT3101::crosstalkC instance specified to the h/w to specified txChannel and registerSet
tgrosch 0:62b846b3988a 142 * \param[out] illumXtalk; illumXtalk is pointer to the instance of OPT3101::crosstalkC class. The register values form the instance are loaded to the hardware to specified txChannel and registerSet
tgrosch 0:62b846b3988a 143 * \param[in] txChannel; txChannel is the number denoting the channel to which the registers need to be loaded For eg: illumXtalk=0 loads for TX0 channel
tgrosch 0:62b846b3988a 144 * \param[in] registerSet; registerSet is a char 'h' or 'l' specifying register set on which register needs to be loaded. For eg: registerSet='h' would load on to registers related to illum_dac_h_tx*
tgrosch 0:62b846b3988a 145 * \returns Nothing;
tgrosch 0:62b846b3988a 146 */
tgrosch 0:62b846b3988a 147 void loadIllumCrosstalk(crosstalkC *illumXtalk, uint8_t txChannel, char registerSet);
tgrosch 0:62b846b3988a 148 /*!
tgrosch 0:62b846b3988a 149 * \brief load phase offset from OPT3101::phaseOffsetC class to the h/w
tgrosch 0:62b846b3988a 150 * Method loads the registers from OPT3101::phaseOffsetC instance specified to the h/w to specified txChannel and registerSet
tgrosch 0:62b846b3988a 151 * \param[in] phaseOffset; phaseOffset is pointer to the instance of OPT3101::phaseOffsetC class. The register values form the instance are loaded to the hardware to specified txChannel and registerSet
tgrosch 0:62b846b3988a 152 * \param[in] txChannel; txChannel is the number denoting the channel to which the registers need to be loaded For eg: illumXtalk=0 loads for TX0 channel
tgrosch 0:62b846b3988a 153 * \param[in] registerSet; registerSet is a char 'h' or 'l' specifying register set on which register needs to be loaded. For eg: registerSet='h' would load on to registers related to illum_dac_h_tx*
tgrosch 0:62b846b3988a 154 * \returns Nothing;
tgrosch 0:62b846b3988a 155 */
tgrosch 0:62b846b3988a 156 void loadPhaseOffset(phaseOffsetC *phaseOffset, uint8_t txChannel, char registerSet);
tgrosch 0:62b846b3988a 157 /*!
tgrosch 0:62b846b3988a 158 * \brief Manually set the illumination cross talk coefficients after calculating outside
tgrosch 0:62b846b3988a 159 * Method to manually set illumination crosstalk temperature coefficients.
tgrosch 0:62b846b3988a 160 * \returns Nothing;
tgrosch 0:62b846b3988a 161 */
tgrosch 0:62b846b3988a 162 void manuallySetIllumCrosstalkTempCoffs();
tgrosch 0:62b846b3988a 163 /*!
tgrosch 0:62b846b3988a 164 * \brief Manually set the Phase Temperature coefficients after calculating outside
tgrosch 0:62b846b3988a 165 * Method to manually Phase Temperature coefficients.
tgrosch 0:62b846b3988a 166 * \returns Nothing;
tgrosch 0:62b846b3988a 167 */
tgrosch 0:62b846b3988a 168 void manuallySetPhaseTempCoffs();
tgrosch 0:62b846b3988a 169 /*!
tgrosch 0:62b846b3988a 170 * \brief load crosstalk temperature coefficients from OPT3101::crosstalkTempCoffC class to the h/w
tgrosch 0:62b846b3988a 171 * Method loads the registers from OPT3101::crosstalkTempCoffC instance specified to the h/w to specified txChannel and registerSet
tgrosch 0:62b846b3988a 172 * \param[in] illumXtalkTempCoff; illumXtalkTempCoff is pointer to the instance of OPT3101::crosstalkTempCoffC class. The register values form the instance are loaded to the hardware to specified txChannel and registerSet
tgrosch 0:62b846b3988a 173 * \param[in] txChannel; txChannel is the number denoting the channel to which the registers need to be loaded For eg: illumXtalk=0 loads for TX0 channel
tgrosch 0:62b846b3988a 174 * \param[in] registerSet; registerSet is a char 'h' or 'l' specifying register set on which register needs to be loaded. For eg: registerSet='h' would load on to registers related to illum_dac_h_tx*
tgrosch 0:62b846b3988a 175 * \returns Nothing;
tgrosch 0:62b846b3988a 176 */
tgrosch 0:62b846b3988a 177 void loadIllumCrosstalkTempCoff(crosstalkTempCoffC *illumXtalkTempCoff, uint8_t txChannel, char registerSet);
tgrosch 0:62b846b3988a 178 /*!
tgrosch 0:62b846b3988a 179 * \brief load phase offset temperature coefficients from OPT3101::phaseTempCoffC class to the h/w
tgrosch 0:62b846b3988a 180 * Method loads the registers from OPT3101::phaseTempCoffC instance specified to the h/w to specified txChannel and registerSet
tgrosch 0:62b846b3988a 181 * \param[in] phaseTempCoff; phaseTempCoff is pointer to the instance of OPT3101::phaseTempCoffC class. The register values form the instance are loaded to the hardware to specified txChannel and registerSet
tgrosch 0:62b846b3988a 182 * \param[in] txChannel; txChannel is the number denoting the channel to which the registers need to be loaded For eg: illumXtalk=0 loads for TX0 channel
tgrosch 0:62b846b3988a 183 * \param[in] registerSet; registerSet is a char 'h' or 'l' specifying register set on which register needs to be loaded. For eg: registerSet='h' would load on to registers related to illum_dac_h_tx*
tgrosch 0:62b846b3988a 184 * \returns Nothing;
tgrosch 0:62b846b3988a 185 */
tgrosch 0:62b846b3988a 186 void loadPhaseOffsetTempCoff(phaseTempCoffC *phaseTempCoff, uint8_t txChannel, char registerSet);
tgrosch 0:62b846b3988a 187 /*!
tgrosch 0:62b846b3988a 188 * \brief load phase ambient coefficients from OPT3101::phaseAmbientCoffC class to the h/w
tgrosch 0:62b846b3988a 189 * Method loads the registers from OPT3101::phaseAmbientCoff instance specified to the h/w
tgrosch 0:62b846b3988a 190 * \param[in] phaseAmbientCoff; phaseAmbientCoff is pointer to the instance of OPT3101::phaseAmbientCoffC class. The register values form the instance are loaded to the hardware
tgrosch 0:62b846b3988a 191 * \returns Nothing;
tgrosch 0:62b846b3988a 192 */
tgrosch 0:62b846b3988a 193 void loadPhaseAmbientCoff(phaseAmbientCoffC *phaseAmbientCoff);
tgrosch 0:62b846b3988a 194
tgrosch 0:62b846b3988a 195 /*!
tgrosch 0:62b846b3988a 196 * \brief loads all illum crosstalk set specified by OPT3101 configuration tool to h/w
tgrosch 0:62b846b3988a 197 * Method loads all the illum crosstalk registers from OPT3101::calibrationC::illumCrosstalk to the h/w to their specific TX channels and register sets. The order in which data is stored and indexed is preset and loaded accordingly.
tgrosch 0:62b846b3988a 198 * The method provides a higher level of abstraction for users to just load the illumCrosstalk calibration portion of the calibration data from the self contained instance of OPT3101::calibrationC to the h/w
tgrosch 0:62b846b3988a 199 * \param[in] loadFromFile; loadFromFile is a flag which specifies whether to load the calibration coff from file or from the OPT3101::device::calibration member of the OPT3101::calibrationC class
tgrosch 0:62b846b3988a 200 * \returns Nothing;
tgrosch 0:62b846b3988a 201 */
tgrosch 0:62b846b3988a 202 void loadIllumCrosstalkSet(bool loadFromFile = true);
tgrosch 0:62b846b3988a 203 /*!
tgrosch 0:62b846b3988a 204 * \brief loads all illum crosstalk temp coefficients set specified by OPT3101 configuration tool to h/w
tgrosch 0:62b846b3988a 205 * Method loads all the illum crosstalk temp coff registers from OPT3101::calibrationC::illumCrosstalkTempCoff to the h/w to their specific TX channels and register sets. The order in which data is stored and indexed is preset and loaded accordingly.
tgrosch 0:62b846b3988a 206 * The method provides a higher level of abstraction for users to just load the illumCrosstalk temp coff calibration portion of the calibration data from the self contained instance of OPT3101::calibrationC to the h/w
tgrosch 0:62b846b3988a 207 * \returns Nothing;
tgrosch 0:62b846b3988a 208 */
tgrosch 0:62b846b3988a 209 void loadIllumCrosstalkTempCoffSet();
tgrosch 0:62b846b3988a 210 /*!
tgrosch 0:62b846b3988a 211 * \brief loads all phase offset set specified by OPT3101 configuration tool to h/w
tgrosch 0:62b846b3988a 212 * Method loads all the phase offset registers from OPT3101::calibration::phaseOffset to the h/w to their specific TX channels and register sets. The order in which data is stored and indexed is preset and loaded accordingly.
tgrosch 0:62b846b3988a 213 * The method provides a higher level of abstraction for users to just load the phase offset calibration portion of the calibration data from the self contained instance of OPT3101::calibrationC to the h/w
tgrosch 0:62b846b3988a 214 * \param[in] loadFromFile; loadFromFile is a flag which specifies whether to load the calibration coff from file or from the OPT3101::device::calibration member of the OPT3101::calibrationC class
tgrosch 0:62b846b3988a 215 * \returns Nothing;
tgrosch 0:62b846b3988a 216 */
tgrosch 0:62b846b3988a 217 void loadPhaseOffsetSet(bool loadFromFile = true);
tgrosch 0:62b846b3988a 218 /*!
tgrosch 0:62b846b3988a 219 * \brief loads all phase temp coff set specified by OPT3101 configuration tool to h/w
tgrosch 0:62b846b3988a 220 * Method loads all the phase temp coff registers from OPT3101::calibration::phaseTempCoff to the h/w to their specific TX channels and register sets. The order in which data is stored and indexed is preset and loaded accordingly.
tgrosch 0:62b846b3988a 221 * The method provides a higher level of abstraction for users to just load the phase temp coff calibration portion of the calibration data from the self contained instance of OPT3101::calibrationC to the h/w
tgrosch 0:62b846b3988a 222 * \param[in] loadFromFile; loadFromFile is a flag which specifies whether to load the calibration coff from file or from the OPT3101::device::calibration member of the OPT3101::calibrationC class
tgrosch 0:62b846b3988a 223 * \returns Nothing;
tgrosch 0:62b846b3988a 224 */
tgrosch 0:62b846b3988a 225 void loadPhaseOffsetTempCoffSet();
tgrosch 0:62b846b3988a 226 /*!
tgrosch 0:62b846b3988a 227 * \brief loads phase ambient coff set to h/w
tgrosch 0:62b846b3988a 228 * Method loads all the phase ambient coff registers from OPT3101::calibrationC::phaseAmbientCoff to the h/w.
tgrosch 0:62b846b3988a 229 * The method provides a higher level of abstraction for users to just load the phase ambient coff calibration portion of the calibration data from the self contained instance of OPT3101::calibrationC to the h/w
tgrosch 0:62b846b3988a 230 * \returns Nothing;
tgrosch 0:62b846b3988a 231 */
tgrosch 0:62b846b3988a 232 void loadPhaseAmbientCoffSet();
tgrosch 0:62b846b3988a 233 /*!
tgrosch 0:62b846b3988a 234 * \brief shows live view
tgrosch 0:62b846b3988a 235 * scrolls data on screen
tgrosch 0:62b846b3988a 236 * param[in] nFrames; Number of Frames to display data
tgrosch 0:62b846b3988a 237 * param[in] refreshDelayinms; Refresh delay in mS
tgrosch 0:62b846b3988a 238 * param[in] scroll; Flag to determine if data needs to scrool on screen
tgrosch 0:62b846b3988a 239 * \returns Nothing;
tgrosch 0:62b846b3988a 240 */
tgrosch 0:62b846b3988a 241 void liveDataView(uint32_t nFrames,uint32_t refreshDelayinms,bool scroll=false);
tgrosch 0:62b846b3988a 242 /*!
tgrosch 0:62b846b3988a 243 * \brief Initialize hardware and view data
tgrosch 0:62b846b3988a 244 * Initializes the hardware and views data
tgrosch 0:62b846b3988a 245 * param[in] nFrames; Number of Frames to display data
tgrosch 0:62b846b3988a 246 * param[in] loadCalibration; Flag to determine if calibration data needs to be loaded
tgrosch 0:62b846b3988a 247 * \returns Nothing;
tgrosch 0:62b846b3988a 248 */
tgrosch 0:62b846b3988a 249 void resetInitAndViewData(uint32_t nFrames=100,bool loadCalibration=false);
tgrosch 0:62b846b3988a 250 /*!
tgrosch 0:62b846b3988a 251 * \brief method for calibration session run the first time the board is brought up
tgrosch 0:62b846b3988a 252 * Method is a sequence of steps recommended when the system is powered up for the first time.
tgrosch 0:62b846b3988a 253 * This this is a session, this is a standalone session includes reset of device and initialization
tgrosch 0:62b846b3988a 254 * Details of the steps performed are documented in the detailed section
tgrosch 0:62b846b3988a 255 * \returns Nothing;
tgrosch 0:62b846b3988a 256 */
tgrosch 0:62b846b3988a 257 void calibrationSession_firstTimeBringUp();
tgrosch 0:62b846b3988a 258 /*!
tgrosch 0:62b846b3988a 259 * \brief method for calibration of crosstalk temperature coefficients
tgrosch 0:62b846b3988a 260 * This method is only needed for implementations using TX2 channel on OPT3101.
tgrosch 0:62b846b3988a 261 * It fixes an issue where the device data stream will freeze at a certain amplitude.
tgrosch 0:62b846b3988a 262 * This method is a sequence of steps to scale xtalk down on tx2 channel of the device.
tgrosch 0:62b846b3988a 263 * This is a standalone session, which includes reset of device and initialization
tgrosch 0:62b846b3988a 264 * Details of the steps performed are documented in the detailed section
tgrosch 0:62b846b3988a 265 * \returns Nothing;
tgrosch 0:62b846b3988a 266 */
tgrosch 0:62b846b3988a 267 void calibrationSession_perDesignTx2IllumXtalkCorrection();
tgrosch 0:62b846b3988a 268 /*!
tgrosch 0:62b846b3988a 269 * \brief optional method for compensating high crosstalk levels on a single channel
tgrosch 0:62b846b3988a 270 * This procedure is needed if a single channel has much higher crosstalk than the others and
tgrosch 0:62b846b3988a 271 * allows for an additional compensation step to reduce this crosstalk to a greater degree
tgrosch 0:62b846b3988a 272 * than possible with the crosstalk correction engine on the device.
tgrosch 0:62b846b3988a 273 * Most three channel implementations will require this step if xtalk on tx2 channel is >600 codes.
tgrosch 0:62b846b3988a 274 * This this is a session, this is a standalone session includes reset of device and initialization
tgrosch 0:62b846b3988a 275 * This method also modifies registers without restoring values.
tgrosch 0:62b846b3988a 276 * Make sure to reset the device after running if other methods are to be run after.
tgrosch 0:62b846b3988a 277 * Details of the steps performed are documented in the detailed section
tgrosch 0:62b846b3988a 278 * \returns Nothing;
tgrosch 0:62b846b3988a 279 */
tgrosch 0:62b846b3988a 280 void calibrationSession_perDesignCalibrationCrosstalkTemp();
tgrosch 0:62b846b3988a 281 /*!
tgrosch 0:62b846b3988a 282 * \brief method for calibration of phase temperature coefficients
tgrosch 0:62b846b3988a 283 * This is recommended to be run on a few units per design. Coefficients calculated by this can be used for all the units in production
tgrosch 0:62b846b3988a 284 * Method is a sequence of steps recommended to perform phase temperature coefficients
tgrosch 0:62b846b3988a 285 * This this is a session, this is a standalone session includes reset of device and initialization
tgrosch 0:62b846b3988a 286 * Details of the steps performed are documented in the detailed section
tgrosch 0:62b846b3988a 287 * \returns Nothing;
tgrosch 0:62b846b3988a 288 */
tgrosch 0:62b846b3988a 289 void calibrationSession_perDesignCalibrationPhaseTemp();
tgrosch 0:62b846b3988a 290 /*!
tgrosch 0:62b846b3988a 291 * \brief method for calibration of phase ambient coefficients
tgrosch 0:62b846b3988a 292 * This is recommended to be run on a few units per design. Coefficients calculated by this can be used for all the units in production
tgrosch 0:62b846b3988a 293 * Method is a sequence of steps recommended to perform phase ambient coefficients
tgrosch 0:62b846b3988a 294 * This this is a session, this is a standalone session includes reset of device and initialization
tgrosch 0:62b846b3988a 295 * Details of the steps performed are documented in the detailed section
tgrosch 0:62b846b3988a 296 * \returns Nothing;
tgrosch 0:62b846b3988a 297 */
tgrosch 0:62b846b3988a 298 void calibrationSession_perDesignCalibrationPhaseAmbient();
tgrosch 0:62b846b3988a 299 /*!
tgrosch 0:62b846b3988a 300 * \brief method for calibration of phase ambient coefficients after manually curve fitting
tgrosch 0:62b846b3988a 301 * This is recommended to be run on a few units per design. Coefficients calculated by this can be used for all the units in production
tgrosch 0:62b846b3988a 302 * Method is a expected to be run after a PWL curve fit has been done to the ambient data after running OPT3101::device::calibrationSession_perDesignCalibrationPhaseAmbient and analyzing and curve fitting the data
tgrosch 0:62b846b3988a 303 * This method doesn't do anything to the device except to update the coff and store it to file
tgrosch 0:62b846b3988a 304 * Details of the steps performed are documented in the detailed section
tgrosch 0:62b846b3988a 305 * \returns Nothing;
tgrosch 0:62b846b3988a 306 */
tgrosch 0:62b846b3988a 307 void manuallySetPhaseAmbientCoffs();
tgrosch 0:62b846b3988a 308 /*!
tgrosch 0:62b846b3988a 309 * \brief method for calibration during factory for each unit of the system
tgrosch 0:62b846b3988a 310 * This is recommended to be run on a each and every units through production.
tgrosch 0:62b846b3988a 311 * Method is a sequence of steps recommended to perform all necessary calibration per unit
tgrosch 0:62b846b3988a 312 * This is a session, this is a standalone session includes reset of device and initialization
tgrosch 0:62b846b3988a 313 * Details of the steps performed are documented in the detailed section
tgrosch 0:62b846b3988a 314 * \returns Nothing;
tgrosch 0:62b846b3988a 315 */
tgrosch 0:62b846b3988a 316 void calibrationSession_perUnitFactoryCalibration();
tgrosch 0:62b846b3988a 317
tgrosch 0:62b846b3988a 318 void perUnitFactoryUpdateIllumXtalk();
tgrosch 0:62b846b3988a 319 /*!
tgrosch 0:62b846b3988a 320 * \brief method to store the calibration to EERPOM or some other from on non-volatile memory to be loaded on power-up every time
tgrosch 0:62b846b3988a 321 * This is recommended to be run on a each and every units through production after OPT3101::device::calibrationSession_perUnitFactoryCalibration
tgrosch 0:62b846b3988a 322 * Method is a sequence of steps recommended to store the calibration data to a non-volatile memory for restoration during actual system operation
tgrosch 0:62b846b3988a 323 * In case if the configuration flag OPT3101::device::EEPROM_connected is set to true, this method uses the OPT3101 I2C slave to write data to the connected EEPROM
tgrosch 0:62b846b3988a 324 * This is a session, this is a standalone session includes reset of device and initialization
tgrosch 0:62b846b3988a 325 * Details of the steps performed are documented in the detailed section
tgrosch 0:62b846b3988a 326 * DEBUG_dry_run argument when set to true will print registers to write, but does not actually write to the EEPROM. This is a debug feature.
tgrosch 0:62b846b3988a 327 * \returns Nothing;
tgrosch 0:62b846b3988a 328 */
tgrosch 0:62b846b3988a 329 void calibrationSession_perUnitFactoryCalibrationWriteRegisterDataToNonVolatileMemory(bool DEBUG_dry_run=false);
tgrosch 0:62b846b3988a 330 /*!
tgrosch 0:62b846b3988a 331 * \brief Read from the EEPROM and display contents on the screen
tgrosch 0:62b846b3988a 332 * param[in] format; Chooses which format to display the data
tgrosch 0:62b846b3988a 333 * \returns Nothing;
tgrosch 0:62b846b3988a 334 */
tgrosch 0:62b846b3988a 335 void readAndPrintEEPROMContents(bool rawFormat=false);
tgrosch 0:62b846b3988a 336 // Configuration flags to be set by configurator tool
tgrosch 0:62b846b3988a 337 bool configurationFlags_monoshotMode; ///< Configuration flag to specify if the device is operating in mono shot mode which is set by OPT3101 configurator tool
tgrosch 0:62b846b3988a 338 uint8_t configurationFlags_xtalkFilterTau; ///< Configuration value of crosstalk filter time constant which is set by OPT3101 configurator tool
tgrosch 0:62b846b3988a 339 uint16_t configurationFlags_xtalkSettlingOneTauInMilliSeconds; ///< Configuration value specifying the time constant in milliseconds which is set by OPT3101 configurator tool
tgrosch 0:62b846b3988a 340 uint16_t configurationFlags_xtalkSettlingOneTauInDataReadyCounts; ///< Configuration value specifying the time constant in data ready counts which is set by OPT3101 configurator tool
tgrosch 0:62b846b3988a 341 uint8_t configurationFlags_avgFrameCountExponentOfTwo; ///< Configuration value specifying exponent component of average frame count which is set by OPT3101 configurator tool
tgrosch 0:62b846b3988a 342 uint32_t configurationFlags_frameTimeInMilliSeconds; ///< Configuration value specifying frame time in milli-seconds which is set by OPT3101 configurator tool
tgrosch 0:62b846b3988a 343 bool configurationFlags_isTXChannelActive[3]; ///< Configuration value specifying the active channels set by OPT3101 congifigurator tool
tgrosch 0:62b846b3988a 344 bool configurationFlags_isRegisterSetActive[2]; ///< Configuration value specifying the active register set by OPT3101 congifigurator tool
tgrosch 0:62b846b3988a 345
tgrosch 0:62b846b3988a 346 };
tgrosch 0:62b846b3988a 347 }
tgrosch 0:62b846b3988a 348
tgrosch 0:62b846b3988a 349 #endif /* OPT3101DEVICE_H_ */
tgrosch 0:62b846b3988a 350