Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

otVL6180X Class Reference
[VL6180X - Time-of-Flight ranging sensorVL6180X - Time-of-Flight ranging sensor]

Time-of-Flight ranging sensor.

#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


Member Enumeration Documentation

enum otVL6180X::ErrorCodes
 

Enumeration values:
ERROR_NONE  Success!
ERROR_SYSERR_1  System error.
ERROR_SYSERR_5  Sysem error.
ERROR_ECEFAIL  Early convergence estimate fail.
ERROR_NOCONVERGE  No target detected.
ERROR_RANGEIGNORE  Ignore threshold check failed.
ERROR_SNR  Ambient conditions too high.
ERROR_RAWUFLOW  Raw range algo underflow.
ERROR_RAWOFLOW  Raw range algo overflow.
ERROR_RANGEUFLOW  Raw range algo underflow.
ERROR_RANGEOFLOW  Raw range algo overflow.

enum otVL6180X::Gain
 

Enumeration values:
ALS_GAIN_1  1x gain
ALS_GAIN_1_25  1.25x gain
ALS_GAIN_1_67  1.67x gain
ALS_GAIN_2_5  2.5x gain
ALS_GAIN_5  5x gain
ALS_GAIN_10  10x gain
ALS_GAIN_20  20x gain
ALS_GAIN_40  40x gain


Constructor & Destructor Documentation

otVL6180X.otVL6180X  ) 
 

Create the class.


Member Function Documentation

U8 otVL6180X.getAddress  ) 
 

Gets the address of the device

Returns:
The address

void otVL6180X.getID U8 id_ptr  ) 
 

Get the 7 bytes of id

Parameters:
id_ptr Pointer to array of id bytes

bool otVL6180X.init  ) 
 

Checks that VL6180X is found and resets chip.

Returns:
True if chip found and initialized, False otherwise

bool otVL6180X.isRangeComplete  ) 
 

Check to see if the range command completed.

Returns:
True if range completed.

F32 otVL6180X.readLux U8  gain  ) 
 

Single shot lux measurement

Parameters:
gain Gain setting, one of VL6180X_ALS_GAIN_*
Returns:
Lux reading

U8 otVL6180X.readRange  ) 
 

Single shot ranging. Be sure to check the return of readRangeStatus to before using the return value!

Returns:
Distance in millimeters if valid

U8 otVL6180X.readRangeResult  ) 
 

Return results of read reqyest also clears out the interrupt. Be sure to check the return of readRangeStatus to before using the return value!

Returns:
if range started.

U8 otVL6180X.readRangeStatus  ) 
 

Request ranging success/error message (retreive after ranging)

Returns:
One of possible VL6180X_ERROR_* values

void otVL6180X.setAddress U8  newAddr  ) 
 

Sets the address of the device to a different address

Parameters:
newAddr new I2C address for the device.

void otVL6180X.setOffset U8  offset  ) 
 

Set the offset

Parameters:
offset Offset setting

bool otVL6180X.startRange  ) 
 

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.

Returns:
True if range completed.

void otVL6180X.startRangeContinuous U16  period_ms  ) 
 

Start continuous ranging

Parameters:
period_ms Optional Period between ranges in ms. Values will be rounded down to 10ms units with minimum of 10ms. Default is 50

void otVL6180X.stopRangeContinuous  ) 
 

Stop continuous range operation.

bool otVL6180X.waitRangeComplete  ) 
 

Wait until Range completed

Returns:
True if range completed.


Field Documentation

otVL6180X::ErrorCodes otVL6180X.ErrorCodes
 


The documentation for this class was generated from the following file: footer
otStudio - Library Reference - (C) 2020-23 Officina Turini, All Rights Reserved
Document built with Doxygen 1.4.0