oo
Fork of VCNL4100 by
VCNL4100.h@1:b9a553e027e5, 2017-08-25 (annotated)
- Committer:
- jake_schwartz
- Date:
- Fri Aug 25 21:29:49 2017 +0000
- Revision:
- 1:b9a553e027e5
- Parent:
- 0:fbf1a72181fc
ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Rhyme | 0:fbf1a72181fc | 1 | #ifndef _VCNL4100_H_ |
Rhyme | 0:fbf1a72181fc | 2 | #define _VCNL4100_H_ |
Rhyme | 0:fbf1a72181fc | 3 | /** |
Rhyme | 0:fbf1a72181fc | 4 | * Vishay VCNL4100 |
Rhyme | 0:fbf1a72181fc | 5 | * High Sensitivity Long Distance Proximity and |
Rhyme | 0:fbf1a72181fc | 6 | * Ambient Light Sensor with I2C Interface |
Rhyme | 0:fbf1a72181fc | 7 | */ |
Rhyme | 0:fbf1a72181fc | 8 | /* |
Rhyme | 0:fbf1a72181fc | 9 | * @code |
Rhyme | 0:fbf1a72181fc | 10 | * @endcode |
Rhyme | 0:fbf1a72181fc | 11 | */ |
Rhyme | 0:fbf1a72181fc | 12 | class VCNL4100 |
Rhyme | 0:fbf1a72181fc | 13 | { |
Rhyme | 0:fbf1a72181fc | 14 | public: |
Rhyme | 0:fbf1a72181fc | 15 | /** |
Rhyme | 0:fbf1a72181fc | 16 | * VCNL4100 constructor |
Rhyme | 0:fbf1a72181fc | 17 | * |
Rhyme | 0:fbf1a72181fc | 18 | * @param sda SDA pin |
Rhyme | 0:fbf1a72181fc | 19 | * @param sdl SCL pin |
Rhyme | 0:fbf1a72181fc | 20 | * @param addr addr of the I2C peripheral |
Rhyme | 0:fbf1a72181fc | 21 | */ |
Rhyme | 0:fbf1a72181fc | 22 | VCNL4100(PinName sda, PinName scl, int addr); |
Rhyme | 0:fbf1a72181fc | 23 | |
Rhyme | 0:fbf1a72181fc | 24 | /** |
Rhyme | 0:fbf1a72181fc | 25 | * VCNL4100 destructor |
Rhyme | 0:fbf1a72181fc | 26 | */ |
Rhyme | 0:fbf1a72181fc | 27 | ~VCNL4100(); |
Rhyme | 0:fbf1a72181fc | 28 | |
Rhyme | 0:fbf1a72181fc | 29 | /** |
Rhyme | 0:fbf1a72181fc | 30 | * get ALS configuration |
Rhyme | 0:fbf1a72181fc | 31 | * @param none |
Rhyme | 0:fbf1a72181fc | 32 | * @return uint8_t ALS CONF |
Rhyme | 0:fbf1a72181fc | 33 | * |
Rhyme | 0:fbf1a72181fc | 34 | * @note bit[7:6] ALS_IT ASL integration time setting, |
Rhyme | 0:fbf1a72181fc | 35 | * @note longer integration time has higher sensitivity |
Rhyme | 0:fbf1a72181fc | 36 | * @note 00=80ms, 01=160ms, 10=320ms, 11=640ms |
Rhyme | 0:fbf1a72181fc | 37 | * @note - |
Rhyme | 0:fbf1a72181fc | 38 | * @note bit[5:4] (reserved) |
Rhyme | 0:fbf1a72181fc | 39 | * @note - |
Rhyme | 0:fbf1a72181fc | 40 | * @note bit[3:2] ALS interrupt persistence setting |
Rhyme | 0:fbf1a72181fc | 41 | * @note 00=1, 01=2, 10=4, 11=8 |
Rhyme | 0:fbf1a72181fc | 42 | * @note - |
Rhyme | 0:fbf1a72181fc | 43 | * @note bit[1] ALS_INT_EN 0=ALS interrupt disable, 1=ALS interrupt enable |
Rhyme | 0:fbf1a72181fc | 44 | * @note - |
Rhyme | 0:fbf1a72181fc | 45 | * @note bit[0] ALS_SD 0=ALS power on, 1=ALS Shut Down |
Rhyme | 0:fbf1a72181fc | 46 | */ |
Rhyme | 0:fbf1a72181fc | 47 | uint8_t getAlsConf(void) ; |
Rhyme | 0:fbf1a72181fc | 48 | |
Rhyme | 0:fbf1a72181fc | 49 | /** |
Rhyme | 0:fbf1a72181fc | 50 | * set ALS configuration |
Rhyme | 0:fbf1a72181fc | 51 | * @param uint8_t conf, value to assign |
Rhyme | 0:fbf1a72181fc | 52 | * @returns none |
Rhyme | 0:fbf1a72181fc | 53 | */ |
Rhyme | 0:fbf1a72181fc | 54 | void setAlsConf(uint8_t conf) ; |
Rhyme | 0:fbf1a72181fc | 55 | |
Rhyme | 0:fbf1a72181fc | 56 | /** |
Rhyme | 0:fbf1a72181fc | 57 | * Get ALS high interrupt threshold |
Rhyme | 0:fbf1a72181fc | 58 | * @param none |
Rhyme | 0:fbf1a72181fc | 59 | * @returns uint16_t ALS high interrupt threshold |
Rhyme | 0:fbf1a72181fc | 60 | */ |
Rhyme | 0:fbf1a72181fc | 61 | uint16_t getAlsThdh(void) ; |
Rhyme | 0:fbf1a72181fc | 62 | |
Rhyme | 0:fbf1a72181fc | 63 | /** |
Rhyme | 0:fbf1a72181fc | 64 | * Set ALS high interrupt threshold |
Rhyme | 0:fbf1a72181fc | 65 | * @param uint16_t thdh, value to assign |
Rhyme | 0:fbf1a72181fc | 66 | * @returns none |
Rhyme | 0:fbf1a72181fc | 67 | */ |
Rhyme | 0:fbf1a72181fc | 68 | void setAlsThdh(uint16_t thdh) ; |
Rhyme | 0:fbf1a72181fc | 69 | |
Rhyme | 0:fbf1a72181fc | 70 | /** |
Rhyme | 0:fbf1a72181fc | 71 | * Get ALS low interrupt threshold |
Rhyme | 0:fbf1a72181fc | 72 | * @param none |
Rhyme | 0:fbf1a72181fc | 73 | * @returns uint16_t ALS low interrupt threshold |
Rhyme | 0:fbf1a72181fc | 74 | */ |
Rhyme | 0:fbf1a72181fc | 75 | uint16_t getAlsThdl(void) ; |
Rhyme | 0:fbf1a72181fc | 76 | |
Rhyme | 0:fbf1a72181fc | 77 | /** |
Rhyme | 0:fbf1a72181fc | 78 | * Set ALS low interrupt threshold |
Rhyme | 0:fbf1a72181fc | 79 | * @param uint16_t thdl, value to assign |
Rhyme | 0:fbf1a72181fc | 80 | * @returns none |
Rhyme | 0:fbf1a72181fc | 81 | */ |
Rhyme | 0:fbf1a72181fc | 82 | void setAlsThdl(uint16_t thdl) ; |
Rhyme | 0:fbf1a72181fc | 83 | |
Rhyme | 0:fbf1a72181fc | 84 | /** |
Rhyme | 0:fbf1a72181fc | 85 | * Get PS CONF1 and PS CONF2 |
Rhyme | 0:fbf1a72181fc | 86 | * @param none |
Rhyme | 0:fbf1a72181fc | 87 | * @returns uint16_t PS_CONF2 as MSB, PS_CONF1 as LSB |
Rhyme | 0:fbf1a72181fc | 88 | */ |
Rhyme | 0:fbf1a72181fc | 89 | uint16_t getPsConf12(void) ; |
Rhyme | 0:fbf1a72181fc | 90 | |
Rhyme | 0:fbf1a72181fc | 91 | /** |
Rhyme | 0:fbf1a72181fc | 92 | * Set PS CONF1 and PS CONF2 |
Rhyme | 0:fbf1a72181fc | 93 | * @param uint16_t PS_CONF2 as MSB, PS_CONF1 as LSB |
Rhyme | 0:fbf1a72181fc | 94 | * @returns none |
Rhyme | 0:fbf1a72181fc | 95 | */ |
Rhyme | 0:fbf1a72181fc | 96 | void setPsConf12(uint16_t conf12) ; |
Rhyme | 0:fbf1a72181fc | 97 | |
Rhyme | 0:fbf1a72181fc | 98 | /** |
Rhyme | 0:fbf1a72181fc | 99 | * get PS CONF1 |
Rhyme | 0:fbf1a72181fc | 100 | * @param none |
Rhyme | 0:fbf1a72181fc | 101 | * @returns Register value of PS_CONF1 |
Rhyme | 0:fbf1a72181fc | 102 | * |
Rhyme | 0:fbf1a72181fc | 103 | * @note bit[7:6] PS_Duty PS IRED on/off duty ratio setting |
Rhyme | 0:fbf1a72181fc | 104 | * @note 00=1/5120, 01=1/640, 10=1/80, 11=1/20 |
Rhyme | 0:fbf1a72181fc | 105 | * @note - |
Rhyme | 0:fbf1a72181fc | 106 | * @note bit[5:4] PS_IT PS integration time setting |
Rhyme | 0:fbf1a72181fc | 107 | * @note 00=1T, 01=1.3T, 10=1.6T, 11=2T |
Rhyme | 0:fbf1a72181fc | 108 | * @note - |
Rhyme | 0:fbf1a72181fc | 109 | * @note bit[3:2] PS_PERS PS interrupt persistence setting |
Rhyme | 0:fbf1a72181fc | 110 | * @note 00=1, 01=2, 10=3, 11=4 |
Rhyme | 0:fbf1a72181fc | 111 | * @note - |
Rhyme | 0:fbf1a72181fc | 112 | * @note bit[1] (reserved) |
Rhyme | 0:fbf1a72181fc | 113 | * @note - |
Rhyme | 0:fbf1a72181fc | 114 | * @note bit[0] PS_SD 0=PS power on, 1=PS shut down |
Rhyme | 0:fbf1a72181fc | 115 | */ |
Rhyme | 0:fbf1a72181fc | 116 | uint8_t getPsConf1(void) ; |
Rhyme | 0:fbf1a72181fc | 117 | |
Rhyme | 0:fbf1a72181fc | 118 | /** |
Rhyme | 0:fbf1a72181fc | 119 | * set PS_CONF1 |
Rhyme | 0:fbf1a72181fc | 120 | * |
Rhyme | 0:fbf1a72181fc | 121 | * @param uint8_t conf1 value to set |
Rhyme | 0:fbf1a72181fc | 122 | * @returns none |
Rhyme | 0:fbf1a72181fc | 123 | */ |
Rhyme | 0:fbf1a72181fc | 124 | void setPsConf1(uint8_t conf1) ; |
Rhyme | 0:fbf1a72181fc | 125 | |
Rhyme | 0:fbf1a72181fc | 126 | /** |
Rhyme | 0:fbf1a72181fc | 127 | * get PS_CONF2 |
Rhyme | 0:fbf1a72181fc | 128 | * |
Rhyme | 0:fbf1a72181fc | 129 | * @note bit[7:6] PS_ITB PS IT bank setting |
Rhyme | 0:fbf1a72181fc | 130 | * @note 00=1/2T, 01=1T, 10=2T, 11=4T |
Rhyme | 0:fbf1a72181fc | 131 | * @note - |
Rhyme | 0:fbf1a72181fc | 132 | * @note bit[5:4] PS_GAIN |
Rhyme | 0:fbf1a72181fc | 133 | * @note 00=1/4, 01=1/2, 10=1, 11=2 |
Rhyme | 0:fbf1a72181fc | 134 | * @note - |
Rhyme | 0:fbf1a72181fc | 135 | * @note bit[3] (reserved) |
Rhyme | 0:fbf1a72181fc | 136 | * @note - |
Rhyme | 0:fbf1a72181fc | 137 | * @note bit[2] PS_SP_INT_EN |
Rhyme | 0:fbf1a72181fc | 138 | * @note 0 = disable INT function for PS enter/leave sunlight protection mode |
Rhyme | 0:fbf1a72181fc | 139 | * @note 1 = issue INT while PS enter/leave sunlight protection mode. |
Rhyme | 0:fbf1a72181fc | 140 | * @note While PS enter sunlight protection mode, the PS output will keep 0xFF |
Rhyme | 0:fbf1a72181fc | 141 | * @note - |
Rhyme | 0:fbf1a72181fc | 142 | * @note bit[1] (reserved) |
Rhyme | 0:fbf1a72181fc | 143 | * @note - |
Rhyme | 0:fbf1a72181fc | 144 | * @note bit[0] PS_INT_EN |
Rhyme | 0:fbf1a72181fc | 145 | * @note 0 = PS INT function disable, 1 = PS INT function enable |
Rhyme | 0:fbf1a72181fc | 146 | */ |
Rhyme | 0:fbf1a72181fc | 147 | uint8_t getPsConf2(void) ; |
Rhyme | 0:fbf1a72181fc | 148 | |
Rhyme | 0:fbf1a72181fc | 149 | /** |
Rhyme | 0:fbf1a72181fc | 150 | * set PS_CONF2 |
Rhyme | 0:fbf1a72181fc | 151 | * |
Rhyme | 0:fbf1a72181fc | 152 | * @param uint8_t conf2 value to set |
Rhyme | 0:fbf1a72181fc | 153 | * @returns none |
Rhyme | 0:fbf1a72181fc | 154 | */ |
Rhyme | 0:fbf1a72181fc | 155 | void setPsConf2(uint8_t conf2) ; |
Rhyme | 0:fbf1a72181fc | 156 | |
Rhyme | 0:fbf1a72181fc | 157 | /** |
Rhyme | 0:fbf1a72181fc | 158 | * get PS_CONF3 and PS_SPO |
Rhyme | 0:fbf1a72181fc | 159 | * |
Rhyme | 0:fbf1a72181fc | 160 | * @param none |
Rhyme | 0:fbf1a72181fc | 161 | * @returns uint16_t PS_CONF3 as LSB, PS_SPO as MSB |
Rhyme | 0:fbf1a72181fc | 162 | */ |
Rhyme | 0:fbf1a72181fc | 163 | uint16_t getPsConf3Spo(void) ; |
Rhyme | 0:fbf1a72181fc | 164 | |
Rhyme | 0:fbf1a72181fc | 165 | /** |
Rhyme | 0:fbf1a72181fc | 166 | * set PS_CONF3 and PS_SPO |
Rhyme | 0:fbf1a72181fc | 167 | * |
Rhyme | 0:fbf1a72181fc | 168 | * @param uint16_t con3spo PS_CONF3 as LSB, PS_SPO as MSB |
Rhyme | 0:fbf1a72181fc | 169 | * @returns none |
Rhyme | 0:fbf1a72181fc | 170 | */ |
Rhyme | 0:fbf1a72181fc | 171 | void setPsConf3Spo(uint16_t conf3spo) ; |
Rhyme | 0:fbf1a72181fc | 172 | |
Rhyme | 0:fbf1a72181fc | 173 | /** |
Rhyme | 0:fbf1a72181fc | 174 | * get PS_CONF3 |
Rhyme | 0:fbf1a72181fc | 175 | * |
Rhyme | 0:fbf1a72181fc | 176 | * @param none |
Rhyme | 0:fbf1a72181fc | 177 | * @returns uint8_t PS_CONF3 |
Rhyme | 0:fbf1a72181fc | 178 | * |
Rhyme | 0:fbf1a72181fc | 179 | * @note bit[7:6] PS_AV |
Rhyme | 0:fbf1a72181fc | 180 | * @note 00=1/2, 01=1/4, 10=1/8, 11=1/16 |
Rhyme | 0:fbf1a72181fc | 181 | * @note - |
Rhyme | 0:fbf1a72181fc | 182 | * @note bit[5] PS_AV_EN |
Rhyme | 0:fbf1a72181fc | 183 | * @note 0= PS average function disable, 1= PS average function enable |
Rhyme | 0:fbf1a72181fc | 184 | * @note - |
Rhyme | 0:fbf1a72181fc | 185 | * @note bit[4] (reserved) |
Rhyme | 0:fbf1a72181fc | 186 | * @note - |
Rhyme | 0:fbf1a72181fc | 187 | * @note bit[3] PS_AF |
Rhyme | 0:fbf1a72181fc | 188 | * @note 0= active force mode disable (normal mode), 1= active force mode enable |
Rhyme | 0:fbf1a72181fc | 189 | * @note - |
Rhyme | 0:fbf1a72181fc | 190 | * @note bit[2] PS_TRIG |
Rhyme | 0:fbf1a72181fc | 191 | * @note 0= no PS active force mode trigger, 1= trigger one time cycle |
Rhyme | 0:fbf1a72181fc | 192 | * @note VCNL4100 output once cycle data every time host writes in "1" to sensor. |
Rhyme | 0:fbf1a72181fc | 193 | * @note The state returns to "0" automatically. |
Rhyme | 0:fbf1a72181fc | 194 | * @note - |
Rhyme | 0:fbf1a72181fc | 195 | * @note bit[1] PS_MPULSE 0= disable, 1= enable |
Rhyme | 0:fbf1a72181fc | 196 | * @note PS multi pulse mode setting; PS multi puse number set by PS_AV[1:0] |
Rhyme | 0:fbf1a72181fc | 197 | * @note - |
Rhyme | 0:fbf1a72181fc | 198 | * @note bit[0] (reserved) |
Rhyme | 0:fbf1a72181fc | 199 | */ |
Rhyme | 0:fbf1a72181fc | 200 | uint8_t getPsConf3(void) ; |
Rhyme | 0:fbf1a72181fc | 201 | |
Rhyme | 0:fbf1a72181fc | 202 | /** |
Rhyme | 0:fbf1a72181fc | 203 | * set PS_CONF3 |
Rhyme | 0:fbf1a72181fc | 204 | * |
Rhyme | 0:fbf1a72181fc | 205 | * @param uint8_t conf3 value to set |
Rhyme | 0:fbf1a72181fc | 206 | * @returns none |
Rhyme | 0:fbf1a72181fc | 207 | */ |
Rhyme | 0:fbf1a72181fc | 208 | void setPsConf3(uint8_t conf3) ; |
Rhyme | 0:fbf1a72181fc | 209 | |
Rhyme | 0:fbf1a72181fc | 210 | /** |
Rhyme | 0:fbf1a72181fc | 211 | * get PS_SPO |
Rhyme | 0:fbf1a72181fc | 212 | * |
Rhyme | 0:fbf1a72181fc | 213 | * @param none |
Rhyme | 0:fbf1a72181fc | 214 | * @returns uint8_t PS_SPO |
Rhyme | 0:fbf1a72181fc | 215 | * |
Rhyme | 0:fbf1a72181fc | 216 | * @note Set initial value to "0xA0" or "0x20" |
Rhyme | 0:fbf1a72181fc | 217 | * @note bit[7:0] PS_SPO |
Rhyme | 0:fbf1a72181fc | 218 | * @note Set initial value = 0xA0 (PS_OUT = 0xFF while PS into sunlight protection) |
Rhyme | 0:fbf1a72181fc | 219 | * @note Set initial value = 0x20 (PS_OUT = 0x00 while PS into sunlight protection) |
Rhyme | 0:fbf1a72181fc | 220 | * |
Rhyme | 0:fbf1a72181fc | 221 | */ |
Rhyme | 0:fbf1a72181fc | 222 | uint8_t getSpo(void) ; |
Rhyme | 0:fbf1a72181fc | 223 | |
Rhyme | 0:fbf1a72181fc | 224 | /** |
Rhyme | 0:fbf1a72181fc | 225 | * set PS_SPO |
Rhyme | 0:fbf1a72181fc | 226 | * |
Rhyme | 0:fbf1a72181fc | 227 | * @param uint8_t spo value to set (0xA0 or 0x20) |
Rhyme | 0:fbf1a72181fc | 228 | * @returns none |
Rhyme | 0:fbf1a72181fc | 229 | */ |
Rhyme | 0:fbf1a72181fc | 230 | void setSpo(uint8_t spo) ; |
Rhyme | 0:fbf1a72181fc | 231 | |
Rhyme | 0:fbf1a72181fc | 232 | /** |
Rhyme | 0:fbf1a72181fc | 233 | * get PS_THDL as LSB and PS_THDH as MSB |
Rhyme | 0:fbf1a72181fc | 234 | * |
Rhyme | 0:fbf1a72181fc | 235 | * @param none |
Rhyme | 0:fbf1a72181fc | 236 | * @return uint16_t PS_THDL as LSB, PS_THDH as MSB |
Rhyme | 0:fbf1a72181fc | 237 | */ |
Rhyme | 0:fbf1a72181fc | 238 | uint16_t getPsThd(void) ; |
Rhyme | 0:fbf1a72181fc | 239 | |
Rhyme | 0:fbf1a72181fc | 240 | /** |
Rhyme | 0:fbf1a72181fc | 241 | * set PS_THDL as LSB and PS_THDH as MSB |
Rhyme | 0:fbf1a72181fc | 242 | * |
Rhyme | 0:fbf1a72181fc | 243 | * @param uint16_t PS_THDL as LSB, PS_THDH as MSB |
Rhyme | 0:fbf1a72181fc | 244 | * @returns none |
Rhyme | 0:fbf1a72181fc | 245 | */ |
Rhyme | 0:fbf1a72181fc | 246 | void setPsThd(uint16_t psthd) ; |
Rhyme | 0:fbf1a72181fc | 247 | |
Rhyme | 0:fbf1a72181fc | 248 | /** |
Rhyme | 0:fbf1a72181fc | 249 | * get PS_THDL |
Rhyme | 0:fbf1a72181fc | 250 | * |
Rhyme | 0:fbf1a72181fc | 251 | * @param none |
Rhyme | 0:fbf1a72181fc | 252 | * @returns uint8_t PS_THDL |
Rhyme | 0:fbf1a72181fc | 253 | * |
Rhyme | 0:fbf1a72181fc | 254 | * @note bit[7:0] PS_THDL 0x00 to 0xFF, PS low interrupt threshold setting |
Rhyme | 0:fbf1a72181fc | 255 | */ |
Rhyme | 0:fbf1a72181fc | 256 | uint8_t getPsThdl(void) ; |
Rhyme | 0:fbf1a72181fc | 257 | |
Rhyme | 0:fbf1a72181fc | 258 | /** |
Rhyme | 0:fbf1a72181fc | 259 | * set PS_THDL |
Rhyme | 0:fbf1a72181fc | 260 | * |
Rhyme | 0:fbf1a72181fc | 261 | * @param uint8_t thdl value to set |
Rhyme | 0:fbf1a72181fc | 262 | * @returns none |
Rhyme | 0:fbf1a72181fc | 263 | */ |
Rhyme | 0:fbf1a72181fc | 264 | void setPsThdl(uint8_t thdl) ; |
Rhyme | 0:fbf1a72181fc | 265 | |
Rhyme | 0:fbf1a72181fc | 266 | /** |
Rhyme | 0:fbf1a72181fc | 267 | * get PS_THDH |
Rhyme | 0:fbf1a72181fc | 268 | * |
Rhyme | 0:fbf1a72181fc | 269 | * @param none |
Rhyme | 0:fbf1a72181fc | 270 | * @returns uint8_t PS_THDH |
Rhyme | 0:fbf1a72181fc | 271 | * |
Rhyme | 0:fbf1a72181fc | 272 | * @note bit[7:0] PS_THDH 0x00 to 0xFF, PS high interrupt threshold setting |
Rhyme | 0:fbf1a72181fc | 273 | */ |
Rhyme | 0:fbf1a72181fc | 274 | uint8_t getPsThdh(void) ; |
Rhyme | 0:fbf1a72181fc | 275 | |
Rhyme | 0:fbf1a72181fc | 276 | /** |
Rhyme | 0:fbf1a72181fc | 277 | * set PS_THDH |
Rhyme | 0:fbf1a72181fc | 278 | * |
Rhyme | 0:fbf1a72181fc | 279 | * @param uint8_t thdh value to set |
Rhyme | 0:fbf1a72181fc | 280 | * @returns none |
Rhyme | 0:fbf1a72181fc | 281 | */ |
Rhyme | 0:fbf1a72181fc | 282 | void setPsThdh(uint8_t thdh) ; |
Rhyme | 0:fbf1a72181fc | 283 | |
Rhyme | 0:fbf1a72181fc | 284 | /** |
Rhyme | 0:fbf1a72181fc | 285 | * get PS_DATA |
Rhyme | 0:fbf1a72181fc | 286 | * |
Rhyme | 0:fbf1a72181fc | 287 | * @param none |
Rhyme | 0:fbf1a72181fc | 288 | * @returns uint8_t PS_DATA |
Rhyme | 0:fbf1a72181fc | 289 | * |
Rhyme | 0:fbf1a72181fc | 290 | * @note bit[7:0] 0x00 to 0xFF, PS output data |
Rhyme | 0:fbf1a72181fc | 291 | */ |
Rhyme | 0:fbf1a72181fc | 292 | uint8_t getPsData(void) ; |
Rhyme | 0:fbf1a72181fc | 293 | |
Rhyme | 0:fbf1a72181fc | 294 | /** |
Rhyme | 0:fbf1a72181fc | 295 | * get ALS output data |
Rhyme | 0:fbf1a72181fc | 296 | * |
Rhyme | 0:fbf1a72181fc | 297 | * @param none |
Rhyme | 0:fbf1a72181fc | 298 | * @returns uint16_t ALS output data |
Rhyme | 0:fbf1a72181fc | 299 | */ |
Rhyme | 0:fbf1a72181fc | 300 | uint16_t getAlsData(void) ; |
Rhyme | 0:fbf1a72181fc | 301 | |
Rhyme | 0:fbf1a72181fc | 302 | /** |
Rhyme | 0:fbf1a72181fc | 303 | * get INT_FLAG |
Rhyme | 0:fbf1a72181fc | 304 | * |
Rhyme | 0:fbf1a72181fc | 305 | * @param none |
Rhyme | 0:fbf1a72181fc | 306 | * @returns uint8_t INT_FLAG |
Rhyme | 0:fbf1a72181fc | 307 | * |
Rhyme | 0:fbf1a72181fc | 308 | * @note bit[7] PS_SPF_LEAVE, PS leaving protection mode |
Rhyme | 0:fbf1a72181fc | 309 | * @note bit[6] PS_SPF_ENTER, PS entering protection mode |
Rhyme | 0:fbf1a72181fc | 310 | * @note bit[5] ALS_IF_L, ALS crossing low THD INT trigger event |
Rhyme | 0:fbf1a72181fc | 311 | * @note bit[4] ALS_IF_H, ALS crossing high THD INT trigger event |
Rhyme | 0:fbf1a72181fc | 312 | * @note bit[3:2] (reserved) |
Rhyme | 0:fbf1a72181fc | 313 | * @note bit[1] PS_IF_CLOSE, PS rise above PS_THDH INT trigger event |
Rhyme | 0:fbf1a72181fc | 314 | * @note bit[0] PS_IF_AWAY, PS drop below PS_THDL INT trigger event |
Rhyme | 0:fbf1a72181fc | 315 | */ |
Rhyme | 0:fbf1a72181fc | 316 | uint8_t getIntFlag(void) ; |
Rhyme | 0:fbf1a72181fc | 317 | |
Rhyme | 0:fbf1a72181fc | 318 | private: |
jake_schwartz | 1:b9a553e027e5 | 319 | I2C s_i2c; |
jake_schwartz | 1:b9a553e027e5 | 320 | int s_addr; |
Rhyme | 0:fbf1a72181fc | 321 | void readRegs(int addr, uint8_t * data, int len); |
Rhyme | 0:fbf1a72181fc | 322 | void writeRegs(uint8_t * data, int len); |
Rhyme | 0:fbf1a72181fc | 323 | |
Rhyme | 0:fbf1a72181fc | 324 | }; |
Rhyme | 0:fbf1a72181fc | 325 | |
Rhyme | 0:fbf1a72181fc | 326 | #endif /* _VCNL4100_H_ */ |