17 #ifndef _ADAFRUIT_VCNL4040_H 18 #define _ADAFRUIT_VCNL4040_H 21 #include <Adafruit_BusIO_Register.h> 22 #include <Adafruit_I2CDevice.h> 25 #define VCNL4040_I2CADDR_DEFAULT 0x60 29 #define VCNL4040_ALS_CONFIG \ 31 #define VCNL4040_ALS_THDH 0x01 32 #define VCNL4040_ALS_THDL 0x02 33 #define VCNL4040_PS_CONF1_L \ 35 #define VCNL4040_PS_MS_H 0x04 36 #define VCNL4040_PS_THDL 0x06 37 #define VCNL4040_PS_THDH 0x07 38 #define VCNL4040_PS_DATA 0x08 39 #define VCNL4040_ALS_DATA 0x09 40 #define VCNL4040_WHITE_DATA 0x0A 41 #define VCNL4040_INT_FLAG 0x0B 42 #define VCNL4040_DEVICE_ID 0x0C 50 VCNL4040_LED_CURRENT_50MA,
51 VCNL4040_LED_CURRENT_75MA,
52 VCNL4040_LED_CURRENT_100MA,
53 VCNL4040_LED_CURRENT_120MA,
54 VCNL4040_LED_CURRENT_140MA,
55 VCNL4040_LED_CURRENT_160MA,
56 VCNL4040_LED_CURRENT_180MA,
57 VCNL4040_LED_CURRENT_200MA,
66 VCNL4040_LED_DUTY_1_40,
67 VCNL4040_LED_DUTY_1_80,
68 VCNL4040_LED_DUTY_1_160,
69 VCNL4040_LED_DUTY_1_320,
78 VCNL4040_AMBIENT_INTEGRATION_TIME_80MS,
79 VCNL4040_AMBIENT_INTEGRATION_TIME_160MS,
80 VCNL4040_AMBIENT_INTEGRATION_TIME_320MS,
81 VCNL4040_AMBIENT_INTEGRATION_TIME_640MS,
90 VCNL4040_PROXIMITY_INTEGRATION_TIME_1T,
91 VCNL4040_PROXIMITY_INTEGRATION_TIME_1_5T,
92 VCNL4040_PROXIMITY_INTEGRATION_TIME_2T,
93 VCNL4040_PROXIMITY_INTEGRATION_TIME_2_5T,
94 VCNL4040_PROXIMITY_INTEGRATION_TIME_3T,
95 VCNL4040_PROXIMITY_INTEGRATION_TIME_3_5T,
96 VCNL4040_PROXIMITY_INTEGRATION_TIME_4T,
97 VCNL4040_PROXIMITY_INTEGRATION_TIME_8T,
105 VCNL4040_PROXIMITY_INT_DISABLE,
106 VCNL4040_PROXIMITY_INT_CLOSE,
107 VCNL4040_PROXIMITY_INT_AWAY,
108 VCNL4040_PROXIMITY_INT_CLOSE_AWAY,
117 VCNL4040_PROXIMITY_AWAY,
118 VCNL4040_PROXIMITY_CLOSE,
119 VCNL4040_AMBIENT_HIGH = 4,
120 VCNL4040_AMBIENT_LOW,
131 TwoWire *wire = &Wire);
174 Adafruit_BusIO_Register
182 Adafruit_I2CDevice *i2c_dev;
uint16_t getWhiteLight(void)
Gets the current white light value.
Definition: Adafruit_VCNL4040.cpp:114
uint16_t getLux(void)
Gets the current ambient light sensor in Lux.
Definition: Adafruit_VCNL4040.cpp:131
void setProximityLEDDutyCycle(VCNL4040_LEDDutyCycle duty_cycle)
Sets the duty cycle for the LED used for proximity measurements.
Definition: Adafruit_VCNL4040.cpp:433
Adafruit_VCNL4040()
Instantiates a new VCNL4040 class.
Definition: Adafruit_VCNL4040.cpp:43
enum proximity_type VCNL4040_ProximityType
Proximity interrupt types.
enum led_current VCNL4040_LEDCurrent
Proximity LED current values.
Adafruit_BusIO_Register * PS_CONFIG_12
BusIO Register for PS_CONFIG1 and PS_CONFIG2.
Definition: Adafruit_VCNL4040.h:175
void enableWhiteLight(bool enable)
Enables white light measurements.
Definition: Adafruit_VCNL4040.cpp:172
void setProximityLEDCurrent(VCNL4040_LEDCurrent led_current)
Sets the current for the LED used for proximity measurements.
Definition: Adafruit_VCNL4040.cpp:409
#define VCNL4040_I2CADDR_DEFAULT
VCNL4040 default i2c address.
Definition: Adafruit_VCNL4040.h:25
void enableProximityInterrupts(VCNL4040_ProximityType interrupt_condition)
Disables or enables proximity interrupts under a given condition.
Definition: Adafruit_VCNL4040.cpp:272
VCNL4040_LEDCurrent getProximityLEDCurrent(void)
Gets the current for the LED used for proximity measurements.
Definition: Adafruit_VCNL4040.cpp:398
Adafruit_BusIO_Register * PS_MS
BusIO Register for PS_MS.
Definition: Adafruit_VCNL4040.h:175
void setProximityHighThreshold(uint16_t high_threshold)
Sets the proximity high threshold.
Definition: Adafruit_VCNL4040.cpp:324
void setProximityHighResolution(bool high_resolution)
Sets the resolution of proximity measurements.
Definition: Adafruit_VCNL4040.cpp:459
bool getProximityHighResolution(void)
Gets the resolution of proximity measurements.
Definition: Adafruit_VCNL4040.cpp:447
void setAmbientIntegrationTime(VCNL4040_AmbientIntegration integration_time)
Sets the integration time for ambient light sensing measurements.
Definition: Adafruit_VCNL4040.cpp:379
enum led_duty_cycle VCNL4040_LEDDutyCycle
Proximity LED duty cycle values.
Adafruit_BusIO_Register * ALS_CONFIG
BusIO Register for ALS_CONFIG.
Definition: Adafruit_VCNL4040.h:175
ambient_integration_time
Ambient light integration time values.
Definition: Adafruit_VCNL4040.h:77
enum ambient_integration_time VCNL4040_AmbientIntegration
Ambient light integration time values.
void setAmbientLightLowThreshold(uint16_t low_threshold)
Sets the ambient light low threshold.
Definition: Adafruit_VCNL4040.cpp:255
proximity_type
Proximity interrupt types.
Definition: Adafruit_VCNL4040.h:104
interrupt_type
Interrupt types.
Definition: Adafruit_VCNL4040.h:116
VCNL4040_LEDDutyCycle getProximityLEDDutyCycle(void)
Sets the duty cycle for the LED used for proximity measurements.
Definition: Adafruit_VCNL4040.cpp:421
proximity_integration_time
Proximity measurement integration time values.
Definition: Adafruit_VCNL4040.h:89
enum interrupt_type VCNL4040_InterruptType
Interrupt types.
void enableAmbientLightInterrupts(bool enable)
Enables or disables ambient light based interrupts.
Definition: Adafruit_VCNL4040.cpp:207
uint16_t getProximity(void)
Gets the current proximity sensor value.
Definition: Adafruit_VCNL4040.cpp:90
void enableProximity(bool enable)
Enables or disables proximity measurements.
Definition: Adafruit_VCNL4040.cpp:148
uint16_t getAmbientLight(void)
Gets the current ambient light sensor value.
Definition: Adafruit_VCNL4040.cpp:103
uint16_t getProximityLowThreshold(void)
Gets the proximity low threshold.
Definition: Adafruit_VCNL4040.cpp:286
led_current
Proximity LED current values.
Definition: Adafruit_VCNL4040.h:49
uint16_t getAmbientLightLowThreshold(void)
Gets the ambient light low threshold.
Definition: Adafruit_VCNL4040.cpp:242
uint16_t getProximityHighThreshold(void)
Gets the proximity high threshold.
Definition: Adafruit_VCNL4040.cpp:311
void setAmbientLightHighThreshold(uint16_t high_threshold)
Sets the ambient light high threshold.
Definition: Adafruit_VCNL4040.cpp:231
Class that stores state and functions for interacting with the VCNL4040 I2C Digital Potentiometer...
Definition: Adafruit_VCNL4040.h:127
VCNL4040_ProximityIntegration getProximityIntegrationTime(void)
Gets the integration time for proximity sensing measurements.
Definition: Adafruit_VCNL4040.cpp:339
led_duty_cycle
Proximity LED duty cycle values.
Definition: Adafruit_VCNL4040.h:65
uint16_t getAmbientLightHighThreshold(void)
Gets the current ambient light high threshold.
Definition: Adafruit_VCNL4040.cpp:219
void setProximityLowThreshold(uint16_t low_threshold)
Sets the proximity low threshold.
Definition: Adafruit_VCNL4040.cpp:299
enum proximity_integration_time VCNL4040_ProximityIntegration
Proximity measurement integration time values.
uint8_t getInterruptStatus(void)
Gets and clears the interrupt status register.
Definition: Adafruit_VCNL4040.cpp:189
VCNL4040_AmbientIntegration getAmbientIntegrationTime(void)
Gets the integration time for ambient light sensing measurements.
Definition: Adafruit_VCNL4040.cpp:365
boolean begin(uint8_t i2c_addr=VCNL4040_I2CADDR_DEFAULT, TwoWire *wire=&Wire)
Sets up the hardware and initializes I2C.
Definition: Adafruit_VCNL4040.cpp:53
void enableAmbientLight(bool enable)
Enables ambient light measurements.
Definition: Adafruit_VCNL4040.cpp:160
void setProximityIntegrationTime(VCNL4040_ProximityIntegration integration_time)
Sets the integration time for proximity sensing measurements.
Definition: Adafruit_VCNL4040.cpp:352