A Vishay library for devices VEML6040 R+G+B+W and VEML6075 UVA+UVB optical sensors. Data is stored in a dedicated data structure.

Dependents:   vmel60xx_hello_world

This device library is for use with the Vishay VEML6040 and VEML6075 optical sensors. Ambient light conditions are gathered and stored in a user accessible data structure veml60xx_struct. The library has enough intelligence to determine which device is connected and performs the appropriate functions.

The VEML6040 detects Red, Green, Blue and White light data, which is easily converted to relative Lux intensities.

The VEML6075 detects UVA and UVB light which is converted to a UV Index value.

Since both devices use the same I2C address, they cannot be on the same I2C bus at the same time.

Tested on a K64F

Revision:
4:0ce65ee5697f
Parent:
3:dda770fa7228
--- a/veml60xx.h	Wed Apr 27 22:24:37 2016 +0000
+++ b/veml60xx.h	Fri Apr 29 16:40:06 2016 +0000
@@ -8,10 +8,10 @@
 *
 * The code has all of the hooks for gathering raw data from the VEML60xx chip and performs the necessary compensation 
 * in order to get the corrected output readings.  There is also an optional automatic scaling routine that 
-* modifies the dwell time (IT bits in the CONF register), should the raw register reading saturate (65535) or
+* modifies the integration time (IT bits in the CONF register), should the raw register reading saturate (65535) or
 * are too small (< 255).  Adjustments are made + or - one IT count, each time the routine is called.  If the light
 * striking the sensor changes dramatically, you may have to run the automatic scaling routine a few times.  After 
-* each change in dwell time (changing of IT bits), you must wait a maximum of 2 * 1280mSec before taking a new 
+* each change in integration time (changing of IT bits), you must wait a maximum of 2 * 1280mSec before taking a new 
 * reading in order to get accurate results.
 *
 * NOTE: Both the VEML6040 and the VEML6075 have the same I2C address.  You cannot have both devices on the same I2C 
@@ -23,7 +23,7 @@
 *       the "is6040" flag in the "veml60xx_struct" data structure.
 *
 * NOTE: It is not yet known when using startAccess(), whether or not that TRIG bit clear immediately or after the
-*       dwell time has finished.  As a result, you should not depend on TRIG bit for polling.
+*       integration time has finished.  As a result, you should not depend on TRIG bit for polling.
 *
 **/
 
@@ -74,7 +74,7 @@
 #define VEML6075_DEVICE_ID                  0x0026  //expected device ID
 
 // VEML6040-only ID contents
-#define VEML6040_DEVICE_ID                  0x0123  //expected device ID
+#define VEML6040_DEVICE_ID                  0x0023  //expected device ID
 
 // VEML6075-only conversion coefficients
 #define VEML6075_UVA_RESP                   0.0011
@@ -105,6 +105,7 @@
     typedef struct {
         uint16_t id;        /*!< VEML60xx Device ID*/
         uint16_t conf_reg;  /*!< VEML60xx config register mirror */ 
+        int      trig_dly;  /*!< VEML60xx FORCE mode min trigger delay (mS) before resding data registers */ 
               
         bool     is6075;    /*!< connected device is a VEML6075 */ 
         bool     is6040;    /*!< connected device is a VEML6040 */ 
@@ -153,7 +154,7 @@
     /** 
      * Get VEML60xx ID Register
      *
-     * Note: the VEML6040 seems to have an ID register. However, it's not published
+     * Note: the VEML6040 seems to have an ID register. However, it's not published by Vishay
      * 
      * @param pointer to struct veml60xx_struct
      *