Vishay VEML6040 Color RGB sensor I2C driver library

Dependents:   test_VEML6040 testSensor

Committer:
shockey
Date:
Wed Mar 08 04:45:35 2017 +0000
Revision:
1:5540b216acfc
Parent:
0:e6e6107c659e
Child:
3:c6614597c135
CIE1931_data_output; CCT_data_output

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shockey 0:e6e6107c659e 1 /*
shockey 0:e6e6107c659e 2 * File description
shockey 0:e6e6107c659e 3 *
shockey 0:e6e6107c659e 4 */
shockey 0:e6e6107c659e 5
shockey 0:e6e6107c659e 6 #ifndef _VEML6040_H_
shockey 0:e6e6107c659e 7 #define _VEML6040_H_
shockey 0:e6e6107c659e 8
shockey 0:e6e6107c659e 9 #include "mbed.h"
shockey 0:e6e6107c659e 10
shockey 0:e6e6107c659e 11 /**
shockey 0:e6e6107c659e 12 * RGBW Color Sensor with I2C Interface
shockey 0:e6e6107c659e 13 * I2C 7bit address: 0x10
shockey 0:e6e6107c659e 14 *
shockey 0:e6e6107c659e 15 */
shockey 0:e6e6107c659e 16
shockey 0:e6e6107c659e 17 class VEML6040
shockey 0:e6e6107c659e 18 {
shockey 0:e6e6107c659e 19 public:
shockey 0:e6e6107c659e 20 /**
shockey 0:e6e6107c659e 21 * constructor
shockey 0:e6e6107c659e 22 *
shockey 0:e6e6107c659e 23 * @param sda SDA pin
shockey 0:e6e6107c659e 24 * @param scl SCL pin
shockey 0:e6e6107c659e 25 * @param addr address of the I2C peripheral
shockey 0:e6e6107c659e 26 */
shockey 0:e6e6107c659e 27 VEML6040(PinName sda, PinName scl, int addr) ;
shockey 0:e6e6107c659e 28
shockey 0:e6e6107c659e 29 ~VEML6040() ;
shockey 0:e6e6107c659e 30
shockey 0:e6e6107c659e 31 /*
shockey 0:e6e6107c659e 32 * some member functions here (yet to be written)
shockey 0:e6e6107c659e 33 */
shockey 0:e6e6107c659e 34 float getR(void) ; // return float value of Red
shockey 0:e6e6107c659e 35 float getG(void) ; // return float value of Green
shockey 0:e6e6107c659e 36 float getB(void) ; // return float value of Blue
shockey 0:e6e6107c659e 37 float getW(void) ; // return float value of White
shockey 1:5540b216acfc 38 float getX(void) ; // return float value of X
shockey 1:5540b216acfc 39 float getY(void) ; // return float value of Y
shockey 1:5540b216acfc 40 float getZ(void) ; // return float value of Z
shockey 1:5540b216acfc 41 float getCIEX(void) ; // return float value of CIE1931_x
shockey 1:5540b216acfc 42 float getCIEY(void) ; // return float value of CIE1931_y
shockey 1:5540b216acfc 43
shockey 0:e6e6107c659e 44 void getCOLORConf(uint8_t *colorconf) ;
shockey 0:e6e6107c659e 45 void setCOLORConf(uint8_t colorconf) ;
shockey 1:5540b216acfc 46 // void getX(uint8_t *X) ;
shockey 1:5540b216acfc 47 // void getY(uint8_t *Y) ;
shockey 1:5540b216acfc 48 // void getZ(uint8_t *Z) ;
shockey 0:e6e6107c659e 49 void getRData(uint16_t *rdata) ;
shockey 0:e6e6107c659e 50 void getGData(uint16_t *gdata) ;
shockey 0:e6e6107c659e 51 void getBData(uint16_t *bdata) ;
shockey 0:e6e6107c659e 52 void getWData(uint16_t *wdata) ;
shockey 1:5540b216acfc 53 // void getCCTiData(uint16_t *cctidata) ;
shockey 1:5540b216acfc 54 float getCCTiData(void) ;
shockey 1:5540b216acfc 55 // void getCCTData(uint16_t *cctdata) ;
shockey 1:5540b216acfc 56 float getCCTData(void) ;
shockey 0:e6e6107c659e 57 // void cmdRead(uint8_t cmd, uint8_t *data, uint8_t numdata = 2) ;
shockey 0:e6e6107c659e 58 // void cmdWrite(uint8_t cmd, uint8_t *data, uint8_t numdata = 2) ;
shockey 0:e6e6107c659e 59
shockey 0:e6e6107c659e 60 private:
shockey 0:e6e6107c659e 61 I2C m_i2c;
shockey 0:e6e6107c659e 62 int m_addr;
shockey 0:e6e6107c659e 63 void readRegs(int addr, uint8_t * data, int len);
shockey 0:e6e6107c659e 64 void writeRegs(uint8_t * data, int len);
shockey 0:e6e6107c659e 65 } ;
shockey 0:e6e6107c659e 66 #endif /* _VEML6040_H_ */