Sens'it SDK  v2.0.0
hts221.h
Go to the documentation of this file.
1 /*!******************************************************************
2  * \file hts221.h
3  * \brief Temperature & Humidity sensor
4  * \author Sens'it Team
5  * \copyright Copyright (c) 2018 Sigfox, All Rights Reserved.
6  *
7  * This file provide sample code to use Temperature & Relative Humidity
8  * sensor (ref: HTS221).<BR>
9  * If you want to use other functionalities of the sensor, please refer
10  * to the datasheet:
11  * www.st.com/resource/en/datasheet/hts221.pdf
12  *******************************************************************/
13 
14 
15 /*!******************************************************************
16  * \defgroup HTS221_REG HTS221 Registers
17  * \brief Address of HTS221 registers
18  *
19  * @{
20  *******************************************************************/
21 #define HTS221_WHO_AM_I 0x0F
22 #define HTS221_AV_CONF 0x10
23 #define HTS221_CTRL_REG1 0x20
24 #define HTS221_CTRL_REG2 0x21
25 #define HTS221_CTRL_REG3 0x22
26 #define HTS221_STATUS_REG 0x27
27 #define HTS221_HUMIDITY_OUT_L 0x28
28 #define HTS221_HUMIDITY_OUT_H 0x29
29 #define HTS221_TEMP_OUT_L 0x2A
30 #define HTS221_TEMP_OUT_H 0x2B
31 #define HTS221_CALIBRATION 0x30
35 /*!******************************************************************
36  * \defgroup HTS221_ERR_CODES HTS221 Error Codes
37  * \brief Error code definitions for HTS221
38  *
39  * @{
40  *******************************************************************/
41 #define HTS221_ERR_NONE 0x00
43 #define HTS221_ERR_I2C 0x30
44 #define HTS221_ERR_ID 0x31
45 #define HTS221_ERR_MEASURE_TIMEOUT 0x32
49 /*!******************************************************************
50  * \defgroup HTS221_API HTS221 APIs
51  * \brief Temperature & Relative humidity sensor sample code functions
52  *
53  * @{
54  *******************************************************************/
55 
56 /*!******************************************************************
57  * \fn error_t HTS221_init(void)
58  * \brief Get calibration values & configure sensor in one-shot measurement.
59  *
60  * \retval HTS221_ERR_NONE: No error
61  * \retval HTS221_ERR_I2C: Error on I2C communication
62  * \retval HTS221_ERR_ID: Bad ID value
63  *******************************************************************/
64 error_t HTS221_init(void);
65 
66 /*!******************************************************************
67  * \fn error_t HTS221_measure(s16* temperature, u16* humidity)
68  * \brief Do a measurement of temperature & relative humidity.
69  *
70  * \retval HTS221_ERR_NONE: No error
71  * \retval HTS221_ERR_I2C: Error on I2C communication
72  * \retval HTS221_ERR_MEASURE_TIMEOUT: Error, measurement is too long
73  *******************************************************************/
74 error_t HTS221_measure(s16* temperature,
75  u16* humidity);
76 
error_t HTS221_init(void)
Get calibration values & configure sensor in one-shot measurement.
unsigned short u16
Definition: sensit_types.h:12
signed short s16
Definition: sensit_types.h:16
error_t HTS221_measure(s16 *temperature, u16 *humidity)
Do a measurement of temperature & relative humidity.
unsigned char error_t
Definition: sensit_types.h:23