sht11.h
Go to the documentation of this file.
1 /*
2  * Copyright 2009, Freie Universitaet Berlin (FUB). All rights reserved.
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
9 #ifndef SHT11_H
10 #define SHT11_H
11 
24 #include <stdint.h>
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 #define SHT11_NO_ACK (0)
31 #define SHT11_ACK (1)
32 /* adr command r/w */
33 #define SHT11_STATUS_REG_W (0x06)
34 #define SHT11_STATUS_REG_R (0x07)
35 #define SHT11_MEASURE_TEMP (0x03)
36 #define SHT11_MEASURE_HUMI (0x05)
37 #define SHT11_RESET (0x1E)
40 #define SHT11_DATA_WAIT (1)
41 
42 #define SHT11_CLK_WAIT (1)
43 
45 #define SHT11_MEASURE_TIMEOUT (1000)
46 
50 typedef struct {
51  float temperature;
52  float relhum;
53  float relhum_temp;
54 } sht11_val_t;
55 
59 typedef enum {
60  TEMPERATURE = 1,
61  HUMIDITY = 2
62 } sht11_mode_t;
63 
67 void sht11_init(void);
68 
82 uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode);
83 
91 uint8_t sht11_write_status(uint8_t *p_value);
92 
101 uint8_t sht11_read_status(uint8_t *p_value, uint8_t *p_checksum);
102 
103 #ifdef __cplusplus
104 }
105 #endif
106 
108 #endif /* SHT11_H */
void sht11_init(void)
Initialize SHT11 ports.
float temperature
temperature value
Definition: sht11.h:51
uint8_t sht11_read_sensor(sht11_val_t *value, sht11_mode_t mode)
Read sensor.
float relhum
linear relative humidity
Definition: sht11.h:52
float relhum_temp
temperature compensated relative humidity
Definition: sht11.h:53
uint8_t sht11_write_status(uint8_t *p_value)
Write status register.
sht11_mode_t
SHT11 modes that can be measured.
Definition: sht11.h:59
sht11 measureable data
Definition: sht11.h:50
uint8_t sht11_read_status(uint8_t *p_value, uint8_t *p_checksum)
Read status register with checksum.