KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sht21.h
Go to the documentation of this file.
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : sht21.h
11  * Created : 18 jun. 2013
12  * Author : Antonio Orzelli
13  * Modified: Simone Biagi
14  */
15 
16 
17 #ifndef SHT21_H_
18 #define SHT21_H_
19 
20 
21 /**
22  * @file
23  *
24  * @ingroup i2cdrivers
25  *
26  * This driver is to read the SHT21 I2C temperature and humidity sensor.
27  *
28  * Usage:
29  *
30  * @code
31  * int temperature;
32  *
33  * if(sht21StartTempMeas(I2C1, SHT21_I2C_ADDR)){
34  * if(sht21ReadTemp(I2C1, SHT21_I2C_ADDR, &temperature)){
35  * printf("\n\nTemperature: %d.%d C", (temperature/10), (temperature%10));
36  * }
37  * }
38  *
39  * if(errHas()){
40  * errPrint(true);
41  * }
42  *
43  * @endcode
44  *
45  */
46 
47 
48 #include "drv/wb/i2c.h"
49 
50 /**
51  * Starts the temperature measurement in the SHT21 module at I2C address 'addr'.
52  */
53 bool sht21StartTempMeas(I2C_Device * dev, uint8_t addr);
54 
55 /**
56  * Reads the temperatures from SHT21 at I2C address 'addr'; puts the result in answer.
57  */
58 bool sht21ReadTemp(I2C_Device * dev, uint8_t addr, int * answer);
59 
60 /**
61  * Starts and reads the temperatures from SHT21 at I2C address 'addr' (hold master mode); puts the result in answer.
62  */
63 bool sht21Temp(I2C_Device * dev, uint8_t addr, int * answer);
64 
65 
66 /**
67  * Starts the relative humidity measurement in the SHT21 module at I2C address 'addr'.
68  */
69 bool sht21StartHumidMeas(I2C_Device * dev, uint8_t addr);
70 
71 /**
72  * Reads the relative humidity from SHT21 at I2C address 'addr'; puts the result in answer.
73  */
74 bool sht21ReadHumid(I2C_Device * dev, uint8_t addr, int * answer);
75 
76 /**
77  * Starts and reads the relative humidity from SHT21 at I2C address 'addr' (hold master mode); puts the result in answer.
78  */
79 bool sht21Humi(I2C_Device * dev, uint8_t addr, int * answer);
80 
81 #endif /* SHT21_H_ */
bool sht21Humi(I2C_Device *dev, uint8_t addr, int *answer)
Starts and reads the relative humidity from SHT21 at I2C address 'addr' (hold master mode); puts the ...
Definition: sht21.c:139
Structure defines OpenCores I2C Device.
Definition: dev_i2c.h:55
bool sht21Temp(I2C_Device *dev, uint8_t addr, int *answer)
Starts and reads the temperatures from SHT21 at I2C address 'addr' (hold master mode); puts the resul...
Definition: sht21.c:76
bool sht21ReadTemp(I2C_Device *dev, uint8_t addr, int *answer)
Reads the temperatures from SHT21 at I2C address 'addr'; puts the result in answer.
Definition: sht21.c:61
bool sht21ReadHumid(I2C_Device *dev, uint8_t addr, int *answer)
Reads the relative humidity from SHT21 at I2C address 'addr'; puts the result in answer.
Definition: sht21.c:124
bool sht21StartTempMeas(I2C_Device *dev, uint8_t addr)
Starts the temperature measurement in the SHT21 module at I2C address 'addr'.
Definition: sht21.c:37
bool sht21StartHumidMeas(I2C_Device *dev, uint8_t addr)
Starts the relative humidity measurement in the SHT21 module at I2C address 'addr'.
Definition: sht21.c:100
OpenCores I2C device driver.