Posted on behalf of:
"Hi , Do we have OPT3001 C++ code other than written for linux? Please let me know"
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Posted on behalf of:
"Hi , Do we have OPT3001 C++ code other than written for linux? Please let me know"
Hi,
We do not have any official example C++ code for a non-linux C++ development environment. Is there a particular platform you are looking to code on?
Regards,
Hi,
we are using windows based IAR workbench for Cortex 5 core.
I am think to use " Transparent Hysteresis-Style Comparison Mode " in continuous conversion mode. Since I am not using the interrupt pin of OPT3001.
Here I am not getting how to handle the error. so can you please help me on this issue?
Driver logic:
Note: we are not using the INT Pin of OPT3001
1. Init the I2C
2. Driver have option to set the 100ms or 800ms conversion, with auto range setting with continuous conversion
3. using "Transparent Hysteresis-Style Comparison Mode" for reading
4. Poll the result register once get the message from the light sensor service in message queue
5. Check for coversion complete ? if not wait for 110 ms for 100ms mode and 880ms for 800ms mode.
6. if not getting the result then return the error or return the result
Problem: Datasheet have following description,
If the result register is higher than the high-limit register for a consecutive number of events set by the fault count field, the INT line is set to
active, the flag high field is set to 1, and the flag low field is set to 0. If the result register is lower than the lowlimit register for a consecutive number of events set by the fault count field, the INT line is set to inactive, the flag low field is set to 1, and the flag high field is set to 0. The INT pin and flag high and flag low fields do not change state with configuration reads and writes. The INT pin and flag fields continually report the appropriate comparison of the light to the low-limit and high-limit registers. The device does not respond to the SMBus alert response protocol while in either of the two transparent comparison modes (configuration register, latch field =0). The behavior of this mode, along with the conversion ready is summarized in Table 4. Note that Table 4 does not apply when the two threshold low register MSBs (LE[3:2] from Table 12) are set to 11.
Question :
1.If result register value is less or higher than Low limit register or high limit register then respective flags are set but after reading configuration register they are not reset in " Transparent Hysteresis-Style Comparison Mode " . so my question is how we can get the correct value from the result register and how we can handle this case.
2. Is my driver logic is correct?
3. If you have sample firmware then please let me know.
Hi Prashant,
Can you send me a test mail at mahendra.patel@ti.com
I will get in touch with you for further discussion.
Thanks and Regards,
Mahendra Patel, TI Pune.
Hi,
Do we have example C code for a non-linux C development environment?
Thanks.
Johnny