test code for hdc1080 humidity sensor
Fork of Nucleo-F303K8-SSD1306_OLED by
hdc_1080.h.txt
- Committer:
- joeata2wh
- Date:
- 2016-09-14
- Revision:
- 5:3c91772b714e
- Parent:
- 4:53d68b18bd43
File content as of revision 5:3c91772b714e:
/* Arduino Library for Texas Instruments HDC1080 Digital Humidity and Temperature Sensor Written by AA for ClosedCube --- The MIT License (MIT) Copyright (c) 2016 ClosedCube Limited 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. */ #ifndef _CLOSEDCUBE_HDC1080_h #define _CLOSEDCUBE_HDC1080_h #include "mbed.h" I2C i2chdc(I2C_SDA,I2C_SCL); typedef enum { TEMPERATURE = 0x00, HUMIDITY = 0x01, CONFIGURATION = 0x02, MANUFACTURER_ID = 0xFE, DEVICE_ID = 0xFF, SERIAL_ID_FIRST = 0xFB, SERIAL_ID_MID = 0xFC, SERIAL_ID_LAST = 0xFD, } HDC1080_Pointers; class ClosedCube_HDC1080 { public: ClosedCube_HDC1080(); void begin(uint8_t address); uint16_t readManufacturerId(); // 0x5449 ID of Texas Instruments uint16_t readDeviceId(); // 0x1050 ID of the device float readTemperature(); float readHumidity(); float readT(); // short-cut for readTemperature float readH(); // short-cut for readHumidity private: uint8_t _address; uint16_t readData(uint8_t pointer); }; #endif