si1145 library
Dependents: FRDM_ApplicationShield_GroveSensors
Diff: SI1145.cpp
- Revision:
- 1:8587b5583343
- Parent:
- 0:0490a77adbc5
- Child:
- 3:efef49daeb13
--- a/SI1145.cpp Wed May 20 03:49:03 2015 +0000 +++ b/SI1145.cpp Fri May 29 13:52:22 2015 +0000 @@ -167,10 +167,10 @@ i2c.write(address, REG_COMMAND, 2); } -float SI1145::getUV() +uint16_t SI1145::getUV() { // Variables - float valf; // uv value + //float valf; // uv value char reg[1]; // register char data[2] = {0,0}; // data 2 x 8 bits uint16_t vali; // uv value @@ -181,15 +181,15 @@ i2c.read(address, data, 2); // Merge bytes vali = data[0] | (data[1] << 8); // int - valf = (float)vali; // convert to float + //valf = (float)vali; // convert to float // Return value - return valf; + return vali; } -float SI1145::getVIS() +uint16_t SI1145::getVIS() { // Variables - float valf; // vis (IR+UV) value + //float valf; // vis (IR+UV) value char reg[1]; // register char data[2] = {0,0}; // data 2 x 8 bits uint16_t vali; // vis value @@ -200,15 +200,15 @@ i2c.read(address, data, 2); // Merge bytes vali = data[0] | (data[1] << 8); // int - valf = (float)vali; // convert to float + //valf = (float)vali; // convert to float // Return value - return valf; + return vali; } -float SI1145::getIR() +uint16_t SI1145::getIR() { // Variables - float valf; // ir value + //float valf; // ir value char reg[1]; // register char data[2] = {0,0}; // data 2 x 8 bits uint16_t vali; // ir value @@ -219,15 +219,15 @@ i2c.read(address, data, 2); // Merge bytes vali = data[0] | (data[1] << 8); // int - valf = (float)vali; // convert to float + //valf = (float)vali; // convert to float // Return value - return valf; + return vali; } -float SI1145::getPROX() +uint16_t SI1145::getPROX() { // Variables - float valf; // prox value + //float valf; // prox value char reg[1]; // register char data[2] = {0,0}; // data 2 x 8 bits uint16_t vali; // prox value @@ -238,8 +238,8 @@ i2c.read(address, data, 2); // Merge bytes vali = data[0] | (data[1] << 8); // int - valf = (float)vali; // convert to float + //valf = (float)vali; // convert to float // Return value - return valf; + return vali; }