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.
phaseAmbientCoffC Class Reference
Class that holds ambient phase coefficient related registers and values. More...
#include <OPT3101DesignCoefficients.h>
Public Member Functions | |
phaseAmbientCoffC () | |
initializes the members to 0 | |
void | calculateCoff (uint16_t freqCounter) |
Calculates the register settings for the phase ambient coefficient Calculates OPT3101::phaseAmbientCoffC::coffReg and OPT3101::phaseAmbientCoffC::commonScale based on OPT3101::phaseAmbientCoffC::coff. | |
void | report () |
reports members of the instance Print the members of the class instance on screen | |
void | storeToFile (char *fileName) |
saves phase ambient coff values to file This methods saves the phase ambient coff values to a non-volatile memory. Storage/Restoration to/from non-volatile memory is important for factory calibration | |
void | loadFromFile (char *fileName) |
load phase ambient coff values from file This methods loads the phase ambient coff values to a non-volatile memory. Storage/Restoration to/from non-volatile memory is important for factory calibration | |
Data Fields | |
double | coff [4] |
Coefficients stored in floating point precision. Since there are 4 sections the OPT3101::phaseAmbientCoffC::coff is array of 4 elements. Units for this is OPT3101::frameData::phase codes per unit OPT3101::frameData::ambient codes. | |
uint8_t | coffReg [4] |
Coefficients value of OPT3101::phaseAmbientCoffC::coff represented as 8 bit register values calculated by OPT3101::phaseAmbientCoffC::calculateCoff. | |
uint16_t | splitsReg [3] |
Register entries for the split point for the PWL. Since there are 4 sections where are 3 split points to be set. Units for this is OPT3101::frameData::ambient codes. | |
uint8_t | commonScale |
Since there are 4 OPT3101::phaseAmbientCoffC::coff to represent them as 8 bit register values a common scaling factor is required. This is calculated by method OPT3101::phaseAmbientCoffC::calculateCoff. | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const phaseAmbientCoffC *data) |
Operator overload to store class contents to a file Casts all the class members for file storage. | |
std::istream & | operator>> (std::istream &is, phaseAmbientCoffC *data) |
Operator overload to load class contents to from a file Retrieves all the class members from a stored file. |
Detailed Description
Class that holds ambient phase coefficient related registers and values.
This is a class container that can hold phase offset ambient coefficients and related registers. Photo diodes has a phenomenon where the phase delay of modulated current generated by photo diode is dependent on the amount of ambient light falling on the photo diode. The effect observed on the system is that the phase reported by the system will be dependent on the amount of ambient light of the environment.
OPT3101 has compensation block for the same, which needs coefficients to be programmed. OPT3101 has a look up table based correction since the phenomenon in non-linear. The look-up table is a 4 way split PWL correction with 4 independent coefficients. The PWL correlation is between ambient ADC output and phase measured
This class has members to contain the coefficients and the split points.
Definition at line 203 of file OPT3101DesignCoefficients.h.
Constructor & Destructor Documentation
initializes the members to 0
- Returns:
- Nothing;
Algorithm of the method is as follows
* Serializes all the members and returns to the stream
Definition at line 236 of file OPT3101DesignCoefficients.cpp.
Member Function Documentation
void calculateCoff | ( | uint16_t | freqCounter ) |
Calculates the register settings for the phase ambient coefficient Calculates OPT3101::phaseAmbientCoffC::coffReg and OPT3101::phaseAmbientCoffC::commonScale based on OPT3101::phaseAmbientCoffC::coff.
- Parameters:
-
[in] freqCounter; freqCounter is the count which represents the frequency from the Frequency correction block. This is read from register OPT3101::registers::freq_count_read_reg
- Returns:
- Nothing;
Algorithm of the method is as follows
* Identifies max of absolute of OPT3101::phaseAmbientCoffC::coff values
* scales the max coefficient with input frequencyCount
* Finds a OPT3101::phaseAmbientCoffC::commonScale which can fit the OPT3101::phaseAmbientCoffC::coff to 8 bit registers
* Finds OPT3101::phaseAmbientCoffC::coffReg values (8 bit register values) based on OPT3101::phaseAmbientCoffC::coff and OPT3101::phaseAmbientCoffC::commonScale
Definition at line 249 of file OPT3101DesignCoefficients.cpp.
void loadFromFile | ( | char * | fileName ) |
load phase ambient coff values from file This methods loads the phase ambient coff values to a non-volatile memory. Storage/Restoration to/from non-volatile memory is important for factory calibration
- Parameters:
-
[in] fileName; Path and name of the file from where to load
- Returns:
- Nothing;
Algorithm of the method is as follows
* User needs to implement file load/restore based on host.
Definition at line 301 of file OPT3101DesignCoefficients.cpp.
void report | ( | ) |
reports members of the instance Print the members of the class instance on screen
- Returns:
- Nothing;
Algorithm of the method is as follows
* Prints all the members and values of members on screen.
* Prints all the members and values of members on screen.
Definition at line 269 of file OPT3101DesignCoefficients.cpp.
void storeToFile | ( | char * | fileName ) |
saves phase ambient coff values to file This methods saves the phase ambient coff values to a non-volatile memory. Storage/Restoration to/from non-volatile memory is important for factory calibration
- Parameters:
-
[in] fileName; Path and name of the file to store
- Returns:
- Nothing;
Algorithm of the method is as follows
* User needs to implement file storage based on host.
Definition at line 289 of file OPT3101DesignCoefficients.cpp.
Friends And Related Function Documentation
std::ostream& operator<< | ( | std::ostream & | os, |
const phaseAmbientCoffC * | data | ||
) | [friend] |
Operator overload to store class contents to a file Casts all the class members for file storage.
- Parameters:
-
[out] os; os is data stream to serialize data [in] data; data is pointer to the class to be serialized and stored
- Returns:
- std::ostream; Serialized std::ostream to be written to a file
std::istream& operator>> | ( | std::istream & | is, |
phaseAmbientCoffC * | data | ||
) | [friend] |
Operator overload to load class contents to from a file Retrieves all the class members from a stored file.
- Parameters:
-
[in] is; is input stream from where the data is loaded [out] data; data is pointer to the class to be restored
- Returns:
- std::istream; Serialized Input stream loaded from file
Field Documentation
double coff[4] |
Coefficients stored in floating point precision. Since there are 4 sections the OPT3101::phaseAmbientCoffC::coff is array of 4 elements. Units for this is OPT3101::frameData::phase codes per unit OPT3101::frameData::ambient codes.
Definition at line 205 of file OPT3101DesignCoefficients.h.
uint8_t coffReg[4] |
Coefficients value of OPT3101::phaseAmbientCoffC::coff represented as 8 bit register values calculated by OPT3101::phaseAmbientCoffC::calculateCoff.
Definition at line 206 of file OPT3101DesignCoefficients.h.
uint8_t commonScale |
Since there are 4 OPT3101::phaseAmbientCoffC::coff to represent them as 8 bit register values a common scaling factor is required. This is calculated by method OPT3101::phaseAmbientCoffC::calculateCoff.
Definition at line 208 of file OPT3101DesignCoefficients.h.
uint16_t splitsReg[3] |
Register entries for the split point for the PWL. Since there are 4 sections where are 3 split points to be set. Units for this is OPT3101::frameData::ambient codes.
Definition at line 207 of file OPT3101DesignCoefficients.h.
Generated on Sun Jul 17 2022 05:22:03 by
