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.
frameData Class Reference
Class the data output from OPT3101 device. More...
#include <OPT3101frameData.h>
Public Member Functions | |
frameData () | |
initializes the members to 0 | |
void | capture (hostController *host, device *dev, bool readTIllulm=true) |
captures measurement data from the device This method invokes I2C transactions to capture data from the OPT3101 device registers 0x08, 0x09 and 0x0A. Extracts and assigns members their respective values based on their positions in the registers. | |
void | report () |
reports members of the instance Print the members of the class instance on screen | |
void | print () |
prints members of the instance Print the members of the class instance on screen | |
void | printHeader () |
prints header Print the members of the class instance on screen | |
void | populateWithMean (frameData *inputData, uint16_t nFrames) |
calculates mean and assigns to self Given a set on input OPT3101::frameData the method calculates the mean frame and assigns to self | |
void | storeToFile (char *fileName) |
saves phase temp coff values to file This methods saves the phase temp 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 temp coff values from file This methods loads the phase temp coff values to a non-volatile memory. Storage/Restoration to/from non-volatile memory is important for factory calibration | |
Data Fields | |
uint32_t | phase |
phase value measured by the AFE. Actually 16 bit unsigned value upscaled to 17 bits with 1 bit of frameData::phaseovl flag added to the MSB. Same as OPT3101::registers::phase_out | |
bool | phaseovl |
phase overload flag, specifying if phase value detected exceeds 16 bits. (greater than 65535). OPT3101::registers::.phase_overflow | |
bool | phaseovlf2 |
phase overload flag for frequency 2, specifying if phase value detected exceeds 16 bits. (greater than 65535). Same as OPT3101::registers::phase_overflow_f2 | |
bool | ambovl |
ambient over load flag which flags if the AFE is saturated due to very high ambient condition. Same as OPT3101::registers::amb_ovl_flag | |
bool | illumDac |
flag that specifies which of the auto-hdr register config from where the measurement is made. Same as OPT3101::registers::hdr_mode | |
uint8_t | ledChannel |
value that specifies from which channel the measurement is made. Same as OPT3101::registers::tx_channel | |
bool | frameStatus |
flag that specifies if the measurement is a valid data. Same as OPT3101::registers::frame_status | |
bool | dealiasFreq |
flag that specifies if the measurement is done with fundamental frequency of de-alias frequency. Same as OPT3101::registers::mod_freq | |
uint8_t | frameCounter |
Frame counter which counts every data ready. Same as combination of OPT3101::register::frame_count0 , OPT3101::registers::frame_count1 and OPT3101::registers::frame_count2. | |
uint16_t | amplitude |
amplitude value measured by AFE. 15 bit representation of the signal. Same as OPT3101::registers::amp_out | |
bool | sigovl |
flag that specifies if the AFE is saturated due to signal. Same as OPT3101::registers::sig_ovl_flag | |
uint8_t | dealiasBin |
value that specifies the de-aliased bin number. Same as OPT3101::registers::dealias_bin | |
uint16_t | ambient |
value specifies the ambient light measured by the ambient cancellation block. Same as OPT3101::registers::amb_data | |
uint16_t | temp |
value of internal temp sensor read from register 0x0A. Same as OPT3101::registers::tmain . This is updated every data ready. | |
uint16_t | tmain |
value of internal temp sensor read from register OPT3101::registers::tmain | |
uint16_t | tillum |
value of external temp sensor read using the I2C Master. Same as OPT3101::registers::tillum | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const frameData *data) |
Operator overload to store class contents to a file Casts all the class members for file storage. | |
std::istream & | operator>> (std::istream &is, frameData *data) |
Operator overload to load class contents to from a file Retreives all the class members from a stored file. |
Detailed Description
Class the data output from OPT3101 device.
This is a class that holds output data from OPT3101 AFE. Measurements by AFE OPT3101 device are stores in registers with address 0x08, x09 & 0x0A. Difference sections of these registers hold different measurements like OPT3101::frameData::phase, OPT3101::frameData::amplitude
This class provides an abstraction where the registers are read, relevant portions of the registers are extracted and assigned to members with meaningful names. This provides a functional abstraction to the user.
Definition at line 57 of file OPT3101frameData.h.
Constructor & Destructor Documentation
frameData | ( | ) |
initializes the members to 0
- Returns:
- Nothing;
Algorithm of the method is as follows
* Initializes all members to 0
Definition at line 564 of file OPT3101device_Functions.cpp.
Member Function Documentation
void capture | ( | hostController * | host, |
OPT3101::device * | dev, | ||
bool | readTIllulm = true |
||
) |
captures measurement data from the device This method invokes I2C transactions to capture data from the OPT3101 device registers 0x08, 0x09 and 0x0A. Extracts and assigns members their respective values based on their positions in the registers.
- Parameters:
-
[in] host; Pointer to the class hostController used to directly invoke I2C transactions bypassing OPT3101::registers or OPT3101::device class [in] dev; Pointer to the class OPT3101::device used to read register(s) from device [in] readTIllulm; Flag which specifies if OPT3101::registers::tillum value needs to be read or not
- Returns:
- Nothing;
Algorithm of the method is as follows
* Sleep host for a specified time depending on device configuration to OPT3101 AFE can update measurements to the registers.
* Performs a direct read of I2C registers 0x08 0x09 and 0x0A directly though hostController::readI2C method
* Maps the I2C read values to the class members like OPT3101::frameData::phase, OPT3101::frameData::amplitude etc
* Based on readIllum flag reads the OPT3101::registers::tillum and assigns to OPT3101::frameData::tillum
Definition at line 587 of file OPT3101device_Functions.cpp.
void loadFromFile | ( | char * | fileName ) |
load phase temp coff values from file This methods loads the phase temp 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 815 of file OPT3101device_Functions.cpp.
void populateWithMean | ( | OPT3101::frameData * | inputData, |
uint16_t | nFrames | ||
) |
calculates mean and assigns to self Given a set on input OPT3101::frameData the method calculates the mean frame and assigns to self
- Parameters:
-
[in] inputData; Pointer to the class OPT3101::frameData instance with multiple frame data [in] nFrames; Number of measurements to step though in the inputData to calculate mean
- Returns:
- Nothing;
Algorithm of the method is as follows
* Sets nFrames to 1 when nFrames is 0
* Finds the smallest 2^N number higher than the nFrames provided in the argument of this method
* Accumulates and measures mean for all the input class instance members and assigns them to the method's class members
* Warning: When nFrames is a non 2^N number the mean results are expected to be lower than actual measurements
Definition at line 680 of file OPT3101device_Functions.cpp.
void print | ( | ) |
prints members of the instance Print the members of the class instance on screen
- Returns:
- Nothing;
Algorithm of the method is as follows
Definition at line 663 of file OPT3101device_Functions.cpp.
void printHeader | ( | ) |
prints header Print the members of the class instance on screen
- Returns:
- Nothing;
Algorithm of the method is as follows
Definition at line 646 of file OPT3101device_Functions.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 622 of file OPT3101device_Functions.cpp.
void storeToFile | ( | char * | fileName ) |
saves phase temp coff values to file This methods saves the phase temp 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 803 of file OPT3101device_Functions.cpp.
Friends And Related Function Documentation
std::ostream& operator<< | ( | std::ostream & | os, |
const frameData * | 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 serlialized and stored
- Returns:
- std::ostream; Serialized std::ostream to be written to a file
std::istream& operator>> | ( | std::istream & | is, |
frameData * | 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
uint16_t ambient |
value specifies the ambient light measured by the ambient cancellation block. Same as OPT3101::registers::amb_data
Definition at line 71 of file OPT3101frameData.h.
bool ambovl |
ambient over load flag which flags if the AFE is saturated due to very high ambient condition. Same as OPT3101::registers::amb_ovl_flag
Definition at line 62 of file OPT3101frameData.h.
uint16_t amplitude |
amplitude value measured by AFE. 15 bit representation of the signal. Same as OPT3101::registers::amp_out
Definition at line 68 of file OPT3101frameData.h.
uint8_t dealiasBin |
value that specifies the de-aliased bin number. Same as OPT3101::registers::dealias_bin
Definition at line 70 of file OPT3101frameData.h.
bool dealiasFreq |
flag that specifies if the measurement is done with fundamental frequency of de-alias frequency. Same as OPT3101::registers::mod_freq
Definition at line 66 of file OPT3101frameData.h.
uint8_t frameCounter |
Frame counter which counts every data ready. Same as combination of OPT3101::register::frame_count0 , OPT3101::registers::frame_count1 and OPT3101::registers::frame_count2.
Definition at line 67 of file OPT3101frameData.h.
bool frameStatus |
flag that specifies if the measurement is a valid data. Same as OPT3101::registers::frame_status
Definition at line 65 of file OPT3101frameData.h.
bool illumDac |
flag that specifies which of the auto-hdr register config from where the measurement is made. Same as OPT3101::registers::hdr_mode
Definition at line 63 of file OPT3101frameData.h.
uint8_t ledChannel |
value that specifies from which channel the measurement is made. Same as OPT3101::registers::tx_channel
Definition at line 64 of file OPT3101frameData.h.
uint32_t phase |
phase value measured by the AFE. Actually 16 bit unsigned value upscaled to 17 bits with 1 bit of frameData::phaseovl flag added to the MSB. Same as OPT3101::registers::phase_out
Definition at line 59 of file OPT3101frameData.h.
bool phaseovl |
phase overload flag, specifying if phase value detected exceeds 16 bits. (greater than 65535). OPT3101::registers::.phase_overflow
Definition at line 60 of file OPT3101frameData.h.
bool phaseovlf2 |
phase overload flag for frequency 2, specifying if phase value detected exceeds 16 bits. (greater than 65535). Same as OPT3101::registers::phase_overflow_f2
Definition at line 61 of file OPT3101frameData.h.
bool sigovl |
flag that specifies if the AFE is saturated due to signal. Same as OPT3101::registers::sig_ovl_flag
Definition at line 69 of file OPT3101frameData.h.
uint16_t temp |
value of internal temp sensor read from register 0x0A. Same as OPT3101::registers::tmain . This is updated every data ready.
Definition at line 72 of file OPT3101frameData.h.
uint16_t tillum |
value of external temp sensor read using the I2C Master. Same as OPT3101::registers::tillum
Definition at line 74 of file OPT3101frameData.h.
uint16_t tmain |
value of internal temp sensor read from register OPT3101::registers::tmain
Definition at line 73 of file OPT3101frameData.h.
Generated on Sun Jul 17 2022 05:22:03 by
