Humidity and Temperature Sensor - Sensirion SHT1x driver (with exported functions to use it from C code)
Dependents: sht15_remote_monitoring
Fork of SHTx by
Revision 2:7505a67001b4, committed 2015-11-15
- Comitter:
- ppatierno
- Date:
- Sun Nov 15 15:13:08 2015 +0000
- Parent:
- 1:8465801be23f
- Commit message:
- Added export layer to use SHTx from C code
Changed in this revision
sht15.cpp | Show annotated file Show diff for this revision Revisions of this file |
sht15_export.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 8465801be23f -r 7505a67001b4 sht15.cpp --- a/sht15.cpp Fri Nov 19 16:24:46 2010 +0000 +++ b/sht15.cpp Sun Nov 15 15:13:08 2015 +0000 @@ -229,3 +229,39 @@ } } } + +SHTx::SHT15 sensor(PTE25, PTE24); + +extern "C" void SHT15_init(void) { + + // Speed things up a bit. + sensor.setOTPReload(false); + sensor.setResolution(true); + + // Temperature in celcius + sensor.setScale(false); + + return; +} + +extern "C" void SHT15_update(void) { + + sensor.update(); + return; +} + +extern "C" float SHT15_getTemperature(void) { + + // Temperature + return sensor.getTemperature(); +} + +extern "C" float SHT15_getHumidity(void) { + + // Relative Humidity + return sensor.getHumidity(); +} + +extern "C" void SHT15_setScale(bool value) { + sensor.setScale(value); +} \ No newline at end of file
diff -r 8465801be23f -r 7505a67001b4 sht15_export.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sht15_export.h Sun Nov 15 15:13:08 2015 +0000 @@ -0,0 +1,5 @@ +void SHT15_init(void); +void SHT15_update(void); +float SHT15_getTemperature(void); +float SHT15_getHumidity(void); +void SHT15_setScale(bool value); \ No newline at end of file