21 #ifndef _ADAFRUIT_VL6180X_H 22 #define _ADAFRUIT_VL6180X_H 25 #include <Adafruit_I2CDevice.h> 27 #define VL6180X_DEFAULT_I2C_ADDR 0x29 29 #define VL6180X_REG_IDENTIFICATION_MODEL_ID 0x000 31 #define VL6180X_REG_SYSTEM_INTERRUPT_CONFIG 0x014 33 #define VL6180X_REG_SYSTEM_INTERRUPT_CLEAR 0x015 35 #define VL6180X_REG_SYSTEM_FRESH_OUT_OF_RESET 0x016 37 #define VL6180X_REG_SYSRANGE_START 0x018 39 #define VL6180X_REG_SYSRANGE_PART_TO_PART_RANGE_OFFSET 0x024 41 #define VL6180X_REG_SYSALS_START 0x038 43 #define VL6180X_REG_SYSALS_ANALOGUE_GAIN 0x03F 45 #define VL6180X_REG_SYSALS_INTEGRATION_PERIOD_HI 0x040 47 #define VL6180X_REG_SYSALS_INTEGRATION_PERIOD_LO 0x041 49 #define VL6180X_REG_RESULT_RANGE_STATUS 0x04d 51 #define VL6180X_REG_RESULT_INTERRUPT_STATUS_GPIO 0x04f 53 #define VL6180X_REG_RESULT_ALS_VAL 0x050 55 #define VL6180X_REG_RESULT_RANGE_VAL 0x062 57 #define VL6180X_REG_SLAVE_DEVICE_ADDRESS 0x212 60 #define VL6180X_ALS_GAIN_1 0x06 61 #define VL6180X_ALS_GAIN_1_25 0x05 62 #define VL6180X_ALS_GAIN_1_67 0x04 63 #define VL6180X_ALS_GAIN_2_5 0x03 64 #define VL6180X_ALS_GAIN_5 0x02 65 #define VL6180X_ALS_GAIN_10 0x01 66 #define VL6180X_ALS_GAIN_20 0x00 67 #define VL6180X_ALS_GAIN_40 0x07 69 #define VL6180X_ERROR_NONE 0 70 #define VL6180X_ERROR_SYSERR_1 1 71 #define VL6180X_ERROR_SYSERR_5 5 72 #define VL6180X_ERROR_ECEFAIL 6 73 #define VL6180X_ERROR_NOCONVERGE 7 74 #define VL6180X_ERROR_RANGEIGNORE 8 75 #define VL6180X_ERROR_SNR 11 76 #define VL6180X_ERROR_RAWUFLOW 12 77 #define VL6180X_ERROR_RAWOFLOW 13 78 #define VL6180X_ERROR_RANGEUFLOW 14 79 #define VL6180X_ERROR_RANGEOFLOW 15 86 boolean begin(TwoWire *theWire = &Wire);
104 void getID(uint8_t *id_ptr);
107 Adafruit_I2CDevice *i2c_dev = NULL;
108 void loadSettings(
void);
110 void write8(uint16_t address, uint8_t data);
111 void write16(uint16_t address, uint16_t data);
113 uint16_t read16(uint16_t address);
114 uint8_t read8(uint16_t address);
uint8_t readRange(void)
Single shot ranging. Be sure to check the return of readRangeStatus to before using the return value!...
Definition: Adafruit_VL6180X.cpp:187
float readLux(uint8_t gain)
Single shot lux measurement.
Definition: Adafruit_VL6180X.cpp:336
void startRangeContinuous(uint16_t period_ms=50)
Start continuous ranging.
Definition: Adafruit_VL6180X.cpp:290
void getID(uint8_t *id_ptr)
Get the 7 bytes of id.
Definition: Adafruit_VL6180X.cpp:418
boolean setAddress(uint8_t newAddr)
Sets the address of the device to a different address. chip.
Definition: Adafruit_VL6180X.cpp:90
uint8_t readRangeStatus(void)
Request ranging success/error message (retreive after ranging)
Definition: Adafruit_VL6180X.cpp:324
boolean waitRangeComplete(void)
Wait until Range completed.
Definition: Adafruit_VL6180X.cpp:253
void setOffset(uint8_t offset)
Set the offset.
Definition: Adafruit_VL6180X.cpp:406
uint8_t readRangeResult(void)
Return results of read reqyest also clears out the interrupt Be sure to check the return of readRange...
Definition: Adafruit_VL6180X.cpp:271
uint8_t getAddress(void)
gets the address of the device chip.
Definition: Adafruit_VL6180X.cpp:110
boolean isRangeComplete(void)
Check to see if the range command completed.
Definition: Adafruit_VL6180X.cpp:237
Adafruit_VL6180X(uint8_t i2caddr=VL6180X_DEFAULT_I2C_ADDR)
Instantiates a new VL6180X class.
Definition: Adafruit_VL6180X.cpp:48
boolean begin(TwoWire *theWire=&Wire)
Initializes I2C interface, checks that VL6180X is found and resets chip.
Definition: Adafruit_VL6180X.cpp:58
! Class for managing connection and state to a VL6180X sensor
Definition: Adafruit_VL6180X.h:82
boolean startRange(void)
start Single shot ranging. The caller of this should have code that waits until the read completes...
Definition: Adafruit_VL6180X.cpp:219
#define VL6180X_DEFAULT_I2C_ADDR
The fixed I2C addres.
Definition: Adafruit_VL6180X.h:27
void stopRangeContinuous(void)
stop continuous range operation.
Definition: Adafruit_VL6180X.cpp:311