Adafruit VEML7700 Arduino Library
Go to the documentation of this file.
17 #ifndef _ADAFRUIT_VEML7700_H
18 #define _ADAFRUIT_VEML7700_H
20 #include "Arduino.h"
21 #include <Wire.h>
22 #include <Adafruit_I2CDevice.h>
23 #include <Adafruit_I2CRegister.h>
25 #define VEML7700_I2CADDR_DEFAULT 0x10
27 #define VEML7700_ALS_CONFIG 0x00
28 #define VEML7700_ALS_THREHOLD_HIGH 0x01
29 #define VEML7700_ALS_THREHOLD_LOW 0x02
30 #define VEML7700_ALS_POWER_SAVE 0x03
31 #define VEML7700_ALS_DATA 0x04
32 #define VEML7700_WHITE_DATA 0x05
33 #define VEML7700_INTERRUPTSTATUS 0x06
35 #define VEML7700_INTERRUPT_HIGH 0x4000
36 #define VEML7700_INTERRUPT_LOW 0x8000
38 #define VEML7700_GAIN_1 0x00
39 #define VEML7700_GAIN_2 0x01
40 #define VEML7700_GAIN_1_8 0x02
41 #define VEML7700_GAIN_1_4 0x03
43 #define VEML7700_IT_100MS 0x00
44 #define VEML7700_IT_200MS 0x01
45 #define VEML7700_IT_400MS 0x02
46 #define VEML7700_IT_800MS 0x03
47 #define VEML7700_IT_50MS 0x08
48 #define VEML7700_IT_25MS 0x0C
50 #define VEML7700_PERS_1 0x00
51 #define VEML7700_PERS_2 0x01
52 #define VEML7700_PERS_4 0x02
53 #define VEML7700_PERS_8 0x03
55 #define VEML7700_POWERSAVE_MODE1 0x00
56 #define VEML7700_POWERSAVE_MODE2 0x01
57 #define VEML7700_POWERSAVE_MODE3 0x02
58 #define VEML7700_POWERSAVE_MODE4 0x03
66 public:
68  boolean begin(TwoWire *theWire = &Wire);
70  void enable(bool enable);
71  bool enabled(void);
73  void interruptEnable(bool enable);
74  bool interruptEnabled(void);
75  void setPersistence(uint8_t pers);
76  uint8_t getPersistence(void);
77  void setIntegrationTime(uint8_t it);
78  uint8_t getIntegrationTime(void);
79  void setGain(uint8_t gain);
80  uint8_t getGain(void);
81  void powerSaveEnable(bool enable);
82  bool powerSaveEnabled(void);
83  void setPowerSaveMode(uint8_t mode);
84  uint8_t getPowerSaveMode(void);
86  void setLowThreshold(uint16_t value);
87  uint16_t getLowThreshold(void);
88  void setHighThreshold(uint16_t value);
89  uint16_t getHighThreshold(void);
90  uint16_t interruptStatus(void);
93  float readLux();
94  float readLuxNormalized();
96  uint16_t readALS();
97  float readWhite();
98  float readWhiteNormalized();
100 private:
101  Adafruit_I2CRegister *ALS_Config, *ALS_Data, *White_Data,
102  *ALS_HighThreshold, *ALS_LowThreshold, *Power_Saving, *Interrupt_Status;
103  Adafruit_I2CRegisterBits *ALS_Shutdown, *ALS_Interrupt_Enable,
104  *ALS_Persistence, *ALS_Integration_Time, *ALS_Gain,
105  *PowerSave_Enable, *PowerSave_Mode;
107  float normalize_resolution(float value);
109  Adafruit_I2CDevice *i2c_dev;
111 };
113 #endif
bool enabled(void)
Ask if the interrupt is enabled.
Definition: Adafruit_VEML7700.cpp:177
Class that stores state and functions for interacting with VEML7700 Temp Sensor.
Definition: Adafruit_VEML7700.h:65
uint8_t getGain(void)
Get ALS gain.
Definition: Adafruit_VEML7700.cpp:247
boolean begin(TwoWire *theWire=&Wire)
Setups the hardware for talking to the VEML7700.
Definition: Adafruit_VEML7700.cpp:45
float readWhite()
Read the white light data.
Definition: Adafruit_VEML7700.cpp:144
void setGain(uint8_t gain)
Set ALS gain.
Definition: Adafruit_VEML7700.cpp:239
void setPowerSaveMode(uint8_t mode)
Assign the power save register data.
Definition: Adafruit_VEML7700.cpp:272
bool interruptEnabled(void)
Ask if the interrupt is enabled.
Definition: Adafruit_VEML7700.cpp:194
void setIntegrationTime(uint8_t it)
Set ALS integration time.
Definition: Adafruit_VEML7700.cpp:222
void setPersistence(uint8_t pers)
Set the ALS IRQ persistance setting.
Definition: Adafruit_VEML7700.cpp:204
Instantiates a new VEML7700 class.
Definition: Adafruit_VEML7700.cpp:38
float readLux()
Read the calibrated lux value. See app note lux table on page 5.
Definition: Adafruit_VEML7700.cpp:112
uint8_t getPersistence(void)
Get the ALS IRQ persistance setting.
Definition: Adafruit_VEML7700.cpp:213
uint8_t getPowerSaveMode(void)
Retrieve the power save register data.
Definition: Adafruit_VEML7700.cpp:280
void enable(bool enable)
Enable or disable the sensor.
Definition: Adafruit_VEML7700.cpp:169
uint16_t readALS()
Read the raw ALS data.
Definition: Adafruit_VEML7700.cpp:136
float readWhiteNormalized()
Read the &#39;white light&#39; value with correction for non-linearity at high-lux settings.
Definition: Adafruit_VEML7700.cpp:153
void powerSaveEnable(bool enable)
Enable power save mode.
Definition: Adafruit_VEML7700.cpp:256
uint8_t getIntegrationTime(void)
Get ALS integration time.
Definition: Adafruit_VEML7700.cpp:231
uint16_t interruptStatus(void)
Retrieve the interrupt status register data.
Definition: Adafruit_VEML7700.cpp:320
void setHighThreshold(uint16_t value)
Assign the high threshold register data.
Definition: Adafruit_VEML7700.cpp:304
float readLuxNormalized()
Read the lux value with correction for non-linearity at high-lux settings.
Definition: Adafruit_VEML7700.cpp:120
void setLowThreshold(uint16_t value)
Assign the low threshold register data.
Definition: Adafruit_VEML7700.cpp:288
uint16_t getHighThreshold(void)
Retrieve the high threshold register data.
Definition: Adafruit_VEML7700.cpp:312
void interruptEnable(bool enable)
Enable or disable the interrupt.
Definition: Adafruit_VEML7700.cpp:185
uint16_t getLowThreshold(void)
Retrieve the low threshold register data.
Definition: Adafruit_VEML7700.cpp:296
bool powerSaveEnabled(void)
Check if power save mode is enabled.
Definition: Adafruit_VEML7700.cpp:264