Library for the Measurement Specialties' HTU21D Humidity and Temperature sensor. Code includes device's heater on/off control, serial number access, dew point calculations and RTOS hooks. To date, code tested on GR-PEACH, K64F and KL25Z boards with and w/o RTOS, SDFlash and USB serial Rx interrupts.
Library for the Measurement Specialties / Honeywell HTU21D Humidity and Temperature sensor. Code includes device's heater on/off control, serial number access, dew point calculations and RTOS hooks. To date, code tested on K64F and KL25Z boards with and without RTOS, SDFileSystem and USB serial Rx interrupts.
The HTU21D's serial number is an odd cookie. There are two 16 bit registers and a 32 bit register are combined to generate the serial number. Some of the serial number bit fields are fixed for all devices and some change from part to part.
Diff: htu21d.h
- Revision:
- 3:5c0f8e91d319
- Parent:
- 1:d3ed713f8354
--- a/htu21d.h Thu May 22 18:48:46 2014 +0000 +++ b/htu21d.h Thu Apr 30 00:34:03 2015 +0000 @@ -9,6 +9,13 @@ #include "mbed.h" +#if(defined(TARGET_KL25Z) )//|| defined(TARGET_K64F)) + + #define HTU21Di2cLOWLEVEL 1 //if the use of low-level I2C routines is needed + #warning "HTU21D using low level I2C routines" + +#endif + //Defines for HTU21D #define HTU21Di2cWRITE 0x80 #define HTU21Di2cREAD 0x81 @@ -249,6 +256,9 @@ * * @return --none-- */ +#if not defined HTU21Di2cLOWLEVEL +char htuBuffer[8]; +#endif void getSNReg(); double theTempIs; double theHumIs;