Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
HDC1000.h
00001 #ifndef _HDC1000_H_ 00002 #define _HDC1000_H_ 00003 #include "mbed.h" 00004 /** 00005 * HDC1000 Integrated Low Power Humidity and Temperature Digital Sensor 00006 * I2C address: 0x40 00007 */ 00008 00009 #define USE_READY_PIN 1 00010 00011 class HDC1000 { 00012 public: 00013 /** 00014 * constructor 00015 * 00016 * @param sda SDA pin 00017 * @param scl SCL pin 00018 * @param rdy Ready pin 00019 * @param addr address of the I2C peripheral 00020 */ 00021 #if USE_READY_PIN 00022 HDC1000(PinName sda, PinName scl, PinName rdy, int addr=0x40) ; 00023 #else 00024 HDC1000(PinName sda, PinName scl, int addr=0x40) ; 00025 #endif 00026 00027 ~HDC1000() ; 00028 00029 /** 00030 * read Temperature 00031 * @param NONE 00032 * @returns float Temperature in Celsius degree 00033 */ 00034 float readTemperature(void) ; 00035 00036 /** 00037 * read Humidity 00038 * @param NONE 00039 * @returns float Humidity in percentage 00040 */ 00041 float readHumidity(void) ; 00042 00043 /** 00044 * reset the module 00045 */ 00046 void reset(void) ; 00047 00048 float u2f_temp(uint16_t utemp) ; 00049 float u2f_hume(uint16_t uhume) ; 00050 00051 /* for mode 0 */ 00052 /** 00053 * get Raw Temperature value 00054 * @param NONE 00055 * @reurns Raw Temperature value 00056 */ 00057 uint16_t getTemperature(void) ; 00058 00059 /** 00060 * get Raw Humidity value 00061 * @param NONE 00062 * @returns Raw Humidity value 00063 */ 00064 uint16_t getHumidity(void) ; 00065 00066 /** 00067 * read Temperature and Humidity together (mode==0) 00068 * @param float *temp returns temperature 00069 * @param float *hume returns humidity 00070 */ 00071 void readData(float *temp, float *hume) ; 00072 00073 /* for mode 1 */ 00074 void getData(uint16_t *temp, uint16_t *hume) ; 00075 00076 void setConfig(uint16_t conf) ; 00077 uint16_t getConfig(void) ; 00078 void setMode(int mode) ; 00079 int getMode(void) ; 00080 void setTres(int tres) ; 00081 int getTres(void) ; 00082 void setHres(int hres) ; 00083 int getHres(void) ; 00084 void getSerialID(uint8_t data[]) ; /* returns 5 bytes ID */ 00085 uint16_t getManufactureID(void) ; /* 0x5449 : Texas Instruments */ 00086 uint16_t getDeviceID(void) ; /* 0x1000 */ 00087 00088 float getTDelay(void) ; 00089 float getHDelay(void) ; 00090 float getDelay(void) ; 00091 00092 private: 00093 I2C m_i2c; 00094 #if USE_READY_PIN 00095 DigitalIn m_rdy ; 00096 #endif 00097 int m_addr; 00098 void readRegs(int addr, uint8_t * data, int len); 00099 void writeRegs(uint8_t * data, int len); 00100 } ; 00101 00102 #endif /* _HDC1000_H_ */
Generated on Mon Jul 25 2022 05:24:50 by
1.7.2