Driver Library for the Measurement Specialties HTU21D temperature & humidity sensor.
The HTU21D is an i2c device with a temperature sensing element (capable of 14bit resolution or 0.01 degC) and a relative humidity sensing element (capable of 12bit resolution or 0.04%RH).
Sensirion SHT21 appears to be code compatible, but is currently untested.
In user_init call:
i2c_init();
To read temperature run HTU21D_temperature(&temperature); where temperature is an existing float variable.
To read humidity run HTU21D_humidity(&humidity); where humidity is an existing float variable.
Both functions return integer 1 on success, or integer 0 on failure.
See Example_user_main.c for typical usage. Actual usage is shown within IdleTask function.
Note: ftos() function is provided to convert a float into a text string for use with os_printf
See i2c.h to set the GPIO pins for i2c. Default is SCK = GPIO0, SDA = GPIO2. (you may need to change this depending on your board configuration)