Adafruit VCNL4040 Arduino Library
|
Class that stores state and functions for interacting with the VCNL4040 I2C Digital Potentiometer. More...
#include <Adafruit_VCNL4040.h>
Public Member Functions | |
Adafruit_VCNL4040 () | |
Instantiates a new VCNL4040 class. | |
boolean | begin (uint8_t i2c_addr=VCNL4040_I2CADDR_DEFAULT, TwoWire *wire=&Wire) |
Sets up the hardware and initializes I2C. More... | |
uint16_t | getProximity (void) |
Gets the current proximity sensor value. More... | |
uint16_t | getAmbientLight (void) |
Gets the current ambient light sensor value. More... | |
uint16_t | getWhiteLight (void) |
Gets the current white light value. More... | |
uint16_t | getLux (void) |
Gets the current ambient light sensor in Lux. More... | |
void | enableProximity (bool enable) |
Enables or disables proximity measurements. More... | |
void | enableAmbientLight (bool enable) |
Enables ambient light measurements. More... | |
void | enableWhiteLight (bool enable) |
Enables white light measurements. More... | |
uint8_t | getInterruptStatus (void) |
Gets and clears the interrupt status register. More... | |
void | enableAmbientLightInterrupts (bool enable) |
Enables or disables ambient light based interrupts. More... | |
uint16_t | getAmbientLightHighThreshold (void) |
Gets the current ambient light high threshold. More... | |
void | setAmbientLightHighThreshold (uint16_t high_threshold) |
Sets the ambient light high threshold. More... | |
uint16_t | getAmbientLightLowThreshold (void) |
Gets the ambient light low threshold. More... | |
void | setAmbientLightLowThreshold (uint16_t low_threshold) |
Sets the ambient light low threshold. More... | |
void | enableProximityInterrupts (VCNL4040_ProximityType interrupt_condition) |
Disables or enables proximity interrupts under a given condition. More... | |
uint16_t | getProximityLowThreshold (void) |
Gets the proximity low threshold. More... | |
void | setProximityLowThreshold (uint16_t low_threshold) |
Sets the proximity low threshold. More... | |
uint16_t | getProximityHighThreshold (void) |
Gets the proximity high threshold. More... | |
void | setProximityHighThreshold (uint16_t high_threshold) |
Sets the proximity high threshold. More... | |
VCNL4040_ProximityIntegration | getProximityIntegrationTime (void) |
Gets the integration time for proximity sensing measurements. More... | |
void | setProximityIntegrationTime (VCNL4040_ProximityIntegration integration_time) |
Sets the integration time for proximity sensing measurements. More... | |
VCNL4040_AmbientIntegration | getAmbientIntegrationTime (void) |
Gets the integration time for ambient light sensing measurements. More... | |
void | setAmbientIntegrationTime (VCNL4040_AmbientIntegration integration_time) |
Sets the integration time for ambient light sensing measurements. More... | |
VCNL4040_LEDCurrent | getProximityLEDCurrent (void) |
Gets the current for the LED used for proximity measurements. More... | |
void | setProximityLEDCurrent (VCNL4040_LEDCurrent led_current) |
Sets the current for the LED used for proximity measurements. More... | |
VCNL4040_LEDDutyCycle | getProximityLEDDutyCycle (void) |
Sets the duty cycle for the LED used for proximity measurements. More... | |
void | setProximityLEDDutyCycle (VCNL4040_LEDDutyCycle duty_cycle) |
Sets the duty cycle for the LED used for proximity measurements. More... | |
bool | getProximityHighResolution (void) |
Gets the resolution of proximity measurements. More... | |
void | setProximityHighResolution (bool high_resolution) |
Sets the resolution of proximity measurements. More... | |
Public Attributes | |
Adafruit_BusIO_Register * | PS_CONFIG_12 |
BusIO Register for PS_CONFIG1 and PS_CONFIG2. | |
Adafruit_BusIO_Register * | ALS_CONFIG |
BusIO Register for ALS_CONFIG. | |
Adafruit_BusIO_Register * | PS_MS |
BusIO Register for PS_MS. | |
Class that stores state and functions for interacting with the VCNL4040 I2C Digital Potentiometer.
boolean Adafruit_VCNL4040::begin | ( | uint8_t | i2c_address = VCNL4040_I2CADDR_DEFAULT , |
TwoWire * | wire = &Wire |
||
) |
Sets up the hardware and initializes I2C.
i2c_address | The I2C address to be used. |
wire | The Wire object to be used for I2C connections. |
uint16_t Adafruit_VCNL4040::getProximity | ( | void | ) |
Gets the current proximity sensor value.
uint16_t Adafruit_VCNL4040::getAmbientLight | ( | void | ) |
Gets the current ambient light sensor value.
uint16_t Adafruit_VCNL4040::getWhiteLight | ( | void | ) |
Gets the current white light value.
uint16_t Adafruit_VCNL4040::getLux | ( | void | ) |
Gets the current ambient light sensor in Lux.
void Adafruit_VCNL4040::enableProximity | ( | bool | enable | ) |
Enables or disables proximity measurements.
enable | Set to true to enable proximity measurements, set to false to disable. |
void Adafruit_VCNL4040::enableAmbientLight | ( | bool | enable | ) |
Enables ambient light measurements.
enable | Set to true to enable ambient light measurements, set to false to disable. |
void Adafruit_VCNL4040::enableWhiteLight | ( | bool | enable | ) |
Enables white light measurements.
enable | Set to true to enable white light measurements, set to false to disable. |
uint8_t Adafruit_VCNL4040::getInterruptStatus | ( | void | ) |
Gets and clears the interrupt status register.
VCNL4040_InterruptType
:VCNL4040_PROXIMITY_AWAY
, VCNL4040_PROXIMITY_CLOSE
, PROXIMITY_LOW
, or PROXIMITY_HIGH
void Adafruit_VCNL4040::enableAmbientLightInterrupts | ( | bool | enable | ) |
Enables or disables ambient light based interrupts.
enable | Set to true to enable or false to disable ambient light interrupts |
uint16_t Adafruit_VCNL4040::getAmbientLightHighThreshold | ( | void | ) |
Gets the current ambient light high threshold.
void Adafruit_VCNL4040::setAmbientLightHighThreshold | ( | uint16_t | high_threshold | ) |
Sets the ambient light high threshold.
high_threshold | The high threshold to set |
uint16_t Adafruit_VCNL4040::getAmbientLightLowThreshold | ( | void | ) |
Gets the ambient light low threshold.
void Adafruit_VCNL4040::setAmbientLightLowThreshold | ( | uint16_t | low_threshold | ) |
Sets the ambient light low threshold.
low_threshold | The low threshold to set |
void Adafruit_VCNL4040::enableProximityInterrupts | ( | VCNL4040_ProximityType | interrupt_condition | ) |
Disables or enables proximity interrupts under a given condition.
interrupt_condition | The condition under which to raise an interrupt. Must be a VCNL4040_ProximityType . Use VCNL4040_PROXIMITY_INT_DISABLE to disable proximity interrupts. |
uint16_t Adafruit_VCNL4040::getProximityLowThreshold | ( | void | ) |
Gets the proximity low threshold.
void Adafruit_VCNL4040::setProximityLowThreshold | ( | uint16_t | low_threshold | ) |
Sets the proximity low threshold.
low_threshold | The low threshold to set |
uint16_t Adafruit_VCNL4040::getProximityHighThreshold | ( | void | ) |
Gets the proximity high threshold.
void Adafruit_VCNL4040::setProximityHighThreshold | ( | uint16_t | high_threshold | ) |
Sets the proximity high threshold.
high_threshold | The high threshold to set |
VCNL4040_ProximityIntegration Adafruit_VCNL4040::getProximityIntegrationTime | ( | void | ) |
Gets the integration time for proximity sensing measurements.
void Adafruit_VCNL4040::setProximityIntegrationTime | ( | VCNL4040_ProximityIntegration | integration_time | ) |
Sets the integration time for proximity sensing measurements.
integration_time | The integration time to use for proximity measurements. Must be a VCNL4040_ProximityIntegration . |
VCNL4040_AmbientIntegration Adafruit_VCNL4040::getAmbientIntegrationTime | ( | void | ) |
Gets the integration time for ambient light sensing measurements.
void Adafruit_VCNL4040::setAmbientIntegrationTime | ( | VCNL4040_AmbientIntegration | integration_time | ) |
Sets the integration time for ambient light sensing measurements.
integration_time | The integration time to use for ambient light measurements. Must be a VCNL4040_AmbientIntegration . |
VCNL4040_LEDCurrent Adafruit_VCNL4040::getProximityLEDCurrent | ( | void | ) |
Gets the current for the LED used for proximity measurements.
void Adafruit_VCNL4040::setProximityLEDCurrent | ( | VCNL4040_LEDCurrent | led_current | ) |
Sets the current for the LED used for proximity measurements.
led_current | The current value to be used for proximity measurements. Must be a VCNL4040_LEDCurrent . |
VCNL4040_LEDDutyCycle Adafruit_VCNL4040::getProximityLEDDutyCycle | ( | void | ) |
Sets the duty cycle for the LED used for proximity measurements.
void Adafruit_VCNL4040::setProximityLEDDutyCycle | ( | VCNL4040_LEDDutyCycle | duty_cycle | ) |
Sets the duty cycle for the LED used for proximity measurements.
duty_cycle | The duty cycle value to be used for proximity measurements. Must be a VCNL4040_LEDDutyCycle . |
bool Adafruit_VCNL4040::getProximityHighResolution | ( | void | ) |
Gets the resolution of proximity measurements.
void Adafruit_VCNL4040::setProximityHighResolution | ( | bool | high_resolution | ) |
Sets the resolution of proximity measurements.
high_resolution | Set to true to take 16-bit measurements for proximity, set to faluse to use 12-bit measurements. |