Team DIANA / Mbed OS Scientific_RTOS

Dependencies:   BOX_1

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers VEML6070.h Source File

VEML6070.h

00001 /***************************************************
00002   This is a library for the VEML6070 UV-A Sensor
00003 
00004   Works with the VEML6070 sensor from Adafruit
00005   ----> https://www.adafruit.com/products/2899
00006   Or knock-off sensors from aliexpress
00007 
00008   These sensors use I2C to communicate, 2 pins are required to
00009   interface
00010 
00011   The VEML6070 is capable of alerting when UV levels rise past a pre-set level.
00012   It uses a "ACK" pin, and the SMBus Alert Response Address must be read to 
00013   clear the alert.
00014   If alert is turned on, you must clear the alert bit before you read/write the
00015   sensor.
00016 
00017   06/09/2017 - Initial mbed driver by Scott Roberts
00018  ****************************************************/
00019 
00020 
00021 #ifndef VEML6070_H
00022 #define VEML6070_H
00023 
00024 #include "mbed.h"
00025 
00026 // really unusual way of getting data, your read from two different addrs!
00027 #define VEML6070_ADDR_H (0x39 << 1)
00028 #define VEML6070_ADDR_L (0x38 << 1)
00029 
00030 // three different integration times
00031 typedef enum veml6070_integrationtime {
00032     VEML6070_HALF_T,
00033     VEML6070_1_T,
00034     VEML6070_2_T,
00035     VEML6070_4_T,
00036 } veml6070_integrationtime_t;
00037 
00038 
00039 class VEML6070
00040 {
00041 public:
00042     VEML6070(I2C& p_i2c);
00043     void begin(veml6070_integrationtime_t itime);
00044     uint16_t readUV(void);
00045 protected:
00046     I2C  _i2c;
00047 private:
00048     char dt[2];
00049 };
00050 #endif