-
Notifications
You must be signed in to change notification settings - Fork 1
/
si7021.h
38 lines (31 loc) · 986 Bytes
/
si7021.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
* si7021.h - Si7021-A20 driver
*
* Created on: 23/10/2019
* Author: andru
*/
#ifndef SI7021_H_
#define SI7021_H_
// resolutions masks
#define SI7021_RES_RH12_T14 0x00 // 12bit RH, 14bit temperature
#define SI7021_RES_RH8_T12 0x01
#define SI7021_RES_RH10_T13 0x80
#define SI7021_RES_RH11_T11 0x81
// conversation times
#define SI7021_TIME_RH12_T14 23 // conversation time, mS
#define SI7021_TIME_RH8_T12 7 // conversation time, mS
#define SI7021_TIME_RH10_T13 11 // conversation time, mS
#define SI7021_TIME_RH11_T11 10 // conversation time, mS
#define SI7021_TIME_PWRUP 25 // power up time (datasheet says max. 25ms)
#define SI7021_TIME_RESET 15 // software reset time (datasheet says 15ms)
typedef enum {
SI7021_OK,
SI7021_TIMEOUT,
SI7021_I2CERROR,
SI7021_VDDS,
SI7021_PARAMERR,
} si7021error_t;
si7021error_t si7021_init(uint8_t res);
void si7021_stop(void);
si7021error_t si7021_read(uint16_t *humidity, int16_t *temperature);
#endif /* SI7021_H_ */