MtM+ / CM3592

Dependents:   Mt05_MtSense05

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CM3592.h Source File

CM3592.h

00001 #ifndef CM3592_H
00002 #define CM3592_H
00003 
00004 #define CM3592_ADDR                     0x20
00005 
00006 #define CM3592_REG_CTRL                 0x00
00007 #define CM3592_REG_ALS_HIGH_THRESHOLD   0x02
00008 #define CM3592_REG_ALS_LOW_THRESHOLD    0x03
00009 #define CM3592_REG_UV_DATA              0x06
00010 #define CM3592_REG_UVB_DATA             0x07
00011 #define CM3592_REG_G_DATA               0x09
00012 #define CM3592_REG_IR_DATA              0x0B
00013 #define CM3592_REG_DEVICE_ID            0x0C
00014 #define CM3592_REG_ALS_CROSS_INT_EVENT  0x0D
00015 
00016 #include "mbed.h"
00017 
00018 class CM3592 {
00019     public:
00020         CM3592(I2C& i2c);
00021         int init();
00022         int init(char configL, char configH);
00023         int readData(uint16_t *uv);
00024         int getUVIndex(uint16_t uv);
00025     protected:
00026         I2C m_i2c;
00027         char config[2];
00028         void write(char reg, char data[]);
00029         void read(char reg, char data[]);
00030     private:
00031 
00032 };
00033 
00034 #endif