An updated, basic library to interface with the HTU21D digital temperature and humidity sensor
Dependents: HTU21D_HELLOWORLD HTU21D-F_Nucleo_F411RE Bicycl_Computer_NUCLEO-F411RE Bicycl_Computer_NUCLEO-L476RG ... more
Fork of HTU21D by
Revision 2:4fd07be6bad8, committed 2014-10-19
- Comitter:
- alipford3
- Date:
- Sun Oct 19 19:27:19 2014 +0000
- Parent:
- 1:d7568a103ef5
- Commit message:
- An updated, basic library to interface with the HTU21D temperature and humidity sensor
Changed in this revision
HTU21D/HTU21D.cpp | Show annotated file Show diff for this revision Revisions of this file |
HTU21D/HTU21D.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r d7568a103ef5 -r 4fd07be6bad8 HTU21D/HTU21D.cpp --- a/HTU21D/HTU21D.cpp Sun Oct 19 18:24:53 2014 +0000 +++ b/HTU21D/HTU21D.cpp Sun Oct 19 19:27:19 2014 +0000 @@ -1,14 +1,14 @@ /** - * @author Alan Lai & Nelson Diaz - * The Georgia Institute of Technology - * ECE 4180 Embeded Systems + * @author Alex Lipford + * Georgia Institute of Technology + * ECE 4180 Embeded Systems Design * Professor Hamblen - * 03/28/2014 + * 10/19/2014 * * @section LICENSE * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): - * <alanhlai91@gmail.com> wrote this file. As long as you retain this notice you + * <alexlipford@gmail.com> wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. * ---------------------------------------------------------------------------- @@ -45,11 +45,11 @@ tx[0] = TRIGGER_TEMP_MEASURE; // Triggers a temperature measure by feeding correct opcode. i2c_->write((HTU21D_I2C_ADDRESS << 1) & 0xFE, tx, 1); - wait_ms(50); + wait_ms(50); // Per datasheet, wait long enough for device to sample temperature // Reads triggered measure i2c_->read((HTU21D_I2C_ADDRESS << 1) | 0x01, rx, 2); - wait_ms(50); + wait_ms(1); // Algorithm from datasheet to compute temperature. unsigned int rawTemperature = ((unsigned int) rx[0] << 8) | (unsigned int) rx[1]; @@ -86,7 +86,7 @@ tx[0] = TRIGGER_HUMD_MEASURE; // Triggers a humidity measure by feeding correct opcode. i2c_->write((HTU21D_I2C_ADDRESS << 1) & 0xFE, tx, 1); - wait_ms(1); + wait_ms(16); // Per datasheet, wait long enough for device to sample humidity // Reads triggered measure i2c_->read((HTU21D_I2C_ADDRESS << 1) | 0x01, rx, 2);
diff -r d7568a103ef5 -r 4fd07be6bad8 HTU21D/HTU21D.h --- a/HTU21D/HTU21D.h Sun Oct 19 18:24:53 2014 +0000 +++ b/HTU21D/HTU21D.h Sun Oct 19 19:27:19 2014 +0000 @@ -1,14 +1,14 @@ /** - * @author Alan Lai & Nelson Diaz - * The Georgia Institute of Technology - * ECE 4180 Embeded Systems + * @author Alex Lipford + * Georgia Institute of Technology + * ECE 4180 Embeded Systems Design * Professor Hamblen - * 03/28/2014 + * 10/19/2014 * * @section LICENSE * ---------------------------------------------------------------------------- * "THE BEER-WARE LICENSE" (Revision 42): - * <alanhlai91@gmail.com> wrote this file. As long as you retain this notice you + * <alexlipford@gmail.com> wrote this file. As long as you retain this notice you * can do whatever you want with this stuff. If we meet some day, and you think * this stuff is worth it, you can buy me a beer in return. * ----------------------------------------------------------------------------