Device driver for Si7020 Digital humidity and temperature sensor.
Dependents: Si7020_example MAXWSNENV_sensors MAXWSNENV_sensors Hello-Uzuki-sensor-shield ... more
Si7020 Device Driver
This is a device driver for the Si7020 Humidity and temperature sensor. It uses I2C to communicate humidity and temperature data.
Revision 1:eca9d19c17ab, committed 2015-04-17
- Comitter:
- kgills
- Date:
- Fri Apr 17 11:25:00 2015 -0500
- Parent:
- 0:9a1febb56203
- Commit message:
- Fixing compiler float warnings.
Changed in this revision
Si7020.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 9a1febb56203 -r eca9d19c17ab Si7020.cpp --- a/Si7020.cpp Fri Apr 17 09:53:45 2015 -0500 +++ b/Si7020.cpp Fri Apr 17 11:25:00 2015 -0500 @@ -252,7 +252,7 @@ // Calculate the temperature using the formula from the datasheet // Scaled by 100 - *tempC = (((float)175.72 * code) / 65536) - 46.85; + *tempC = ((175.72f * (float)code) / 65536.0f) - 46.85f; return 0; } @@ -328,7 +328,7 @@ code = ((uint16_t)data[0] << 8) + data[1]; // Calculate the humidity using the formula from the datasheet - *humid = (((float)125 * code) / 65536) - 6; + *humid = ((125.0f * (float)code) / 65536.0f) - 6.0f; return 0; }