Added a GPIO to power on/off for external I2C sensor(s) (with LEDs)

Dependencies:   UniGraphic mbed vt100

18-Jun-2018 外部センサの電源オン・オフ機能は下位互換の為に無効になっていました。 この版で再度有効にしました。

Committer:
Rhyme
Date:
Fri Apr 13 04:19:23 2018 +0000
Revision:
0:846e2321c637
power to color sensor on/off test OK. Currently the function is disabled.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rhyme 0:846e2321c637 1 #ifndef _VEML6040_H_
Rhyme 0:846e2321c637 2 #define _VEML6040_H_
Rhyme 0:846e2321c637 3
Rhyme 0:846e2321c637 4 #include "mbed.h"
Rhyme 0:846e2321c637 5
Rhyme 0:846e2321c637 6 /**
Rhyme 0:846e2321c637 7 * RGBW Color Sensor with I2C Interface
Rhyme 0:846e2321c637 8 * I2C 7bit address: 0x10
Rhyme 0:846e2321c637 9 *
Rhyme 0:846e2321c637 10 */
Rhyme 0:846e2321c637 11
Rhyme 0:846e2321c637 12 class VEML6040
Rhyme 0:846e2321c637 13 {
Rhyme 0:846e2321c637 14 public:
Rhyme 0:846e2321c637 15 /**
Rhyme 0:846e2321c637 16 * constructor
Rhyme 0:846e2321c637 17 *
Rhyme 0:846e2321c637 18 * @param i2c Pointer of the I2C object
Rhyme 0:846e2321c637 19 * @param addr address of the I2C peripheral
Rhyme 0:846e2321c637 20 */
Rhyme 0:846e2321c637 21 VEML6040(I2C *i2c, int addr) ;
Rhyme 0:846e2321c637 22
Rhyme 0:846e2321c637 23 /**
Rhyme 0:846e2321c637 24 * destructor
Rhyme 0:846e2321c637 25 */
Rhyme 0:846e2321c637 26 ~VEML6040() ;
Rhyme 0:846e2321c637 27
Rhyme 0:846e2321c637 28 /**
Rhyme 0:846e2321c637 29 * get Red
Rhyme 0:846e2321c637 30 * @param none
Rhyme 0:846e2321c637 31 * @returns float value of Red
Rhyme 0:846e2321c637 32 */
Rhyme 0:846e2321c637 33 float getR(void) ; // return float value of Red
Rhyme 0:846e2321c637 34
Rhyme 0:846e2321c637 35 /**
Rhyme 0:846e2321c637 36 * get Green
Rhyme 0:846e2321c637 37 * @param none
Rhyme 0:846e2321c637 38 * @returns float value of Green
Rhyme 0:846e2321c637 39 */
Rhyme 0:846e2321c637 40 float getG(void) ; // return float value of Green
Rhyme 0:846e2321c637 41
Rhyme 0:846e2321c637 42 /**
Rhyme 0:846e2321c637 43 * get Blue
Rhyme 0:846e2321c637 44 * @param none
Rhyme 0:846e2321c637 45 * @returns float value of Blue
Rhyme 0:846e2321c637 46 */
Rhyme 0:846e2321c637 47 float getB(void) ; // return float value of Blue
Rhyme 0:846e2321c637 48
Rhyme 0:846e2321c637 49 /**
Rhyme 0:846e2321c637 50 * get White
Rhyme 0:846e2321c637 51 * @param none
Rhyme 0:846e2321c637 52 * @returns float value of White
Rhyme 0:846e2321c637 53 */
Rhyme 0:846e2321c637 54 float getW(void) ; // return float value of White
Rhyme 0:846e2321c637 55
Rhyme 0:846e2321c637 56 /**
Rhyme 0:846e2321c637 57 * get CCT(McCAMY FORMULA) value X
Rhyme 0:846e2321c637 58 * @param none
Rhyme 0:846e2321c637 59 * @returns float CCT value X
Rhyme 0:846e2321c637 60 */
Rhyme 0:846e2321c637 61 float getX(void) ; // return float value of X
Rhyme 0:846e2321c637 62
Rhyme 0:846e2321c637 63 /**
Rhyme 0:846e2321c637 64 * get CCT(McCAMY FOMULA) value Y
Rhyme 0:846e2321c637 65 * @param none
Rhyme 0:846e2321c637 66 * @returns float CCT value Y
Rhyme 0:846e2321c637 67 */
Rhyme 0:846e2321c637 68 float getY(void) ; // return float value of Y
Rhyme 0:846e2321c637 69
Rhyme 0:846e2321c637 70 /**
Rhyme 0:846e2321c637 71 * get CCT(McCAMY FOMULA) value Z
Rhyme 0:846e2321c637 72 * @param none
Rhyme 0:846e2321c637 73 * @returns float CCT value Z
Rhyme 0:846e2321c637 74 */
Rhyme 0:846e2321c637 75 float getZ(void) ; // return float value of Z
Rhyme 0:846e2321c637 76
Rhyme 0:846e2321c637 77 /**
Rhyme 0:846e2321c637 78 * get CIE1931 X
Rhyme 0:846e2321c637 79 * @param none
Rhyme 0:846e2321c637 80 * @returns float CIE1931 X
Rhyme 0:846e2321c637 81 */
Rhyme 0:846e2321c637 82 float getCIEX(void) ; // return float value of CIE1931_x
Rhyme 0:846e2321c637 83
Rhyme 0:846e2321c637 84 /**
Rhyme 0:846e2321c637 85 * get CIE1931 Y
Rhyme 0:846e2321c637 86 * @param none
Rhyme 0:846e2321c637 87 * @returns float CIE1931 Y
Rhyme 0:846e2321c637 88 */
Rhyme 0:846e2321c637 89 float getCIEY(void) ; // return float value of CIE1931_y
Rhyme 0:846e2321c637 90
Rhyme 0:846e2321c637 91 /**
Rhyme 0:846e2321c637 92 * get color config data
Rhyme 0:846e2321c637 93 * @param *colorconf uint8_t
Rhyme 0:846e2321c637 94 * @reutns 0: success non-0: failure
Rhyme 0:846e2321c637 95 */
Rhyme 0:846e2321c637 96 int getCOLORConf(uint8_t *colorconf) ;
Rhyme 0:846e2321c637 97
Rhyme 0:846e2321c637 98 /**
Rhyme 0:846e2321c637 99 * set color config data
Rhyme 0:846e2321c637 100 * @param *colorconf uint8_t
Rhyme 0:846e2321c637 101 * @returns 0: success non-0: failure
Rhyme 0:846e2321c637 102 */
Rhyme 0:846e2321c637 103 int setCOLORConf(uint8_t colorconf) ;
Rhyme 0:846e2321c637 104
Rhyme 0:846e2321c637 105 /**
Rhyme 0:846e2321c637 106 * get raw Red data
Rhyme 0:846e2321c637 107 * @param uint16_t *rdata
Rhyme 0:846e2321c637 108 * @returns i2c status 0: success non-0: failure
Rhyme 0:846e2321c637 109 */
Rhyme 0:846e2321c637 110 int getRData(uint16_t *rdata) ;
Rhyme 0:846e2321c637 111
Rhyme 0:846e2321c637 112 /**
Rhyme 0:846e2321c637 113 * get raw Green data
Rhyme 0:846e2321c637 114 * @param uint16_t *gdata
Rhyme 0:846e2321c637 115 * @returns i2c status 0: success non-0: failure
Rhyme 0:846e2321c637 116 */
Rhyme 0:846e2321c637 117 int getGData(uint16_t *gdata) ;
Rhyme 0:846e2321c637 118
Rhyme 0:846e2321c637 119 /**
Rhyme 0:846e2321c637 120 * get raw Blue data
Rhyme 0:846e2321c637 121 * @param uint16_t *bdata
Rhyme 0:846e2321c637 122 * @returns i2c status 0: success non-0: failure
Rhyme 0:846e2321c637 123 */
Rhyme 0:846e2321c637 124 int getBData(uint16_t *bdata) ;
Rhyme 0:846e2321c637 125
Rhyme 0:846e2321c637 126 /**
Rhyme 0:846e2321c637 127 * get raw White data
Rhyme 0:846e2321c637 128 * @param uint16_t *wdata
Rhyme 0:846e2321c637 129 * @returns i2c status 0: success non-0: failure
Rhyme 0:846e2321c637 130 */
Rhyme 0:846e2321c637 131 int getWData(uint16_t *wdata) ;
Rhyme 0:846e2321c637 132
Rhyme 0:846e2321c637 133 // void getCCTiData(uint16_t *cctidata) ;
Rhyme 0:846e2321c637 134 /**
Rhyme 0:846e2321c637 135 * get CCTi data for CCT (EMPIRICAL APPROACH)
Rhyme 0:846e2321c637 136 * @param none
Rhyme 0:846e2321c637 137 * @returns float CCTi data
Rhyme 0:846e2321c637 138 */
Rhyme 0:846e2321c637 139 float getCCTiData(void) ;
Rhyme 0:846e2321c637 140 // void getCCTData(uint16_t *cctdata) ;
Rhyme 0:846e2321c637 141
Rhyme 0:846e2321c637 142 /**
Rhyme 0:846e2321c637 143 * get CCT data (EMPIRICAL APPROACH)
Rhyme 0:846e2321c637 144 * @param none
Rhyme 0:846e2321c637 145 * @returns float CCD data
Rhyme 0:846e2321c637 146 */
Rhyme 0:846e2321c637 147 float getCCTData(void) ;
Rhyme 0:846e2321c637 148
Rhyme 0:846e2321c637 149 private:
Rhyme 0:846e2321c637 150 I2C *p_i2c;
Rhyme 0:846e2321c637 151 int m_addr;
Rhyme 0:846e2321c637 152 int readRegs(int addr, uint8_t * data, int len);
Rhyme 0:846e2321c637 153 int writeRegs(uint8_t * data, int len);
Rhyme 0:846e2321c637 154 } ;
Rhyme 0:846e2321c637 155 #endif /* _VEML6040_H_ */