Environmental Shield API

Committer:
Deepti
Date:
Tue Aug 19 07:13:15 2014 +0000
Revision:
0:9e645e6ed2ce
Environment Shield API

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Deepti 0:9e645e6ed2ce 1 /**
Deepti 0:9e645e6ed2ce 2 ******************************************************************************
Deepti 0:9e645e6ed2ce 3 * @file hts221.h
Deepti 0:9e645e6ed2ce 4 * @author AST Robotics Team
Deepti 0:9e645e6ed2ce 5 * @version V0.0.1
Deepti 0:9e645e6ed2ce 6 * @date 08-April-2014
Deepti 0:9e645e6ed2ce 7 * @brief This file contains definitions hts221.h
Deepti 0:9e645e6ed2ce 8 * firmware driver.
Deepti 0:9e645e6ed2ce 9 ******************************************************************************
Deepti 0:9e645e6ed2ce 10 * @attention
Deepti 0:9e645e6ed2ce 11 *
Deepti 0:9e645e6ed2ce 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
Deepti 0:9e645e6ed2ce 13 *
Deepti 0:9e645e6ed2ce 14 * Redistribution and use in source and binary forms, with or without modification,
Deepti 0:9e645e6ed2ce 15 * are permitted provided that the following conditions are met:
Deepti 0:9e645e6ed2ce 16 * 1. Redistributions of source code must retain the above copyright notice,
Deepti 0:9e645e6ed2ce 17 * this list of conditions and the following disclaimer.
Deepti 0:9e645e6ed2ce 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
Deepti 0:9e645e6ed2ce 19 * this list of conditions and the following disclaimer in the documentation
Deepti 0:9e645e6ed2ce 20 * and/or other materials provided with the distribution.
Deepti 0:9e645e6ed2ce 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Deepti 0:9e645e6ed2ce 22 * may be used to endorse or promote products derived from this software
Deepti 0:9e645e6ed2ce 23 * without specific prior written permission.
Deepti 0:9e645e6ed2ce 24 *
Deepti 0:9e645e6ed2ce 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Deepti 0:9e645e6ed2ce 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Deepti 0:9e645e6ed2ce 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Deepti 0:9e645e6ed2ce 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Deepti 0:9e645e6ed2ce 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Deepti 0:9e645e6ed2ce 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Deepti 0:9e645e6ed2ce 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Deepti 0:9e645e6ed2ce 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Deepti 0:9e645e6ed2ce 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Deepti 0:9e645e6ed2ce 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Deepti 0:9e645e6ed2ce 35 *
Deepti 0:9e645e6ed2ce 36 ******************************************************************************
Deepti 0:9e645e6ed2ce 37 */
Deepti 0:9e645e6ed2ce 38
Deepti 0:9e645e6ed2ce 39
Deepti 0:9e645e6ed2ce 40 /* Define to prevent recursive inclusion -------------------------------------*/
Deepti 0:9e645e6ed2ce 41 #ifndef __HTS221_H
Deepti 0:9e645e6ed2ce 42 #define __HTS221_H
Deepti 0:9e645e6ed2ce 43
Deepti 0:9e645e6ed2ce 44 #ifdef __cplusplus
Deepti 0:9e645e6ed2ce 45 extern "C" {
Deepti 0:9e645e6ed2ce 46 #endif
Deepti 0:9e645e6ed2ce 47
Deepti 0:9e645e6ed2ce 48 /* Includes ------------------------------------------------------------------*/
Deepti 0:9e645e6ed2ce 49 #include "../Common/hum_temp.h"
Deepti 0:9e645e6ed2ce 50
Deepti 0:9e645e6ed2ce 51 /** @addtogroup BSP
Deepti 0:9e645e6ed2ce 52 * @{
Deepti 0:9e645e6ed2ce 53 */
Deepti 0:9e645e6ed2ce 54
Deepti 0:9e645e6ed2ce 55 /** @addtogroup HTS221
Deepti 0:9e645e6ed2ce 56 * @{
Deepti 0:9e645e6ed2ce 57 */
Deepti 0:9e645e6ed2ce 58
Deepti 0:9e645e6ed2ce 59 /** @defgroup HTS221_Exported_Constants
Deepti 0:9e645e6ed2ce 60 * @{
Deepti 0:9e645e6ed2ce 61 */
Deepti 0:9e645e6ed2ce 62
Deepti 0:9e645e6ed2ce 63 /**
Deepti 0:9e645e6ed2ce 64 * @brief Device Address
Deepti 0:9e645e6ed2ce 65 */
Deepti 0:9e645e6ed2ce 66 #define HTS221_ADDRESS 0xBE
Deepti 0:9e645e6ed2ce 67
Deepti 0:9e645e6ed2ce 68 /******************************************************************************/
Deepti 0:9e645e6ed2ce 69 /*************************** START REGISTER MAPPING **************************/
Deepti 0:9e645e6ed2ce 70 /******************************************************************************/
Deepti 0:9e645e6ed2ce 71
Deepti 0:9e645e6ed2ce 72
Deepti 0:9e645e6ed2ce 73 /**
Deepti 0:9e645e6ed2ce 74 * @brief Device identification register.
Deepti 0:9e645e6ed2ce 75 * \code
Deepti 0:9e645e6ed2ce 76 * Read
Deepti 0:9e645e6ed2ce 77 * Default value: 0xBC
Deepti 0:9e645e6ed2ce 78 * 7:0 This read-only register contains the device identifier that, for HTS221, is set to BCh.
Deepti 0:9e645e6ed2ce 79 * \endcode
Deepti 0:9e645e6ed2ce 80 */
Deepti 0:9e645e6ed2ce 81 #define HTS221_WHO_AM_I_ADDR 0x0F
Deepti 0:9e645e6ed2ce 82
Deepti 0:9e645e6ed2ce 83
Deepti 0:9e645e6ed2ce 84 /**
Deepti 0:9e645e6ed2ce 85 * @brief Humidity resolution Register
Deepti 0:9e645e6ed2ce 86 * \code
Deepti 0:9e645e6ed2ce 87 * Read/write
Deepti 0:9e645e6ed2ce 88 * Default value: 0x1B
Deepti 0:9e645e6ed2ce 89 * 7:6 RFU
Deepti 0:9e645e6ed2ce 90 * 5:3 AVGT2-AVGT0: Temperature internal average.
Deepti 0:9e645e6ed2ce 91 * AVGT2 | AVGT1 | AVGT0 | Nr. Internal Average
Deepti 0:9e645e6ed2ce 92 * ------------------------------------------------------
Deepti 0:9e645e6ed2ce 93 * 0 | 0 | 0 | 2
Deepti 0:9e645e6ed2ce 94 * 0 | 0 | 1 | 4
Deepti 0:9e645e6ed2ce 95 * 0 | 1 | 0 | 8
Deepti 0:9e645e6ed2ce 96 * 0 | 1 | 1 | 16
Deepti 0:9e645e6ed2ce 97 * 1 | 0 | 0 | 32
Deepti 0:9e645e6ed2ce 98 * 1 | 0 | 1 | 64
Deepti 0:9e645e6ed2ce 99 * 1 | 1 | 0 | 128
Deepti 0:9e645e6ed2ce 100 * 1 | 1 | 1 | 256
Deepti 0:9e645e6ed2ce 101 *
Deepti 0:9e645e6ed2ce 102 * 2:0 AVGH2-AVGH0: Humidity internal average.
Deepti 0:9e645e6ed2ce 103 * AVGH2 | AVGH1 | AVGH0 | Nr. Internal Average
Deepti 0:9e645e6ed2ce 104 * ------------------------------------------------------
Deepti 0:9e645e6ed2ce 105 * 0 | 0 | 0 | 4
Deepti 0:9e645e6ed2ce 106 * 0 | 0 | 1 | 8
Deepti 0:9e645e6ed2ce 107 * 0 | 1 | 0 | 16
Deepti 0:9e645e6ed2ce 108 * 0 | 1 | 1 | 32
Deepti 0:9e645e6ed2ce 109 * 1 | 0 | 0 | 64
Deepti 0:9e645e6ed2ce 110 * 1 | 0 | 1 | 128
Deepti 0:9e645e6ed2ce 111 * 1 | 1 | 0 | 256
Deepti 0:9e645e6ed2ce 112 * 1 | 1 | 1 | 512
Deepti 0:9e645e6ed2ce 113 *
Deepti 0:9e645e6ed2ce 114 * \endcode
Deepti 0:9e645e6ed2ce 115 */
Deepti 0:9e645e6ed2ce 116 #define HTS221_RES_CONF_ADDR 0x10
Deepti 0:9e645e6ed2ce 117
Deepti 0:9e645e6ed2ce 118
Deepti 0:9e645e6ed2ce 119 /**
Deepti 0:9e645e6ed2ce 120 * @brief INFO Register (LSB data)
Deepti 0:9e645e6ed2ce 121 * \code
Deepti 0:9e645e6ed2ce 122 * Read/write
Deepti 0:9e645e6ed2ce 123 * Default value: 0x00
Deepti 0:9e645e6ed2ce 124 * 7:0 INFO7-INFO0: Lower part of the INFO reference
Deepti 0:9e645e6ed2ce 125 * used for traceability of the sample.
Deepti 0:9e645e6ed2ce 126 * \endcode
Deepti 0:9e645e6ed2ce 127 */
Deepti 0:9e645e6ed2ce 128 #define HTS221_INFO_L_ADDR 0x1E
Deepti 0:9e645e6ed2ce 129
Deepti 0:9e645e6ed2ce 130
Deepti 0:9e645e6ed2ce 131 /**
Deepti 0:9e645e6ed2ce 132 * @brief INFO & Calibration Version Register (LSB data)
Deepti 0:9e645e6ed2ce 133 * \code
Deepti 0:9e645e6ed2ce 134 * Read/write
Deepti 0:9e645e6ed2ce 135 * Default value: 0x00
Deepti 0:9e645e6ed2ce 136 * 7:6 CALVER1:CALVER0
Deepti 0:9e645e6ed2ce 137 * 5:0 INFO13-INFO8: Higher part of the INFO reference
Deepti 0:9e645e6ed2ce 138 * used for traceability of the sample.
Deepti 0:9e645e6ed2ce 139 * \endcode
Deepti 0:9e645e6ed2ce 140 */
Deepti 0:9e645e6ed2ce 141 #define HTS221_INFO_H_ADDR 0x1F
Deepti 0:9e645e6ed2ce 142
Deepti 0:9e645e6ed2ce 143
Deepti 0:9e645e6ed2ce 144 /**
Deepti 0:9e645e6ed2ce 145 * @brief Humidity sensor control register 1
Deepti 0:9e645e6ed2ce 146 * \code
Deepti 0:9e645e6ed2ce 147 * Read/write
Deepti 0:9e645e6ed2ce 148 * Default value: 0x00
Deepti 0:9e645e6ed2ce 149 * 7 PD: power down control. 0 - disable; 1 - enable
Deepti 0:9e645e6ed2ce 150 * 6:3 RFU
Deepti 0:9e645e6ed2ce 151 * 2 BDU: block data update. 0 - disable; 1 - enable
Deepti 0:9e645e6ed2ce 152 * 1:0 RFU
Deepti 0:9e645e6ed2ce 153 * \endcode
Deepti 0:9e645e6ed2ce 154 */
Deepti 0:9e645e6ed2ce 155
Deepti 0:9e645e6ed2ce 156 #define HTS221_CTRL_REG1_ADDR 0x20
Deepti 0:9e645e6ed2ce 157
Deepti 0:9e645e6ed2ce 158
Deepti 0:9e645e6ed2ce 159 /**
Deepti 0:9e645e6ed2ce 160 * @brief Humidity sensor control register 2
Deepti 0:9e645e6ed2ce 161 * \code
Deepti 0:9e645e6ed2ce 162 * Read/write
Deepti 0:9e645e6ed2ce 163 * Default value: 0x00
Deepti 0:9e645e6ed2ce 164 * 7 BOOT: Reboot memory content. 0: normal mode; 1: reboot memory content
Deepti 0:9e645e6ed2ce 165 * 6:3 Reserved.
Deepti 0:9e645e6ed2ce 166 * 2 Reserved.
Deepti 0:9e645e6ed2ce 167 * 1 Reserved.
Deepti 0:9e645e6ed2ce 168 * 0 ONE_SHOT: One shot enable. 0: waiting for start of conversion; 1: start for a new dataset
Deepti 0:9e645e6ed2ce 169 * \endcode
Deepti 0:9e645e6ed2ce 170 */
Deepti 0:9e645e6ed2ce 171 #define HTS221_CTRL_REG2_ADDR 0x21
Deepti 0:9e645e6ed2ce 172
Deepti 0:9e645e6ed2ce 173
Deepti 0:9e645e6ed2ce 174 /**
Deepti 0:9e645e6ed2ce 175 * @brief Status Register
Deepti 0:9e645e6ed2ce 176 * \code
Deepti 0:9e645e6ed2ce 177 * Read
Deepti 0:9e645e6ed2ce 178 * Default value: 0x00
Deepti 0:9e645e6ed2ce 179 * 7:2 RFU
Deepti 0:9e645e6ed2ce 180 * 1 H_DA: Humidity data available. 0: new data for Humidity is not yet available; 1: new data for Humidity is available.
Deepti 0:9e645e6ed2ce 181 * 0 T_DA: Temperature data available. 0: new data for temperature is not yet available; 1: new data for temperature is available.
Deepti 0:9e645e6ed2ce 182 * \endcode
Deepti 0:9e645e6ed2ce 183 */
Deepti 0:9e645e6ed2ce 184 #define HTS221_STATUS_REG_ADDR 0x27
Deepti 0:9e645e6ed2ce 185
Deepti 0:9e645e6ed2ce 186
Deepti 0:9e645e6ed2ce 187 /**
Deepti 0:9e645e6ed2ce 188 * @brief Humidity data (LSB).
Deepti 0:9e645e6ed2ce 189 * \code
Deepti 0:9e645e6ed2ce 190 * Read
Deepti 0:9e645e6ed2ce 191 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 192 * POUT7 - POUT0: Humidity data LSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 193 * RAW Humidity output data: Hout(%)=(HUMIDITY_OUT_H & HUMIDITY_OUT_L).
Deepti 0:9e645e6ed2ce 194 * \endcode
Deepti 0:9e645e6ed2ce 195 */
Deepti 0:9e645e6ed2ce 196 #define HTS221_HUMIDITY_OUT_L_ADDR 0x28
Deepti 0:9e645e6ed2ce 197
Deepti 0:9e645e6ed2ce 198
Deepti 0:9e645e6ed2ce 199 /**
Deepti 0:9e645e6ed2ce 200 * @brief Humidity data (MSB).
Deepti 0:9e645e6ed2ce 201 * \code
Deepti 0:9e645e6ed2ce 202 * Read
Deepti 0:9e645e6ed2ce 203 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 204 * POUT7 - POUT0: Humidity data LSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 205 * RAW Humidity output data: Hout(%)=(HUMIDITY_OUT_H & HUMIDITY_OUT_L).
Deepti 0:9e645e6ed2ce 206 * \endcode
Deepti 0:9e645e6ed2ce 207 */
Deepti 0:9e645e6ed2ce 208 #define HTS221_HUMIDITY_OUT_H_ADDR 0x29
Deepti 0:9e645e6ed2ce 209
Deepti 0:9e645e6ed2ce 210
Deepti 0:9e645e6ed2ce 211 /**
Deepti 0:9e645e6ed2ce 212 * @brief Temperature data (LSB).
Deepti 0:9e645e6ed2ce 213 * \code
Deepti 0:9e645e6ed2ce 214 * Read
Deepti 0:9e645e6ed2ce 215 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 216 * TOUT7 - TOUT0: temperature data LSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 217 * RAW Temperature output data: Tout (LSB)=(TEMP_OUT_H & TEMP_OUT_L).
Deepti 0:9e645e6ed2ce 218 * \endcode
Deepti 0:9e645e6ed2ce 219 */
Deepti 0:9e645e6ed2ce 220 #define HTS221_TEMP_OUT_L_ADDR 0x2A
Deepti 0:9e645e6ed2ce 221
Deepti 0:9e645e6ed2ce 222
Deepti 0:9e645e6ed2ce 223 /**
Deepti 0:9e645e6ed2ce 224 * @brief Temperature data (MSB).
Deepti 0:9e645e6ed2ce 225 * \code
Deepti 0:9e645e6ed2ce 226 * Read
Deepti 0:9e645e6ed2ce 227 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 228 * TOUT15 - TOUT8: temperature data MSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 229 * RAW Temperature output data: Tout (LSB)=(TEMP_OUT_H & TEMP_OUT_L).
Deepti 0:9e645e6ed2ce 230 * \endcode
Deepti 0:9e645e6ed2ce 231 */
Deepti 0:9e645e6ed2ce 232 #define HTS221_TEMP_OUT_H_ADDR 0x2B
Deepti 0:9e645e6ed2ce 233
Deepti 0:9e645e6ed2ce 234
Deepti 0:9e645e6ed2ce 235 /*
Deepti 0:9e645e6ed2ce 236 *@brief Humidity 0 Register in %RH with sensitivity=2
Deepti 0:9e645e6ed2ce 237 *\code
Deepti 0:9e645e6ed2ce 238 * Read
Deepti 0:9e645e6ed2ce 239 * Value: (Unsigned 8 Bit)/2
Deepti 0:9e645e6ed2ce 240 *\endcode
Deepti 0:9e645e6ed2ce 241 */
Deepti 0:9e645e6ed2ce 242 #define HTS221_H0_RH_X2_ADDR 0x30
Deepti 0:9e645e6ed2ce 243
Deepti 0:9e645e6ed2ce 244
Deepti 0:9e645e6ed2ce 245 /*
Deepti 0:9e645e6ed2ce 246 *@brief Humidity 1 Register in %RH with sensitivity=2
Deepti 0:9e645e6ed2ce 247 *\code
Deepti 0:9e645e6ed2ce 248 * Read
Deepti 0:9e645e6ed2ce 249 * Value: (Unsigned 8 Bit)/2
Deepti 0:9e645e6ed2ce 250 *\endcode
Deepti 0:9e645e6ed2ce 251 */
Deepti 0:9e645e6ed2ce 252 #define HTS221_H1_RH_X2_ADDR 0x31
Deepti 0:9e645e6ed2ce 253
Deepti 0:9e645e6ed2ce 254
Deepti 0:9e645e6ed2ce 255 /*
Deepti 0:9e645e6ed2ce 256 *@brief Temperature 0 Register in deg with sensitivity=8
Deepti 0:9e645e6ed2ce 257 *\code
Deepti 0:9e645e6ed2ce 258 * Read
Deepti 0:9e645e6ed2ce 259 * Value: (Unsigned 16 Bit)/2
Deepti 0:9e645e6ed2ce 260 *\endcode
Deepti 0:9e645e6ed2ce 261 */
Deepti 0:9e645e6ed2ce 262 #define HTS221_T0_degC_X8_ADDR 0x32
Deepti 0:9e645e6ed2ce 263
Deepti 0:9e645e6ed2ce 264
Deepti 0:9e645e6ed2ce 265 /*
Deepti 0:9e645e6ed2ce 266 *@brief Temperature 1 Register in deg with sensitivity=8
Deepti 0:9e645e6ed2ce 267 *\code
Deepti 0:9e645e6ed2ce 268 * Read
Deepti 0:9e645e6ed2ce 269 * Value: (Unsigned 16 Bit)/2
Deepti 0:9e645e6ed2ce 270 *\endcode
Deepti 0:9e645e6ed2ce 271 */
Deepti 0:9e645e6ed2ce 272 #define HTS221_T1_degC_X8_ADDR 0x33
Deepti 0:9e645e6ed2ce 273
Deepti 0:9e645e6ed2ce 274
Deepti 0:9e645e6ed2ce 275 /*
Deepti 0:9e645e6ed2ce 276 *@brief Temperature 1/0 MSB Register in deg with sensitivity=8
Deepti 0:9e645e6ed2ce 277 *\code
Deepti 0:9e645e6ed2ce 278 * Read
Deepti 0:9e645e6ed2ce 279 * Value: (Unsigned 16 Bit)/2
Deepti 0:9e645e6ed2ce 280 * 3:2 T1(9):T1(8) MSB T1_degC_X8 bits
Deepti 0:9e645e6ed2ce 281 * 1:0 T0(9):T0(8) MSB T0_degC_X8 bits
Deepti 0:9e645e6ed2ce 282 *\endcode
Deepti 0:9e645e6ed2ce 283 */
Deepti 0:9e645e6ed2ce 284 #define HTS221_T1_T0_MSB_X8_ADDR 0x35
Deepti 0:9e645e6ed2ce 285
Deepti 0:9e645e6ed2ce 286
Deepti 0:9e645e6ed2ce 287 /*
Deepti 0:9e645e6ed2ce 288 *@brief Humidity LOW CALIBRATION Register
Deepti 0:9e645e6ed2ce 289 *\code
Deepti 0:9e645e6ed2ce 290 * Read
Deepti 0:9e645e6ed2ce 291 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 292 * H0_T0_TOUT7 - H0_T0_TOUT0: HUMIDITY data lSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 293 *\endcode
Deepti 0:9e645e6ed2ce 294 */
Deepti 0:9e645e6ed2ce 295 #define HTS221_H0_T0_OUT_L_ADDR 0x36
Deepti 0:9e645e6ed2ce 296
Deepti 0:9e645e6ed2ce 297
Deepti 0:9e645e6ed2ce 298 /*
Deepti 0:9e645e6ed2ce 299 *@brief Humidity LOW CALIBRATION Register
Deepti 0:9e645e6ed2ce 300 *\code
Deepti 0:9e645e6ed2ce 301 * Read
Deepti 0:9e645e6ed2ce 302 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 303 * H0_T0_TOUT15 - H0_T0_TOUT8: HUMIDITY data mSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 304 *\endcode
Deepti 0:9e645e6ed2ce 305 */
Deepti 0:9e645e6ed2ce 306 #define HTS221_H0_T0_OUT_H_ADDR 0x37
Deepti 0:9e645e6ed2ce 307
Deepti 0:9e645e6ed2ce 308
Deepti 0:9e645e6ed2ce 309 /*
Deepti 0:9e645e6ed2ce 310 *@brief Humidity HIGH CALIBRATION Register
Deepti 0:9e645e6ed2ce 311 *\code
Deepti 0:9e645e6ed2ce 312 * Read
Deepti 0:9e645e6ed2ce 313 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 314 * H1_T0_TOUT7 - H1_T0_TOUT0: HUMIDITY data lSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 315 *\endcode
Deepti 0:9e645e6ed2ce 316 */
Deepti 0:9e645e6ed2ce 317 #define HTS221_H1_T0_OUT_L_ADDR 0x3A
Deepti 0:9e645e6ed2ce 318
Deepti 0:9e645e6ed2ce 319
Deepti 0:9e645e6ed2ce 320 /*
Deepti 0:9e645e6ed2ce 321 *@brief Humidity HIGH CALIBRATION Register
Deepti 0:9e645e6ed2ce 322 *\code
Deepti 0:9e645e6ed2ce 323 * Read
Deepti 0:9e645e6ed2ce 324 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 325 * H1_T0_TOUT15 - H1_T0_TOUT8: HUMIDITY data mSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 326 *\endcode
Deepti 0:9e645e6ed2ce 327 */
Deepti 0:9e645e6ed2ce 328 #define HTS221_H1_T0_OUT_H_ADDR 0x3B
Deepti 0:9e645e6ed2ce 329
Deepti 0:9e645e6ed2ce 330
Deepti 0:9e645e6ed2ce 331 /**
Deepti 0:9e645e6ed2ce 332 * @brief Low Calibration Temperature Register (LSB).
Deepti 0:9e645e6ed2ce 333 * \code
Deepti 0:9e645e6ed2ce 334 * Read
Deepti 0:9e645e6ed2ce 335 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 336 * T0_OUT7 - T0_OUT0: temperature data LSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 337 * RAW LOW Calibration data: T0_OUT (LSB)=(T0_OUT_H & T0_OUT_L).
Deepti 0:9e645e6ed2ce 338 * \endcode
Deepti 0:9e645e6ed2ce 339 */
Deepti 0:9e645e6ed2ce 340 #define HTS221_T0_OUT_L_ADDR 0x3C
Deepti 0:9e645e6ed2ce 341
Deepti 0:9e645e6ed2ce 342
Deepti 0:9e645e6ed2ce 343 /**
Deepti 0:9e645e6ed2ce 344 * @brief Low Calibration Temperature Register (MSB)
Deepti 0:9e645e6ed2ce 345 * \code
Deepti 0:9e645e6ed2ce 346 * Read
Deepti 0:9e645e6ed2ce 347 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 348 * T0_OUT15 - T0_OUT8: temperature data MSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 349 * RAW LOW Calibration data: T0_OUT (LSB)=(T0_OUT_H & T0_OUT_L).
Deepti 0:9e645e6ed2ce 350 * \endcode
Deepti 0:9e645e6ed2ce 351 */
Deepti 0:9e645e6ed2ce 352 #define HTS221_T0_OUT_H_ADDR 0x3D
Deepti 0:9e645e6ed2ce 353
Deepti 0:9e645e6ed2ce 354
Deepti 0:9e645e6ed2ce 355 /**
Deepti 0:9e645e6ed2ce 356 * @brief Low Calibration Temperature Register (LSB).
Deepti 0:9e645e6ed2ce 357 * \code
Deepti 0:9e645e6ed2ce 358 * Read
Deepti 0:9e645e6ed2ce 359 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 360 * T1_OUT7 - T1_OUT0: temperature data LSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 361 * RAW LOW Calibration data: T1_OUT (LSB)=(T1_OUT_H & T1_OUT_L).
Deepti 0:9e645e6ed2ce 362 * \endcode
Deepti 0:9e645e6ed2ce 363 */
Deepti 0:9e645e6ed2ce 364 #define HTS221_T1_OUT_L_ADDR 0x3E
Deepti 0:9e645e6ed2ce 365
Deepti 0:9e645e6ed2ce 366
Deepti 0:9e645e6ed2ce 367 /**
Deepti 0:9e645e6ed2ce 368 * @brief Low Calibration Temperature Register (MSB)
Deepti 0:9e645e6ed2ce 369 * \code
Deepti 0:9e645e6ed2ce 370 * Read
Deepti 0:9e645e6ed2ce 371 * Default value: 0x00.
Deepti 0:9e645e6ed2ce 372 * T1_OUT15 - T1_OUT8: temperature data MSB (2's complement) => signed 16 bits
Deepti 0:9e645e6ed2ce 373 * RAW LOW Calibration data: T1_OUT (LSB)=(T1_OUT_H & T1_OUT_L).
Deepti 0:9e645e6ed2ce 374 * \endcode
Deepti 0:9e645e6ed2ce 375 */
Deepti 0:9e645e6ed2ce 376 #define HTS221_T1_OUT_H_ADDR 0x3F
Deepti 0:9e645e6ed2ce 377
Deepti 0:9e645e6ed2ce 378
Deepti 0:9e645e6ed2ce 379 /******************************************************************************/
Deepti 0:9e645e6ed2ce 380 /**************************** END REGISTER MAPPING ***************************/
Deepti 0:9e645e6ed2ce 381 /******************************************************************************/
Deepti 0:9e645e6ed2ce 382
Deepti 0:9e645e6ed2ce 383
Deepti 0:9e645e6ed2ce 384 /**
Deepti 0:9e645e6ed2ce 385 * @brief Device Identifier. Default value of the WHO_AM_I register.
Deepti 0:9e645e6ed2ce 386 */
Deepti 0:9e645e6ed2ce 387 #define I_AM_HTS221 ((uint8_t)0xBC)
Deepti 0:9e645e6ed2ce 388
Deepti 0:9e645e6ed2ce 389
Deepti 0:9e645e6ed2ce 390 /** @defgroup HTS221 Power Mode selection - CTRL_REG1
Deepti 0:9e645e6ed2ce 391 * @{
Deepti 0:9e645e6ed2ce 392 */
Deepti 0:9e645e6ed2ce 393 #define HTS221_MODE_POWERDOWN ((uint8_t)0x00)
Deepti 0:9e645e6ed2ce 394 #define HTS221_MODE_ACTIVE ((uint8_t)0x80)
Deepti 0:9e645e6ed2ce 395
Deepti 0:9e645e6ed2ce 396 #define HTS221_MODE_MASK ((uint8_t)0x80)
Deepti 0:9e645e6ed2ce 397 /**
Deepti 0:9e645e6ed2ce 398 * @}
Deepti 0:9e645e6ed2ce 399 */
Deepti 0:9e645e6ed2ce 400
Deepti 0:9e645e6ed2ce 401
Deepti 0:9e645e6ed2ce 402 /** @defgroup HTS221 Block Data Update Mode selection - CTRL_REG1
Deepti 0:9e645e6ed2ce 403 * @{
Deepti 0:9e645e6ed2ce 404 */
Deepti 0:9e645e6ed2ce 405 #define HTS221_BDU_CONTINUOUS ((uint8_t)0x00)
Deepti 0:9e645e6ed2ce 406 #define HTS221_BDU_NOT_UNTIL_READING ((uint8_t)0x04)
Deepti 0:9e645e6ed2ce 407
Deepti 0:9e645e6ed2ce 408 #define HTS221_BDU_MASK ((uint8_t)0x04)
Deepti 0:9e645e6ed2ce 409 /**
Deepti 0:9e645e6ed2ce 410 * @}
Deepti 0:9e645e6ed2ce 411 */
Deepti 0:9e645e6ed2ce 412
Deepti 0:9e645e6ed2ce 413 /** @defgroup HTS221 Output Data Rate selection - CTRL_REG1
Deepti 0:9e645e6ed2ce 414 * @{
Deepti 0:9e645e6ed2ce 415 */
Deepti 0:9e645e6ed2ce 416 #define HTS221_ODR_ONE_SHOT ((uint8_t)0x00) /*!< Output Data Rate: H - one shot, T - one shot */
Deepti 0:9e645e6ed2ce 417 #define HTS221_ODR_1Hz ((uint8_t)0x01) /*!< Output Data Rate: H - 1Hz, T - 1Hz */
Deepti 0:9e645e6ed2ce 418 #define HTS221_ODR_7Hz ((uint8_t)0x02) /*!< Output Data Rate: H - 7Hz, T - 7Hz */
Deepti 0:9e645e6ed2ce 419 #define HTS221_ODR_12_5Hz ((uint8_t)0x03) /*!< Output Data Rate: H - 12.5Hz, T - 12.5Hz */
Deepti 0:9e645e6ed2ce 420
Deepti 0:9e645e6ed2ce 421 #define HTS221_ODR_MASK ((uint8_t)0x03)
Deepti 0:9e645e6ed2ce 422 /**
Deepti 0:9e645e6ed2ce 423 * @}
Deepti 0:9e645e6ed2ce 424 */
Deepti 0:9e645e6ed2ce 425
Deepti 0:9e645e6ed2ce 426
Deepti 0:9e645e6ed2ce 427 /** @defgroup HTS221 Boot Mode selection - CTRL_REG2
Deepti 0:9e645e6ed2ce 428 * @{
Deepti 0:9e645e6ed2ce 429 */
Deepti 0:9e645e6ed2ce 430 #define HTS221_BOOT_NORMALMODE ((uint8_t)0x00)
Deepti 0:9e645e6ed2ce 431 #define HTS221_BOOT_REBOOTMEMORY ((uint8_t)0x80)
Deepti 0:9e645e6ed2ce 432
Deepti 0:9e645e6ed2ce 433 #define HTS221_BOOT_MASK ((uint8_t)0x80)
Deepti 0:9e645e6ed2ce 434 /**
Deepti 0:9e645e6ed2ce 435 * @}
Deepti 0:9e645e6ed2ce 436 */
Deepti 0:9e645e6ed2ce 437
Deepti 0:9e645e6ed2ce 438
Deepti 0:9e645e6ed2ce 439 /** @defgroup HTS221 One Shot selection - CTRL_REG2
Deepti 0:9e645e6ed2ce 440 * @{
Deepti 0:9e645e6ed2ce 441 */
Deepti 0:9e645e6ed2ce 442 #define HTS221_ONE_SHOT_START ((uint8_t)0x01)
Deepti 0:9e645e6ed2ce 443
Deepti 0:9e645e6ed2ce 444 #define HTS221_ONE_SHOT_MASK ((uint8_t)0x01)
Deepti 0:9e645e6ed2ce 445 /**
Deepti 0:9e645e6ed2ce 446 * @}
Deepti 0:9e645e6ed2ce 447 */
Deepti 0:9e645e6ed2ce 448
Deepti 0:9e645e6ed2ce 449
Deepti 0:9e645e6ed2ce 450 /** @defgroup HTS221 Boot Mode selection - CTRL_REG2
Deepti 0:9e645e6ed2ce 451 * @{
Deepti 0:9e645e6ed2ce 452 */
Deepti 0:9e645e6ed2ce 453 #define HTS221_BOOT_NORMALMODE ((uint8_t)0x00)
Deepti 0:9e645e6ed2ce 454 #define HTS221_BOOT_REBOOTMEMORY ((uint8_t)0x80)
Deepti 0:9e645e6ed2ce 455
Deepti 0:9e645e6ed2ce 456 #define HTS221_BOOT_MASK ((uint8_t)0x80)
Deepti 0:9e645e6ed2ce 457 /**
Deepti 0:9e645e6ed2ce 458 * @}
Deepti 0:9e645e6ed2ce 459 */
Deepti 0:9e645e6ed2ce 460
Deepti 0:9e645e6ed2ce 461
Deepti 0:9e645e6ed2ce 462 /** @defgroup HTS221 PushPull_OpenDrain selection - CTRL_REG3
Deepti 0:9e645e6ed2ce 463 * @{
Deepti 0:9e645e6ed2ce 464 */
Deepti 0:9e645e6ed2ce 465 #define HTS221_PP_OD_PUSH_PULL ((uint8_t)0x00)
Deepti 0:9e645e6ed2ce 466 #define HTS221_PP_OD_OPEN_DRAIN ((uint8_t)0x40)
Deepti 0:9e645e6ed2ce 467
Deepti 0:9e645e6ed2ce 468 #define HTS221_PP_OD_MASK ((uint8_t)0x40)
Deepti 0:9e645e6ed2ce 469 /**
Deepti 0:9e645e6ed2ce 470 * @}
Deepti 0:9e645e6ed2ce 471 */
Deepti 0:9e645e6ed2ce 472
Deepti 0:9e645e6ed2ce 473
Deepti 0:9e645e6ed2ce 474 /** @defgroup HTS221 Data ready selection - CTRL_REG3
Deepti 0:9e645e6ed2ce 475 * @{
Deepti 0:9e645e6ed2ce 476 */
Deepti 0:9e645e6ed2ce 477 #define HTS221_DRDY_DISABLE ((uint8_t)0x00)
Deepti 0:9e645e6ed2ce 478 #define HTS221_DRDY_AVAILABLE ((uint8_t)0x40)
Deepti 0:9e645e6ed2ce 479
Deepti 0:9e645e6ed2ce 480 #define HTS221_DRDY_MASK ((uint8_t)0x40)
Deepti 0:9e645e6ed2ce 481 /**
Deepti 0:9e645e6ed2ce 482 * @}
Deepti 0:9e645e6ed2ce 483 */
Deepti 0:9e645e6ed2ce 484
Deepti 0:9e645e6ed2ce 485
Deepti 0:9e645e6ed2ce 486 /** @defgroup HTS221 Humidity resolution selection - RES_CONF
Deepti 0:9e645e6ed2ce 487 * @{
Deepti 0:9e645e6ed2ce 488 */
Deepti 0:9e645e6ed2ce 489 #define HTS221_H_RES_AVG_4 ((uint8_t)0x00)
Deepti 0:9e645e6ed2ce 490 #define HTS221_H_RES_AVG_8 ((uint8_t)0x01)
Deepti 0:9e645e6ed2ce 491 #define HTS221_H_RES_AVG_16 ((uint8_t)0x02)
Deepti 0:9e645e6ed2ce 492 #define HTS221_H_RES_AVG_32 ((uint8_t)0x03)
Deepti 0:9e645e6ed2ce 493 #define HTS221_H_RES_AVG_64 ((uint8_t)0x04)
Deepti 0:9e645e6ed2ce 494 #define HTS221_H_RES_AVG_128 ((uint8_t)0x05)
Deepti 0:9e645e6ed2ce 495
Deepti 0:9e645e6ed2ce 496 #define HTS221_H_RES_MASK ((uint8_t)0x07)
Deepti 0:9e645e6ed2ce 497 /**
Deepti 0:9e645e6ed2ce 498 * @}
Deepti 0:9e645e6ed2ce 499 */
Deepti 0:9e645e6ed2ce 500
Deepti 0:9e645e6ed2ce 501
Deepti 0:9e645e6ed2ce 502 /** @defgroup HTS221 Temperature resolution - RES_CONF
Deepti 0:9e645e6ed2ce 503 * @{
Deepti 0:9e645e6ed2ce 504 */
Deepti 0:9e645e6ed2ce 505 #define HTS221_T_RES_AVG_2 ((uint8_t)0x00)
Deepti 0:9e645e6ed2ce 506 #define HTS221_T_RES_AVG_4 ((uint8_t)0x08)
Deepti 0:9e645e6ed2ce 507 #define HTS221_T_RES_AVG_8 ((uint8_t)0x10)
Deepti 0:9e645e6ed2ce 508 #define HTS221_T_RES_AVG_16 ((uint8_t)0x18)
Deepti 0:9e645e6ed2ce 509 #define HTS221_T_RES_AVG_32 ((uint8_t)0x20)
Deepti 0:9e645e6ed2ce 510 #define HTS221_T_RES_AVG_64 ((uint8_t)0x28)
Deepti 0:9e645e6ed2ce 511
Deepti 0:9e645e6ed2ce 512 #define HTS221_T_RES_MASK ((uint8_t)0x38)
Deepti 0:9e645e6ed2ce 513 /**
Deepti 0:9e645e6ed2ce 514 * @}
Deepti 0:9e645e6ed2ce 515 */
Deepti 0:9e645e6ed2ce 516
Deepti 0:9e645e6ed2ce 517
Deepti 0:9e645e6ed2ce 518 /** @defgroup HTS221 Temperature Humidity data available - STATUS_REG
Deepti 0:9e645e6ed2ce 519 * @{
Deepti 0:9e645e6ed2ce 520 */
Deepti 0:9e645e6ed2ce 521 #define HTS221_H_DATA_AVAILABLE_MASK ((uint8_t)0x02)
Deepti 0:9e645e6ed2ce 522 #define HTS221_T_DATA_AVAILABLE_MASK ((uint8_t)0x01)
Deepti 0:9e645e6ed2ce 523 /**
Deepti 0:9e645e6ed2ce 524 * @}
Deepti 0:9e645e6ed2ce 525 */
Deepti 0:9e645e6ed2ce 526
Deepti 0:9e645e6ed2ce 527
Deepti 0:9e645e6ed2ce 528
Deepti 0:9e645e6ed2ce 529 /* Data resolution */
Deepti 0:9e645e6ed2ce 530 #define HUM_DECIMAL_DIGITS (2)
Deepti 0:9e645e6ed2ce 531 #define TEMP_DECIMAL_DIGITS (2)
Deepti 0:9e645e6ed2ce 532
Deepti 0:9e645e6ed2ce 533
Deepti 0:9e645e6ed2ce 534
Deepti 0:9e645e6ed2ce 535 /**
Deepti 0:9e645e6ed2ce 536 * @}
Deepti 0:9e645e6ed2ce 537 */
Deepti 0:9e645e6ed2ce 538
Deepti 0:9e645e6ed2ce 539
Deepti 0:9e645e6ed2ce 540
Deepti 0:9e645e6ed2ce 541 /** @defgroup UVIS3_Exported_Functions
Deepti 0:9e645e6ed2ce 542 * @{
Deepti 0:9e645e6ed2ce 543 */
Deepti 0:9e645e6ed2ce 544 /* Sensor Configuration Functions */
Deepti 0:9e645e6ed2ce 545 void HTS221_Init(HUM_TEMP_InitTypeDef *HTS221_Init);
Deepti 0:9e645e6ed2ce 546 uint8_t HTS221_ReadID(void);
Deepti 0:9e645e6ed2ce 547 void HTS221_RebootCmd(void);
Deepti 0:9e645e6ed2ce 548 void HTS221_Power_OFF(void);
Deepti 0:9e645e6ed2ce 549 void HTS221_GetHumidity(float* pfData);
Deepti 0:9e645e6ed2ce 550 void HTS221_GetTemperature(float* pfData);
Deepti 0:9e645e6ed2ce 551
Deepti 0:9e645e6ed2ce 552 /* Interrupt Configuration Functions */
Deepti 0:9e645e6ed2ce 553 void HTS221_INT1InterruptConfig(uint16_t Int1Config);
Deepti 0:9e645e6ed2ce 554 void HTS221_EnableIT(uint8_t IntPin);
Deepti 0:9e645e6ed2ce 555 void HTS221_DisableIT(uint8_t IntPin);
Deepti 0:9e645e6ed2ce 556
Deepti 0:9e645e6ed2ce 557 /* HUM_TEMP sensor driver structure */
Deepti 0:9e645e6ed2ce 558 extern HUM_TEMP_DrvTypeDef Hts221Drv;
Deepti 0:9e645e6ed2ce 559
Deepti 0:9e645e6ed2ce 560 /* HUM_TEMP sensor IO functions */
Deepti 0:9e645e6ed2ce 561 void HUM_TEMP_IO_Init(void);
Deepti 0:9e645e6ed2ce 562 void HUM_TEMP_IO_DeInit(void);
Deepti 0:9e645e6ed2ce 563 void HUM_TEMP_IO_Write(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t WriteAddr, uint16_t NumByteToWrite);
Deepti 0:9e645e6ed2ce 564 void HUM_TEMP_IO_Read(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t RegisterAddr, uint16_t NumByteToRead);
Deepti 0:9e645e6ed2ce 565
Deepti 0:9e645e6ed2ce 566 /**
Deepti 0:9e645e6ed2ce 567 * @}
Deepti 0:9e645e6ed2ce 568 */
Deepti 0:9e645e6ed2ce 569
Deepti 0:9e645e6ed2ce 570 /**
Deepti 0:9e645e6ed2ce 571 * @}
Deepti 0:9e645e6ed2ce 572 */
Deepti 0:9e645e6ed2ce 573
Deepti 0:9e645e6ed2ce 574 /**
Deepti 0:9e645e6ed2ce 575 * @}
Deepti 0:9e645e6ed2ce 576 */
Deepti 0:9e645e6ed2ce 577
Deepti 0:9e645e6ed2ce 578 #ifdef __cplusplus
Deepti 0:9e645e6ed2ce 579 }
Deepti 0:9e645e6ed2ce 580 #endif
Deepti 0:9e645e6ed2ce 581
Deepti 0:9e645e6ed2ce 582 #endif /* __HTS221_H */
Deepti 0:9e645e6ed2ce 583
Deepti 0:9e645e6ed2ce 584
Deepti 0:9e645e6ed2ce 585 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Deepti 0:9e645e6ed2ce 586