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.
Dependents: temp xj-Nucleo-F303K8-SHT75-TEST
sht75.h
- Committer:
- nimbusgb
- Date:
- 2010-10-27
- Revision:
- 0:f401474a3e96
File content as of revision 0:f401474a3e96:
/* mbed Sensiron SHT7x temperature and humidity sensor library
*
* Sensiron data at http://www.sensirion.com/en/01_humidity_sensors/06_humidity_sensor_sht75.htm
*
* Copyright (c) Ian Molesworth October 2010
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to use
* copy or modify the software for private or non-commercial purposes only.
*
* 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 SHT75_H
#define SHT75_H
#include "mbed.h"
const float C1= -4.0; // for 12 Bit humi
const float C2= +0.0405; // for 12 Bit humi
const float C3= -0.0000028; // for 12 Bit hum
const float TL= -39.61; // 3v 14 bit
const float T1= +0.01; // for 14 Bit @ 5V
const float T2= +0.00008; // for 14 Bit @ 5V
class SHT75
{
public:
/** Create an SHT object connected to the specified Digital pins
*
* @param pclock digital pin to use as clock
* @param pdata digital pin to use as data bus ( bidirectional )
*/
SHT75(PinName pclock, PinName pdata): _clock(pclock), _data(pdata) {};
/** read the temperature ticks value 14 bit resolution
*
* @param int *temp pointer to an integer to hold the tick value
* @returns boolean true if read acknowledges
*/
bool readTempTicks(int* temp);
/** read the humidity ticks value 12 bit resolution
*
* @param int *temp pointer to an integer to hold the tick value
* @returns boolean true if read acknowledges
*/
bool readHumidityTicks(int* temp);
/** start up reset
*
* call to resync or abort current operation.
* worth calling every now and then to make sure your system is not hung.
*/
void reset(void);
void softReset(void);
int readStatus(void);
private:
DigitalInOut _data;
DigitalOut _clock;
void start(void);
int read(char);
bool write(char);
};
#endif