Ted Grosch / Mbed 2 deprecated Nucleo_TOF_I2C

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

crosstalkC Class Reference

crosstalkC Class Reference

Class that holds crosstalk related registers and values. More...

#include <OPT3101Crosstalk.h>

Public Member Functions

 crosstalkC ()
 Constructor for class OPT3101::crosstalkC Constructor initializes the OPT3101::crosstalkC::illumXtalk parameter to a default false.
double magnitude ()
 calculates magnitude This method calculates the magnitude of crosstalk represented in codes. Typical and good values for internal crosstalk is around 30. Typical and good values for illum crosstalk for highest current (170mA) < 300 codes.
void readCrosstalkRegisters (device *dev)
 reads the device 24 bit crosstalk registers This method reads the 24 bit crosstalk registers OPT3101::registers::iphase_xtalk and OPT3101::registers::qphase_xtalk. Translates them to 16 bit values and captures to OPT3101::crosstalkC::I OPT3101::crosstalkC::Q and OPT3101::crosstalkC::xtalkScale
void readTemperatureMain (device *dev)
 reads the temperature reading from main temp sensor This method reads the main temp sensor register OPT3101Register::tmain and captures to OPT3101::crosstalkC::tmain
void readTemperatureIllum (device *dev)
 reads the temperature reading from external temp sensor This method reads the main temp sensor register OPT3101Register::tillum and captures to OPT3101::crosstalkC::tillum
void storeToFile (char *fileName)
 store crosstalk values to file This methods stores the crosstalk values to a non-volatile memory. Storage to non-volatile memory is important to be able to calculate temperature coefficient OPT3101::crosstalkTempCoffC
void loadFromFile (char *fileName)
 load crosstalk values from file This methods loads the crosstalk values to a non-volatile memory. Storage/Restoration to/from non-volatile memory is important to be able to calculate temperature coefficient OPT3101::crosstalkTempCoffC
void report ()
 reports members of the instance Print the members of the class instance on screen
void print ()
 prints the contents on screen Print the members of the class instance on screen
void printHeader ()
 prints a header Prints a csv header

Data Fields

int16_t I
 16bit register setting for In phase component of the crosstalk
int16_t Q
 16bit register setting for Quadrature phase component of the crosstalk
uint8_t xtalkScale
 Crosstalk registers in OPT3101 device are 24 bit where as compensation registers are 16 bit. The scale parameter captures the scaling of the 24bit register to fit in to 16 bits.
bool illumXtalk
 flag to capture if the crosstalk values belong to internal crosstalk (false) or illum crosstalk (true)
uint8_t illumScale
 Member that captures the snapshot of illumination current multiplier scale register during crosstalk measurement for analysis.
uint8_t illumDac
 Member that captures the snapshot of illumination current setting register during crosstalk measurement for analysis.
uint8_t illumDCdac
 Member that captures the snapshot of illumination DC current setting register during crosstalk measurement for analysis.
uint16_t tmain
 Member that captures the snapshot of temperature of main temp sensor during crosstalk measurement.
uint16_t tillum
 Member that captures the snapshot of temperature of external temp sensor during crosstalk measurement.
uint8_t shiftIllumPhase
 Member that captures the snapshot of shift illum phase during crosstalk measurement.
uint8_t commonScale
 Member that captures the common scale to be applied to all the crosstalk values to be applied OPT3101 device during facotry calibrationC. This value is calculated as a common value based on a bunch of OPT3101::crosstalkC instances.

Friends

std::ostream & operator<< (std::ostream &os, const crosstalkC *data)
 Operator overload to store class contents to a file Casts all the class members for file storage.
std::istream & operator>> (std::istream &is, crosstalkC *data)
 Operator overload to load class contents to from a file Retreives all the class members from a stored file.

Detailed Description

Class that holds crosstalk related registers and values.

This is a class container that can hold crosstalk values. OPT3101 device has different crosstalk phenomenon which needs to be calibrated and compensated
There are primarily 2 types of crosstalk phenomenon that need to be compensated or calibrated out to achieve good system performance.

  1. Internal crosstalk
    1. This is defined as the amount of signal measured by AFE when there the TX channels are turned OFF. Internal crosstalk phenomenon occurs due to coupling from power supply and ground.
    2. This phenomenon is independent of TX channel or configuration since the TX channels are off.
  2. Illum crosstalk
    1. This is defined as the amount of signal measured by AFE when the TX channels are turned ON and the system is pointing to infinity or with photo diode covered.
    2. This phenomenon is highly dependent on TX channel and the current settings on each TX.

OPT3101 device has internal registers to correct and compensate for different crosstalk phenomenon. This class acts as a temporary storage of crosstalk values measured. Calculations have to be made on the crosstalk values to transform them to register settings. Besides that other calibrationC coefficients like OPT3101::crosstalkTempCoffC will be calculated.

Definition at line 67 of file OPT3101Crosstalk.h.


Constructor & Destructor Documentation

crosstalkC (  )

Constructor for class OPT3101::crosstalkC Constructor initializes the OPT3101::crosstalkC::illumXtalk parameter to a default false.

Algorithm of the method is as follows

* sets OPT3101::crosstalkC::illumXtalk to false by default

Definition at line 34 of file OPT3101Crosstalk.cpp.


Member Function Documentation

void loadFromFile ( char *  fileName )

load crosstalk values from file This methods loads the crosstalk values to a non-volatile memory. Storage/Restoration to/from non-volatile memory is important to be able to calculate temperature coefficient OPT3101::crosstalkTempCoffC

Parameters:
[in]fileName;Path and name of the file from where the crosstalk values are loaded
Returns:
Nothing;

Algorithm of the method is as follows

* User needs to implement file load/restore based on host.

Definition at line 103 of file OPT3101Crosstalk.cpp.

double magnitude (  )

calculates magnitude This method calculates the magnitude of crosstalk represented in codes. Typical and good values for internal crosstalk is around 30. Typical and good values for illum crosstalk for highest current (170mA) < 300 codes.

Returns:
magnitude of crosstalk;

Algorithm of the method is as follows

* Calculates the magnitude of crosstalk based on a predefined formula. Warning: This uses floating point arithmetic and math.h library for power and sqrt functions

Definition at line 72 of file OPT3101Crosstalk.cpp.

void print (  )

prints the contents on screen Print the members of the class instance on screen

Returns:
Nothing;

Algorithm of the method is as follows

Definition at line 154 of file OPT3101Crosstalk.cpp.

void printHeader (  )

prints a header Prints a csv header

Returns:
Nothing;

Definition at line 137 of file OPT3101Crosstalk.cpp.

void readCrosstalkRegisters ( OPT3101::device dev )

reads the device 24 bit crosstalk registers This method reads the 24 bit crosstalk registers OPT3101::registers::iphase_xtalk and OPT3101::registers::qphase_xtalk. Translates them to 16 bit values and captures to OPT3101::crosstalkC::I OPT3101::crosstalkC::Q and OPT3101::crosstalkC::xtalkScale

Parameters:
[in]dev;The dev is pointer to class OPT3101::device . This is required to realize I2C transactions and register map
Returns:
Nothing;

Algorithm of the method is as follows

* Reads register OPT3101::registers::iphase_xtalk in 24 bit from and converts to signed number

* Reads register OPT3101::registers::qphase_xtalk in 24 bit from and converts to signed number

* Finds absolute max among the read I and Q register values to determine the OPT3101::crosstalkC::illumXtalk

* Determines OPT3101::crosstalkC::illumXtalk and assigns. The algorithm finds the minimum OPT3101::crosstalkC::illumXtalk value for which the raw I and Q registers can be fit to a 16 bit register

* Scales down the 24 bit raw register I and Q values with OPT3101::crosstalkC::illumXtalk and assigns to OPT3101::crosstalkC::I and OPT3101::crosstalkC::Q

Definition at line 49 of file OPT3101Crosstalk.cpp.

void readTemperatureIllum ( OPT3101::device dev )

reads the temperature reading from external temp sensor This method reads the main temp sensor register OPT3101Register::tillum and captures to OPT3101::crosstalkC::tillum

Parameters:
[in]dev;The dev is pointer to class OPT3101::device . This is required to realize I2C transactions and register map
Returns:
Nothing;

Algorithm of the method is as follows

* Reads register OPT3101Register::illum and assigns to OPT3101::crosstalkC::illum

Definition at line 85 of file OPT3101Crosstalk.cpp.

void readTemperatureMain ( OPT3101::device dev )

reads the temperature reading from main temp sensor This method reads the main temp sensor register OPT3101Register::tmain and captures to OPT3101::crosstalkC::tmain

Parameters:
[in]dev;The dev is pointer to class OPT3101::device . This is required to realize I2C transactions and register map
Returns:
Nothing;

Algorithm of the method is as follows

* Reads register OPT3101Register::tmain and assigns to OPT3101::crosstalkC::tmain

Definition at line 81 of file OPT3101Crosstalk.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.

* User needs to implement file load/restore based on host.

Definition at line 114 of file OPT3101Crosstalk.cpp.

void storeToFile ( char *  fileName )

store crosstalk values to file This methods stores the crosstalk values to a non-volatile memory. Storage to non-volatile memory is important to be able to calculate temperature coefficient OPT3101::crosstalkTempCoffC

Parameters:
[in]fileName;Path and name of the file to capture the crosstalk values to
Returns:
Nothing;

Algorithm of the method is as follows

* User needs to implement file storage based on host.

Definition at line 91 of file OPT3101Crosstalk.cpp.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const crosstalkC 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 serialzied and stored
Returns:
std::ostream; Serialized std::ostream to be written to a file
std::istream& operator>> ( std::istream &  is,
crosstalkC data 
) [friend]

Operator overload to load class contents to from a file Retreives 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

uint8_t commonScale

Member that captures the common scale to be applied to all the crosstalk values to be applied OPT3101 device during facotry calibrationC. This value is calculated as a common value based on a bunch of OPT3101::crosstalkC instances.

Definition at line 79 of file OPT3101Crosstalk.h.

int16_t I

16bit register setting for In phase component of the crosstalk

Definition at line 69 of file OPT3101Crosstalk.h.

uint8_t illumDac

Member that captures the snapshot of illumination current setting register during crosstalk measurement for analysis.

Definition at line 74 of file OPT3101Crosstalk.h.

uint8_t illumDCdac

Member that captures the snapshot of illumination DC current setting register during crosstalk measurement for analysis.

Definition at line 75 of file OPT3101Crosstalk.h.

uint8_t illumScale

Member that captures the snapshot of illumination current multiplier scale register during crosstalk measurement for analysis.

Definition at line 73 of file OPT3101Crosstalk.h.

bool illumXtalk

flag to capture if the crosstalk values belong to internal crosstalk (false) or illum crosstalk (true)

Definition at line 72 of file OPT3101Crosstalk.h.

int16_t Q

16bit register setting for Quadrature phase component of the crosstalk

Definition at line 70 of file OPT3101Crosstalk.h.

uint8_t shiftIllumPhase

Member that captures the snapshot of shift illum phase during crosstalk measurement.

Definition at line 78 of file OPT3101Crosstalk.h.

uint16_t tillum

Member that captures the snapshot of temperature of external temp sensor during crosstalk measurement.

Definition at line 77 of file OPT3101Crosstalk.h.

uint16_t tmain

Member that captures the snapshot of temperature of main temp sensor during crosstalk measurement.

Definition at line 76 of file OPT3101Crosstalk.h.

uint8_t xtalkScale

Crosstalk registers in OPT3101 device are 24 bit where as compensation registers are 16 bit. The scale parameter captures the scaling of the 24bit register to fit in to 16 bits.

Definition at line 71 of file OPT3101Crosstalk.h.