Vishay UV Sensor I2C library
Dependents: test_VEML6075 quattro_vishay_6075_171018 testSensor
VEML6075.h@2:0f3bb80aba40, 2017-05-19 (annotated)
- Committer:
- Rhyme
- Date:
- Fri May 19 04:42:59 2017 +0000
- Revision:
- 2:0f3bb80aba40
- Parent:
- 0:14ccc7ed49fa
- Child:
- 3:d0d23d5abf34
document added
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shockey | 0:14ccc7ed49fa | 1 | /* |
shockey | 0:14ccc7ed49fa | 2 | * File description |
shockey | 0:14ccc7ed49fa | 3 | * |
shockey | 0:14ccc7ed49fa | 4 | */ |
shockey | 0:14ccc7ed49fa | 5 | |
shockey | 0:14ccc7ed49fa | 6 | #ifndef _VEML6075_H_ |
shockey | 0:14ccc7ed49fa | 7 | #define _VEML6075_H_ |
shockey | 0:14ccc7ed49fa | 8 | |
shockey | 0:14ccc7ed49fa | 9 | #include "mbed.h" |
shockey | 0:14ccc7ed49fa | 10 | |
shockey | 0:14ccc7ed49fa | 11 | /** |
shockey | 0:14ccc7ed49fa | 12 | * UVA and UVB Light Sensor with I2C Interface |
shockey | 0:14ccc7ed49fa | 13 | * I2C 7bit address: 0x10 |
shockey | 0:14ccc7ed49fa | 14 | * |
shockey | 0:14ccc7ed49fa | 15 | */ |
shockey | 0:14ccc7ed49fa | 16 | |
shockey | 0:14ccc7ed49fa | 17 | class VEML6075 |
shockey | 0:14ccc7ed49fa | 18 | { |
shockey | 0:14ccc7ed49fa | 19 | public: |
shockey | 0:14ccc7ed49fa | 20 | /** |
shockey | 0:14ccc7ed49fa | 21 | * constructor |
shockey | 0:14ccc7ed49fa | 22 | * |
shockey | 0:14ccc7ed49fa | 23 | * @param sda SDA pin |
shockey | 0:14ccc7ed49fa | 24 | * @param scl SCL pin |
shockey | 0:14ccc7ed49fa | 25 | * @param addr address of the I2C peripheral |
shockey | 0:14ccc7ed49fa | 26 | */ |
shockey | 0:14ccc7ed49fa | 27 | VEML6075(PinName sda, PinName scl, int addr) ; |
shockey | 0:14ccc7ed49fa | 28 | |
shockey | 0:14ccc7ed49fa | 29 | ~VEML6075() ; |
shockey | 0:14ccc7ed49fa | 30 | |
shockey | 0:14ccc7ed49fa | 31 | /* |
shockey | 0:14ccc7ed49fa | 32 | * some member functions here (yet to be written) |
shockey | 0:14ccc7ed49fa | 33 | */ |
Rhyme | 2:0f3bb80aba40 | 34 | /** |
Rhyme | 2:0f3bb80aba40 | 35 | * get UVA |
Rhyme | 2:0f3bb80aba40 | 36 | * @param none |
Rhyme | 2:0f3bb80aba40 | 37 | * @returns float UVA data |
Rhyme | 2:0f3bb80aba40 | 38 | */ |
Rhyme | 2:0f3bb80aba40 | 39 | float getUVA(void) ; |
Rhyme | 2:0f3bb80aba40 | 40 | |
Rhyme | 2:0f3bb80aba40 | 41 | /** |
Rhyme | 2:0f3bb80aba40 | 42 | * get UVA_CIE |
Rhyme | 2:0f3bb80aba40 | 43 | * @param none |
Rhyme | 2:0f3bb80aba40 | 44 | * @returns float UVA_CIE data |
Rhyme | 2:0f3bb80aba40 | 45 | */ |
Rhyme | 2:0f3bb80aba40 | 46 | float getUVA_CIE(void) ; |
Rhyme | 2:0f3bb80aba40 | 47 | |
Rhyme | 2:0f3bb80aba40 | 48 | /** |
Rhyme | 2:0f3bb80aba40 | 49 | * get UVB |
Rhyme | 2:0f3bb80aba40 | 50 | * @param none |
Rhyme | 2:0f3bb80aba40 | 51 | * @returns float UVB data |
Rhyme | 2:0f3bb80aba40 | 52 | */ |
Rhyme | 2:0f3bb80aba40 | 53 | float getUVB(void) ; |
Rhyme | 2:0f3bb80aba40 | 54 | |
Rhyme | 2:0f3bb80aba40 | 55 | /** |
Rhyme | 2:0f3bb80aba40 | 56 | * get UVB_CIE |
Rhyme | 2:0f3bb80aba40 | 57 | * @param none |
Rhyme | 2:0f3bb80aba40 | 58 | * @returns float UVB_CIE data |
Rhyme | 2:0f3bb80aba40 | 59 | */ |
Rhyme | 2:0f3bb80aba40 | 60 | float getUVB_CIE(void) ; |
Rhyme | 2:0f3bb80aba40 | 61 | |
Rhyme | 2:0f3bb80aba40 | 62 | /** |
Rhyme | 2:0f3bb80aba40 | 63 | * get UVConf |
Rhyme | 2:0f3bb80aba40 | 64 | * @param uint8_t *uvconf |
Rhyme | 2:0f3bb80aba40 | 65 | * @reurns none |
Rhyme | 2:0f3bb80aba40 | 66 | */ |
shockey | 0:14ccc7ed49fa | 67 | void getUVConf(uint8_t *uvconf) ; |
Rhyme | 2:0f3bb80aba40 | 68 | |
Rhyme | 2:0f3bb80aba40 | 69 | /** |
Rhyme | 2:0f3bb80aba40 | 70 | * set UVConf |
Rhyme | 2:0f3bb80aba40 | 71 | * @param uint8_t uvconf |
Rhyme | 2:0f3bb80aba40 | 72 | * @returns none |
Rhyme | 2:0f3bb80aba40 | 73 | */ |
shockey | 0:14ccc7ed49fa | 74 | void setUVConf(uint8_t uvconf) ; |
Rhyme | 2:0f3bb80aba40 | 75 | |
Rhyme | 2:0f3bb80aba40 | 76 | /** |
Rhyme | 2:0f3bb80aba40 | 77 | * get raw UVA data |
Rhyme | 2:0f3bb80aba40 | 78 | * @param uint16_t *uvadata |
Rhyme | 2:0f3bb80aba40 | 79 | * @returns none |
Rhyme | 2:0f3bb80aba40 | 80 | */ |
shockey | 0:14ccc7ed49fa | 81 | void getUVAData(uint16_t *uvadata) ; |
Rhyme | 2:0f3bb80aba40 | 82 | |
Rhyme | 2:0f3bb80aba40 | 83 | /** |
Rhyme | 2:0f3bb80aba40 | 84 | * get raw UVB data |
Rhyme | 2:0f3bb80aba40 | 85 | * @param uint16_t *rvbdata |
Rhyme | 2:0f3bb80aba40 | 86 | * @returns none |
Rhyme | 2:0f3bb80aba40 | 87 | */ |
shockey | 0:14ccc7ed49fa | 88 | void getUVBData(uint16_t *uvbdata) ; |
Rhyme | 2:0f3bb80aba40 | 89 | |
Rhyme | 2:0f3bb80aba40 | 90 | /** |
Rhyme | 2:0f3bb80aba40 | 91 | * get raw UVD data |
Rhyme | 2:0f3bb80aba40 | 92 | * @param uint16_t *uvddata |
Rhyme | 2:0f3bb80aba40 | 93 | * @returns none |
Rhyme | 2:0f3bb80aba40 | 94 | */ |
shockey | 0:14ccc7ed49fa | 95 | void getUVDData(uint16_t *uvddata) ; |
Rhyme | 2:0f3bb80aba40 | 96 | |
Rhyme | 2:0f3bb80aba40 | 97 | /** |
Rhyme | 2:0f3bb80aba40 | 98 | * get UVCOMP1 data |
Rhyme | 2:0f3bb80aba40 | 99 | * @param *uint16_t *uvcomp1data |
Rhyme | 2:0f3bb80aba40 | 100 | * @returns none |
Rhyme | 2:0f3bb80aba40 | 101 | */ |
shockey | 0:14ccc7ed49fa | 102 | void getUVCOMP1Data(uint16_t *uvcomp1data) ; |
Rhyme | 2:0f3bb80aba40 | 103 | |
Rhyme | 2:0f3bb80aba40 | 104 | /** |
Rhyme | 2:0f3bb80aba40 | 105 | * get UVCOMP2 data |
Rhyme | 2:0f3bb80aba40 | 106 | * @param *uint16_t *uvcomp2data |
Rhyme | 2:0f3bb80aba40 | 107 | * @returns none |
Rhyme | 2:0f3bb80aba40 | 108 | */ |
shockey | 0:14ccc7ed49fa | 109 | void getUVCOMP2Data(uint16_t *uvcomp2data) ; |
Rhyme | 2:0f3bb80aba40 | 110 | |
Rhyme | 2:0f3bb80aba40 | 111 | /** |
Rhyme | 2:0f3bb80aba40 | 112 | * get UVI UV Index |
Rhyme | 2:0f3bb80aba40 | 113 | * @param none |
Rhyme | 2:0f3bb80aba40 | 114 | * @returns float UVI |
Rhyme | 2:0f3bb80aba40 | 115 | */ |
shockey | 0:14ccc7ed49fa | 116 | float UVI(void) ; |
Rhyme | 2:0f3bb80aba40 | 117 | |
Rhyme | 2:0f3bb80aba40 | 118 | /** |
Rhyme | 2:0f3bb80aba40 | 119 | * get device ID |
Rhyme | 2:0f3bb80aba40 | 120 | * @param uint16_t *id device ID |
Rhyme | 2:0f3bb80aba40 | 121 | * @returns none |
Rhyme | 2:0f3bb80aba40 | 122 | */ |
shockey | 0:14ccc7ed49fa | 123 | void getID(uint16_t *id) ; |
Rhyme | 2:0f3bb80aba40 | 124 | |
shockey | 0:14ccc7ed49fa | 125 | // void cmdRead(uint8_t cmd, uint8_t *data, uint8_t numdata = 2) ; |
shockey | 0:14ccc7ed49fa | 126 | // void cmdWrite(uint8_t cmd, uint8_t *data, uint8_t numdata = 2) ; |
shockey | 0:14ccc7ed49fa | 127 | |
shockey | 0:14ccc7ed49fa | 128 | private: |
shockey | 0:14ccc7ed49fa | 129 | I2C m_i2c; |
shockey | 0:14ccc7ed49fa | 130 | int m_addr; |
shockey | 0:14ccc7ed49fa | 131 | void readRegs(int addr, uint8_t * data, int len); |
shockey | 0:14ccc7ed49fa | 132 | void writeRegs(uint8_t * data, int len); |
shockey | 0:14ccc7ed49fa | 133 | } ; |
shockey | 0:14ccc7ed49fa | 134 | #endif /* _VEML6075_H_ */ |