Vishay VEML6040 Color RGB sensor I2C driver library
Dependents: test_VEML6040 testSensor
Diff: VEML6040.h
- Revision:
- 0:e6e6107c659e
- Child:
- 1:5540b216acfc
diff -r 000000000000 -r e6e6107c659e VEML6040.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VEML6040.h Fri Feb 05 02:21:10 2016 +0000 @@ -0,0 +1,53 @@ +/* + * File description + * + */ + +#ifndef _VEML6040_H_ +#define _VEML6040_H_ + +#include "mbed.h" + +/** + * RGBW Color Sensor with I2C Interface + * I2C 7bit address: 0x10 + * + */ + +class VEML6040 +{ +public: + /** + * constructor + * + * @param sda SDA pin + * @param scl SCL pin + * @param addr address of the I2C peripheral + */ + VEML6040(PinName sda, PinName scl, int addr) ; + + ~VEML6040() ; + + /* + * some member functions here (yet to be written) + */ +float getR(void) ; // return float value of Red +float getG(void) ; // return float value of Green +float getB(void) ; // return float value of Blue +float getW(void) ; // return float value of White +void getCOLORConf(uint8_t *colorconf) ; +void setCOLORConf(uint8_t colorconf) ; +void getRData(uint16_t *rdata) ; +void getGData(uint16_t *gdata) ; +void getBData(uint16_t *bdata) ; +void getWData(uint16_t *wdata) ; +// void cmdRead(uint8_t cmd, uint8_t *data, uint8_t numdata = 2) ; +// void cmdWrite(uint8_t cmd, uint8_t *data, uint8_t numdata = 2) ; + +private: + I2C m_i2c; + int m_addr; + void readRegs(int addr, uint8_t * data, int len); + void writeRegs(uint8_t * data, int len); +} ; +#endif /* _VEML6040_H_ */