si1145 library
Dependents: FRDM_ApplicationShield_GroveSensors
Revision 6:642ece0fad39, committed 2015-06-14
- Comitter:
- caseyquinn
- Date:
- Sun Jun 14 01:33:47 2015 +0000
- Parent:
- 5:2260652f0296
- Child:
- 7:3e3fe1852990
- Commit message:
- addtional changes to value types
Changed in this revision
SI1145.cpp | Show annotated file Show diff for this revision Revisions of this file |
SI1145.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SI1145.cpp Sun Jun 14 01:25:38 2015 +0000 +++ b/SI1145.cpp Sun Jun 14 01:33:47 2015 +0000 @@ -186,10 +186,10 @@ return vali; } -uint16_t SI1145::getVIS() +int 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,19 +200,18 @@ i2c.read(address, data, 2); // Merge bytes vali = data[0] | (data[1] << 8); // int - valf = (float)vali; - valf = valf/100; // convert to float + //valf = (float)vali; // convert to float // Return value - return valf; + return vali; } -uint16_t SI1145::getIR() +int SI1145::getIR() { // Variables //float valf; // ir value char reg[1]; // register char data[2] = {0,0}; // data 2 x 8 bits - uint16_t vali; // ir value + int vali; // ir value // Set register reg[0] = 0x24; // Read registers @@ -225,13 +224,13 @@ return vali; } -uint16_t SI1145::getPROX() +int SI1145::getPROX() { // Variables //float valf; // prox value char reg[1]; // register char data[2] = {0,0}; // data 2 x 8 bits - uint16_t vali; // prox value + int vali; // prox value // Set register reg[0] = 0x26; // Read registers
--- a/SI1145.h Sun Jun 14 01:25:38 2015 +0000 +++ b/SI1145.h Sun Jun 14 01:33:47 2015 +0000 @@ -41,15 +41,15 @@ /** Begin Initialization SI1145 sensor * Configure sensor setting and read parameters for calibration */ - float getUV(void); + int getUV(void); /** Read the current VIS value from SI1145 sensor */ - uint16_t getVIS(void); + int getVIS(void); float getUVlsb(void); float getUVmsb(void); /** Read the current IR value from SI1145 sensor */ - uint16_t getIR(void); + int getIR(void); /** Read the current PROX value from SI1145 sensor */ uint16_t getPROX(void);