Environmental_Shield_F4_API

Dependencies:   mbed

Fork of Environmental_sheild_F4 by Sumit Johar

Committer:
manoj123
Date:
Tue Jul 08 10:58:41 2014 +0000
Revision:
0:c3c9b1c8e3cb
Environmental_Sheild with Temperature, Humidity and Pressure Sensors

Who changed what in which revision?

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