Adafruit VEML7700 Lux Sensor Library
Public Member Functions | List of all members
Adafruit_VEML7700 Class Reference

Class that stores state and functions for interacting with VEML7700 Light Sensor. More...

#include <Adafruit_VEML7700.h>

Public Member Functions

 Adafruit_VEML7700 ()
 Instantiates a new VEML7700 class.
 
bool begin (TwoWire *theWire=&Wire)
 Sets up the hardware for talking to the VEML7700. More...
 
void enable (bool enable)
 Enable or disable the sensor. More...
 
bool enabled (void)
 Ask if the interrupt is enabled. More...
 
void interruptEnable (bool enable)
 Enable or disable the interrupt. More...
 
bool interruptEnabled (void)
 Ask if the interrupt is enabled. More...
 
void setPersistence (uint8_t pers)
 Set the ALS IRQ persistance setting. More...
 
uint8_t getPersistence (void)
 Get the ALS IRQ persistance setting. More...
 
void setIntegrationTime (uint8_t it, bool wait=true)
 Set ALS integration time. More...
 
uint8_t getIntegrationTime (void)
 Get ALS integration time setting. More...
 
int getIntegrationTimeValue (void)
 Get ALS integration time value. More...
 
void setGain (uint8_t gain)
 Set ALS gain. More...
 
uint8_t getGain (void)
 Get ALS gain setting. More...
 
float getGainValue (void)
 Get ALS gain value. More...
 
void powerSaveEnable (bool enable)
 Enable power save mode. More...
 
bool powerSaveEnabled (void)
 Check if power save mode is enabled. More...
 
void setPowerSaveMode (uint8_t mode)
 Assign the power save register data. More...
 
uint8_t getPowerSaveMode (void)
 Retrieve the power save register data. More...
 
void setLowThreshold (uint16_t value)
 Assign the low threshold register data. More...
 
uint16_t getLowThreshold (void)
 Retrieve the low threshold register data. More...
 
void setHighThreshold (uint16_t value)
 Assign the high threshold register data. More...
 
uint16_t getHighThreshold (void)
 Retrieve the high threshold register data. More...
 
uint16_t interruptStatus (void)
 Retrieve the interrupt status register data. More...
 
uint16_t readALS (bool wait=false)
 Read the raw ALS data. More...
 
uint16_t readWhite (bool wait=false)
 Read the raw white light data. More...
 
float readLux (luxMethod method=VEML_LUX_NORMAL)
 Read the calibrated lux value. See app note lux table on page 5. More...
 

Detailed Description

Class that stores state and functions for interacting with VEML7700 Light Sensor.

Member Function Documentation

◆ begin()

bool Adafruit_VEML7700::begin ( TwoWire *  theWire = &Wire)

Sets up the hardware for talking to the VEML7700.

Parameters
theWireAn optional pointer to an I2C interface
Returns
True if initialization was successful, otherwise false.

◆ enable()

void Adafruit_VEML7700::enable ( bool  enable)

Enable or disable the sensor.

Parameters
enableThe flag to enable/disable

◆ enabled()

bool Adafruit_VEML7700::enabled ( void  )

Ask if the interrupt is enabled.

Returns
True if enabled, false otherwise

◆ interruptEnable()

void Adafruit_VEML7700::interruptEnable ( bool  enable)

Enable or disable the interrupt.

Parameters
enableThe flag to enable/disable

◆ interruptEnabled()

bool Adafruit_VEML7700::interruptEnabled ( void  )

Ask if the interrupt is enabled.

Returns
True if enabled, false otherwise

◆ setPersistence()

void Adafruit_VEML7700::setPersistence ( uint8_t  pers)

Set the ALS IRQ persistance setting.

Parameters
persPersistance constant, can be VEML7700_PERS_1, VEML7700_PERS_2, VEML7700_PERS_4 or VEML7700_PERS_8

◆ getPersistence()

uint8_t Adafruit_VEML7700::getPersistence ( void  )

Get the ALS IRQ persistance setting.

Returns
Persistance constant, can be VEML7700_PERS_1, VEML7700_PERS_2, VEML7700_PERS_4 or VEML7700_PERS_8

◆ setIntegrationTime()

void Adafruit_VEML7700::setIntegrationTime ( uint8_t  it,
bool  wait = true 
)

Set ALS integration time.

Parameters
itCan be VEML7700_IT_100MS, VEML7700_IT_200MS, VEML7700_IT_400MS, VEML7700_IT_800MS, VEML7700_IT_50MS or VEML7700_IT_25MS
waitWaits to insure old integration time cycle has completed. This is a blocking delay. If disabled by passing false, user code must insure a new reading is not done before old integration cycle completes.

◆ getIntegrationTime()

uint8_t Adafruit_VEML7700::getIntegrationTime ( void  )

Get ALS integration time setting.

Returns
IT index, can be VEML7700_IT_100MS, VEML7700_IT_200MS, VEML7700_IT_400MS, VEML7700_IT_800MS, VEML7700_IT_50MS or VEML7700_IT_25MS

◆ getIntegrationTimeValue()

int Adafruit_VEML7700::getIntegrationTimeValue ( void  )

Get ALS integration time value.

Returns
ALS integration time in milliseconds

◆ setGain()

void Adafruit_VEML7700::setGain ( uint8_t  gain)

Set ALS gain.

Parameters
gainCan be VEML7700_GAIN_1, VEML7700_GAIN_2, VEML7700_GAIN_1_8 or VEML7700_GAIN_1_4

◆ getGain()

uint8_t Adafruit_VEML7700::getGain ( void  )

Get ALS gain setting.

Returns
Gain index, can be VEML7700_GAIN_1, VEML7700_GAIN_2, VEML7700_GAIN_1_8 or VEML7700_GAIN_1_4

◆ getGainValue()

float Adafruit_VEML7700::getGainValue ( void  )

Get ALS gain value.

Returns
Actual gain value as float

◆ powerSaveEnable()

void Adafruit_VEML7700::powerSaveEnable ( bool  enable)

Enable power save mode.

Parameters
enableTrue if power save should be enabled

◆ powerSaveEnabled()

bool Adafruit_VEML7700::powerSaveEnabled ( void  )

Check if power save mode is enabled.

Returns
True if power save is enabled

◆ setPowerSaveMode()

void Adafruit_VEML7700::setPowerSaveMode ( uint8_t  mode)

Assign the power save register data.

Parameters
modeThe 16-bit data to write to VEML7700_ALS_POWER_SAVE

◆ getPowerSaveMode()

uint8_t Adafruit_VEML7700::getPowerSaveMode ( void  )

Retrieve the power save register data.

Returns
16-bit data from VEML7700_ALS_POWER_SAVE

◆ setLowThreshold()

void Adafruit_VEML7700::setLowThreshold ( uint16_t  value)

Assign the low threshold register data.

Parameters
valueThe 16-bit data to write to VEML7700_ALS_THREHOLD_LOW

◆ getLowThreshold()

uint16_t Adafruit_VEML7700::getLowThreshold ( void  )

Retrieve the low threshold register data.

Returns
16-bit data from VEML7700_ALS_THREHOLD_LOW

◆ setHighThreshold()

void Adafruit_VEML7700::setHighThreshold ( uint16_t  value)

Assign the high threshold register data.

Parameters
valueThe 16-bit data to write to VEML7700_ALS_THREHOLD_HIGH

◆ getHighThreshold()

uint16_t Adafruit_VEML7700::getHighThreshold ( void  )

Retrieve the high threshold register data.

Returns
16-bit data from VEML7700_ALS_THREHOLD_HIGH

◆ interruptStatus()

uint16_t Adafruit_VEML7700::interruptStatus ( void  )

Retrieve the interrupt status register data.

Returns
16-bit data from VEML7700_INTERRUPTSTATUS

◆ readALS()

uint16_t Adafruit_VEML7700::readALS ( bool  wait = false)

Read the raw ALS data.

Parameters
waitIf false (default), read out measurement with no delay. If true, wait as need based on integration time before reading out measurement results.
Returns
16-bit data value from the ALS register

◆ readWhite()

uint16_t Adafruit_VEML7700::readWhite ( bool  wait = false)

Read the raw white light data.

Parameters
waitIf false (default), read out measurement with no delay. If true, wait as need based on integration time before reading out measurement results.
Returns
16-bit data value from the WHITE register

◆ readLux()

float Adafruit_VEML7700::readLux ( luxMethod  method = VEML_LUX_NORMAL)

Read the calibrated lux value. See app note lux table on page 5.

Parameters
methodLux comptation method to use. One of
Returns
Floating point Lux data

The documentation for this class was generated from the following files: