#include <otVL6180X.h>
Public Types | |
enum | Gain { ALS_GAIN_1 = 0x06, ALS_GAIN_1_25 = 0x05, ALS_GAIN_1_67 = 0x04, ALS_GAIN_2_5 = 0x03, ALS_GAIN_5 = 0x02, ALS_GAIN_10 = 0x01, ALS_GAIN_20 = 0x00, ALS_GAIN_40 = 0x07 } |
enum | ErrorCodes { ERROR_NONE = 0, ERROR_SYSERR_1 = 1, ERROR_SYSERR_5 = 5, ERROR_ECEFAIL = 6, ERROR_NOCONVERGE = 7, ERROR_RANGEIGNORE = 8, ERROR_SNR = 11, ERROR_RAWUFLOW = 12, ERROR_RAWOFLOW = 13, ERROR_RANGEUFLOW = 14, ERROR_RANGEOFLOW = 15 } |
Public Member Functions | |
otVL6180X () | |
bool | init () |
void | setAddress (U8 newAddr) |
U8 | getAddress () |
U8 | readRange () |
bool | startRange () |
bool | isRangeComplete () |
bool | waitRangeComplete () |
U8 | readRangeResult () |
void | startRangeContinuous (U16 period_ms) |
void | stopRangeContinuous () |
U8 | readRangeStatus () |
F32 | readLux (U8 gain) |
void | setOffset (U8 offset) |
void | getID (U8 *id_ptr) |
Data Fields | |
otVL6180X::ErrorCodes | ErrorCodes |
|
|
|
|
Create the class. |
|
Gets the address of the device
|
|
Get the 7 bytes of id
|
|
Checks that VL6180X is found and resets chip.
|
|
Check to see if the range command completed.
|
|
Single shot lux measurement
|
|
Single shot ranging. Be sure to check the return of readRangeStatus to before using the return value!
|
|
Return results of read reqyest also clears out the interrupt. Be sure to check the return of readRangeStatus to before using the return value!
|
|
Request ranging success/error message (retreive after ranging)
|
|
Sets the address of the device to a different address
|
|
Set the offset
|
|
Start Single shot ranging. The caller of this should have code that waits until the read completes, by either calling waitRangeComplete or calling isRangeComplete until it returns true. And then the code should call readRangeResult to retrieve the range value and clear out the internal status.
|
|
Start continuous ranging
|
|
Stop continuous range operation. |
|
Wait until Range completed
|
|
|