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:
1:f560bd61b3b3
Parent:
0:92cb496cbbe1
Child:
2:c17b84879a2f
--- a/veml60xx.h	Thu Apr 21 23:46:53 2016 +0000
+++ b/veml60xx.h	Fri Apr 22 18:23:07 2016 +0000
@@ -8,7 +8,7 @@
 #define VEML60_RADDR                        0x21    //i2c address read mode
 
 
-// VEMP6040 and VEML6075 common register set
+// VEML6040 and VEML6075 common register set
 #define VEML60xx_CONF_REG                   0x00    //rw Config Register 
 
 // VEML6075-only register set
@@ -125,9 +125,9 @@
     ~veml60xx();
 
     /** 
-     * Get VEMP6075 ID Register
+     * Get VEML60xx ID Register
      *
-     * Note: the VEMP6040 seems to have an ID register.  It's not published
+     * Note: the VEML6040 seems to have an ID register. However, it's not published
      * 
      * @param pointer to struct veml60xx_struct
      *
@@ -136,7 +136,7 @@
     uint16_t getID(veml60xx_struct& Pntr);
     
     /** 
-     * Get VEMPxx Config Register
+     * Get VEMLxx Config Register
      * 
      * @param pointer to struct veml60xx_struct
      *
@@ -145,25 +145,25 @@
     uint16_t getConfig(veml60xx_struct& Pntr);
 
     /** 
-     * Get VEMP60xx Raw Data
+     * Get VEML60xx Raw Data
      * 
      * @param pointer to struct veml60xx_struct
      *
-     * @return raw data put into struct vemp60xx_struct
+     * @return raw data put into struct VEML60xx_struct
     */ 
     uint16_t getRawData(veml60xx_struct& Pntr);
 
     /** 
-     * Convert the VEMP6075 Raw Data
+     * Convert the VEML6075 Raw Data
      * 
      * @param pointer to struct veml60xx_struct
      *
-     * @return converted data put into struct vemp60xx_struct
+     * @return converted data put into struct VEML60xx_struct
     */ 
     void convertRawData(veml60xx_struct& Pntr);
 
     /** 
-     * Initialize the VEMP60xx
+     * Initialize the VEML60xx
      *
      * Sets up the command register to proper operating mode
      * 
@@ -176,7 +176,7 @@
     void setConfig(veml60xx_struct& Pntr, uint16_t val);
 
     /** 
-     * Trigger a VEMP60xx conversion cycle
+     * Trigger a VEML60xx conversion cycle
      *
      * Must be in manual trigger mode (AF == 1)
      *