Port of the SHT2x example code from Sensirion
Dependents: sht21_test ENVLogger
Diff: SHT2x.h
- Revision:
- 2:2464fed17980
- Parent:
- 1:d0f691423bf1
--- a/SHT2x.h Sat Apr 23 18:10:56 2011 +0000 +++ b/SHT2x.h Sat Apr 23 19:07:52 2011 +0000 @@ -1,20 +1,33 @@ +/* + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +//============================================================================= +// Port of the SHT21 example code from Sensirion +// port by Serge Sozonoff +//============================================================================= + #include "mbed.h" #include "SHT21_I2C.h" #ifndef SHT2x_H #define SHT2x_H -//============================================================================== -// S E N S I R I O N AG, Laubisruetistr. 50, CH-8712 Staefa, Switzerland -//============================================================================== -// Project : SHT2x Sample Code (V1.2) -// File : SHT2x.h -// Author : MST -// Controller: NEC V850/SG3 (uPD70F3740) -// Compiler : IAR compiler for V850 (3.50A) -// Brief : Sensor layer. Definitions of commands and registers, -// functions for sensor access -//============================================================================== -// CRC const int POLYNOMIAL = 0x131; //P(x)=x^8+x^5+x^4+1 = 100110001 const int ACK = 1; @@ -82,10 +95,11 @@ float SHT2x_CalcRH(int u16sRH); float SHT2x_CalcTemperatureC(int u16sT); int SHT2x_GetSerialNumber(int u8SerialNumber[]); + float SHT2x_GetDewpoint(float h, float t); protected: - SHT_I2C i2c; - Serial out; + SHT_I2C i2c; + int i2cWrite(int data); private: