ble

Dependencies:   HC_SR04_Ultrasonic_Library Servo mbed

Fork of FIP_REV1 by Robotique FIP

Committer:
julientiron
Date:
Tue May 19 16:53:44 2015 +0000
Revision:
1:bdbf36f8408d
ddd; ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
julientiron 1:bdbf36f8408d 1 /**
julientiron 1:bdbf36f8408d 2 ******************************************************************************
julientiron 1:bdbf36f8408d 3 * @file lps25h.h
julientiron 1:bdbf36f8408d 4 * @author MEMS Application Team
julientiron 1:bdbf36f8408d 5 * @version V1.0.0
julientiron 1:bdbf36f8408d 6 * @date 30-July-2014
julientiron 1:bdbf36f8408d 7 * @brief This file contains definitions for the lps25h.c
julientiron 1:bdbf36f8408d 8 * firmware driver.
julientiron 1:bdbf36f8408d 9 ******************************************************************************
julientiron 1:bdbf36f8408d 10 * @attention
julientiron 1:bdbf36f8408d 11 *
julientiron 1:bdbf36f8408d 12 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
julientiron 1:bdbf36f8408d 13 *
julientiron 1:bdbf36f8408d 14 * Redistribution and use in source and binary forms, with or without modification,
julientiron 1:bdbf36f8408d 15 * are permitted provided that the following conditions are met:
julientiron 1:bdbf36f8408d 16 * 1. Redistributions of source code must retain the above copyright notice,
julientiron 1:bdbf36f8408d 17 * this list of conditions and the following disclaimer.
julientiron 1:bdbf36f8408d 18 * 2. Redistributions in binary form must reproduce the above copyright notice,
julientiron 1:bdbf36f8408d 19 * this list of conditions and the following disclaimer in the documentation
julientiron 1:bdbf36f8408d 20 * and/or other materials provided with the distribution.
julientiron 1:bdbf36f8408d 21 * 3. Neither the name of STMicroelectronics nor the names of its contributors
julientiron 1:bdbf36f8408d 22 * may be used to endorse or promote products derived from this software
julientiron 1:bdbf36f8408d 23 * without specific prior written permission.
julientiron 1:bdbf36f8408d 24 *
julientiron 1:bdbf36f8408d 25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
julientiron 1:bdbf36f8408d 26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
julientiron 1:bdbf36f8408d 27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
julientiron 1:bdbf36f8408d 28 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
julientiron 1:bdbf36f8408d 29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
julientiron 1:bdbf36f8408d 30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
julientiron 1:bdbf36f8408d 31 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
julientiron 1:bdbf36f8408d 32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
julientiron 1:bdbf36f8408d 33 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
julientiron 1:bdbf36f8408d 34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
julientiron 1:bdbf36f8408d 35 *
julientiron 1:bdbf36f8408d 36 ******************************************************************************
julientiron 1:bdbf36f8408d 37 */
julientiron 1:bdbf36f8408d 38
julientiron 1:bdbf36f8408d 39 /* Define to prevent recursive inclusion -------------------------------------*/
julientiron 1:bdbf36f8408d 40 #ifndef __LPS25H_H
julientiron 1:bdbf36f8408d 41 #define __LPS25H_H
julientiron 1:bdbf36f8408d 42
julientiron 1:bdbf36f8408d 43 #ifdef __cplusplus
julientiron 1:bdbf36f8408d 44 extern "C" {
julientiron 1:bdbf36f8408d 45 #endif
julientiron 1:bdbf36f8408d 46
julientiron 1:bdbf36f8408d 47 /* Includes ------------------------------------------------------------------*/
julientiron 1:bdbf36f8408d 48 #include "pressure.h"
julientiron 1:bdbf36f8408d 49
julientiron 1:bdbf36f8408d 50 /** @addtogroup BSP
julientiron 1:bdbf36f8408d 51 * @{
julientiron 1:bdbf36f8408d 52 */
julientiron 1:bdbf36f8408d 53
julientiron 1:bdbf36f8408d 54 /** @addtogroup LPS25H
julientiron 1:bdbf36f8408d 55 * @{
julientiron 1:bdbf36f8408d 56 */
julientiron 1:bdbf36f8408d 57
julientiron 1:bdbf36f8408d 58 /** @defgroup LPS25H_Exported_Constants
julientiron 1:bdbf36f8408d 59 * @{
julientiron 1:bdbf36f8408d 60 */
julientiron 1:bdbf36f8408d 61
julientiron 1:bdbf36f8408d 62 /******************************************************************************/
julientiron 1:bdbf36f8408d 63 /*************************** START REGISTER MAPPING **************************/
julientiron 1:bdbf36f8408d 64 /******************************************************************************/
julientiron 1:bdbf36f8408d 65
julientiron 1:bdbf36f8408d 66
julientiron 1:bdbf36f8408d 67 /**
julientiron 1:bdbf36f8408d 68 * @brief Reference pressure (LSB data)
julientiron 1:bdbf36f8408d 69 * \code
julientiron 1:bdbf36f8408d 70 * Read/write
julientiron 1:bdbf36f8408d 71 * Default value: 0x00
julientiron 1:bdbf36f8408d 72 * 7:0 REF7-ODR0: Lower part of the reference pressure that
julientiron 1:bdbf36f8408d 73 * is sum to the sensor output pressure.
julientiron 1:bdbf36f8408d 74 * \endcode
julientiron 1:bdbf36f8408d 75 */
julientiron 1:bdbf36f8408d 76 #define LPS25H_REF_P_XL_ADDR 0x08
julientiron 1:bdbf36f8408d 77
julientiron 1:bdbf36f8408d 78 /**
julientiron 1:bdbf36f8408d 79 * @brief Reference pressure (middle part)
julientiron 1:bdbf36f8408d 80 * \code
julientiron 1:bdbf36f8408d 81 * Read/write
julientiron 1:bdbf36f8408d 82 * Default value: 0x00
julientiron 1:bdbf36f8408d 83 * 7:0 REF15-ODR8: Middle part of the reference pressure that
julientiron 1:bdbf36f8408d 84 * is sum to the sensor output pressure.
julientiron 1:bdbf36f8408d 85 * \endcode
julientiron 1:bdbf36f8408d 86 */
julientiron 1:bdbf36f8408d 87 #define LPS25H_REF_P_L_ADDR 0x09
julientiron 1:bdbf36f8408d 88
julientiron 1:bdbf36f8408d 89 /**
julientiron 1:bdbf36f8408d 90 * @brief Reference pressure (MSB part)
julientiron 1:bdbf36f8408d 91 * \code
julientiron 1:bdbf36f8408d 92 * Read/write
julientiron 1:bdbf36f8408d 93 * Default value: 0x00
julientiron 1:bdbf36f8408d 94 * 7:0 REF15-ODR8: Higher part of the reference pressure that
julientiron 1:bdbf36f8408d 95 * is sum to the sensor output pressure.
julientiron 1:bdbf36f8408d 96 * \endcode
julientiron 1:bdbf36f8408d 97 */
julientiron 1:bdbf36f8408d 98 #define LPS25H_REF_P_H_ADDR 0x0A
julientiron 1:bdbf36f8408d 99
julientiron 1:bdbf36f8408d 100 /**
julientiron 1:bdbf36f8408d 101 * @brief Device identifier register.
julientiron 1:bdbf36f8408d 102 * \code
julientiron 1:bdbf36f8408d 103 * Read
julientiron 1:bdbf36f8408d 104 * Default value: 0xBD
julientiron 1:bdbf36f8408d 105 * 7:0 This read-only register contains the device identifier that,
julientiron 1:bdbf36f8408d 106 for LPS25H, is set to 0xCA.
julientiron 1:bdbf36f8408d 107 * \endcode
julientiron 1:bdbf36f8408d 108 */
julientiron 1:bdbf36f8408d 109 #define LPS25H_WHO_AM_I_ADDR 0x0F
julientiron 1:bdbf36f8408d 110
julientiron 1:bdbf36f8408d 111 /**
julientiron 1:bdbf36f8408d 112 * @brief Pressure and temperature resolution mode register.
julientiron 1:bdbf36f8408d 113 * \code
julientiron 1:bdbf36f8408d 114 * Read
julientiron 1:bdbf36f8408d 115 * Default value: 0x05
julientiron 1:bdbf36f8408d 116 * [7:4] Reserved
julientiron 1:bdbf36f8408d 117 * [3:2] AVGP1-0: select the pressure internal average.
julientiron 1:bdbf36f8408d 118 * [1:0] AVGT1-0: select the temperature internal average.
julientiron 1:bdbf36f8408d 119 * \endcode
julientiron 1:bdbf36f8408d 120 */
julientiron 1:bdbf36f8408d 121 #define LPS25H_RES_CONF_ADDR 0x10
julientiron 1:bdbf36f8408d 122
julientiron 1:bdbf36f8408d 123 /**
julientiron 1:bdbf36f8408d 124 * @brief Pressure sensor control register 1
julientiron 1:bdbf36f8408d 125 * \code
julientiron 1:bdbf36f8408d 126 * Read/write
julientiron 1:bdbf36f8408d 127 * Default value: 0x00
julientiron 1:bdbf36f8408d 128 * 7 PD: power down control. 0 - disable; 1 - enable
julientiron 1:bdbf36f8408d 129 * 6:4 ODR2, ODR1, ODR0: output data rate selection.
julientiron 1:bdbf36f8408d 130 * ODR2 | ODR1 | ODR0 | Pressure output data-rate(Hz) | Temperature output data-rate(Hz)
julientiron 1:bdbf36f8408d 131 * ----------------------------------------------------------------------------------
julientiron 1:bdbf36f8408d 132 * 0 | 0 | 0 | one shot | one shot
julientiron 1:bdbf36f8408d 133 * 0 | 0 | 1 | 1 | 1
julientiron 1:bdbf36f8408d 134 * 0 | 1 | 0 | 7 | 7
julientiron 1:bdbf36f8408d 135 * 0 | 1 | 1 | 12.5 | 12.5
julientiron 1:bdbf36f8408d 136 * 1 | 0 | 0 | 25 | 25
julientiron 1:bdbf36f8408d 137 * 1 | 0 | 1 | Reserved | Reserved
julientiron 1:bdbf36f8408d 138 * 1 | 1 | 0 | Reserved | Reserved
julientiron 1:bdbf36f8408d 139 * 1 | 1 | 1 | Reserved | Reserved
julientiron 1:bdbf36f8408d 140 *
julientiron 1:bdbf36f8408d 141 * 3 DIFF_EN: Interrupt circuit. 0 - disable; 1 - enable
julientiron 1:bdbf36f8408d 142 * 2 BDU: block data update. 0 - disable; 1 - enable
julientiron 1:bdbf36f8408d 143 * 1 DELTA_EN: delta pressure. 0 - disable; 1 - enable
julientiron 1:bdbf36f8408d 144 * 1 RESET_AZ: reset AutoZero. 0 - disable; 1 - enable ///////ALE REVIEW
julientiron 1:bdbf36f8408d 145 * 0 SIM: SPI Serial Interface Mode selection. 0 - SPI 4-wire; 1 - SPI 3-wire ///////ALE REVIEW
julientiron 1:bdbf36f8408d 146 * \endcode
julientiron 1:bdbf36f8408d 147 */
julientiron 1:bdbf36f8408d 148 #define LPS25H_CTRL_REG1_ADDR 0x20
julientiron 1:bdbf36f8408d 149
julientiron 1:bdbf36f8408d 150 /**
julientiron 1:bdbf36f8408d 151 * @brief Pressure sensor control register 2
julientiron 1:bdbf36f8408d 152 * \code
julientiron 1:bdbf36f8408d 153 * Read/write
julientiron 1:bdbf36f8408d 154 * Default value: 0x00
julientiron 1:bdbf36f8408d 155 * 7 BOOT: Reboot memory content. 0: normal mode; 1: reboot memory content
julientiron 1:bdbf36f8408d 156 * 6 FIFO_EN: FIFO. 0: disable; 1: enable
julientiron 1:bdbf36f8408d 157 * 5 WTM_EN: FIFO Watermark level use. 0: disable; 1: enable
julientiron 1:bdbf36f8408d 158 * 4:3 Reserved. keep these bits at 0
julientiron 1:bdbf36f8408d 159 * 2 SWRESET: Software reset. 0: normal mode; 1: SW reset.
julientiron 1:bdbf36f8408d 160 * 1 AUTO_ZERO: Autozero enable. 0: normal mode; 1: autozero enable.
julientiron 1:bdbf36f8408d 161 * 0 ONE_SHOT: One shot enable. 0: waiting for start of conversion; 1: start for a new dataset
julientiron 1:bdbf36f8408d 162 * \endcode
julientiron 1:bdbf36f8408d 163 */
julientiron 1:bdbf36f8408d 164 #define LPS25H_CTRL_REG2_ADDR 0x21
julientiron 1:bdbf36f8408d 165
julientiron 1:bdbf36f8408d 166 /**
julientiron 1:bdbf36f8408d 167 * @brief Pressure sensor control register 3
julientiron 1:bdbf36f8408d 168 * \code
julientiron 1:bdbf36f8408d 169 * Read/write
julientiron 1:bdbf36f8408d 170 * Default value: 0x00
julientiron 1:bdbf36f8408d 171 * 7 INT_H_L: Interrupt. 0:active high; 1: active low.
julientiron 1:bdbf36f8408d 172 * 6 PP_OD: Push-Pull/OpenDrain selection on interrupt pads. 0: Push-pull; 1: open drain.
julientiron 1:bdbf36f8408d 173 * 5 Reserved
julientiron 1:bdbf36f8408d 174 * 4:3 INT2_S2, INT2_S1: INT2 output signal selection control bits. // TO DO
julientiron 1:bdbf36f8408d 175 * 1:0 INT1_S2, INT1_S1: data signal on INT1 pad control bits.
julientiron 1:bdbf36f8408d 176 * INT1(2)_S2 | INT1(2)_S1 | INT1(2) pin
julientiron 1:bdbf36f8408d 177 * ------------------------------------------------------
julientiron 1:bdbf36f8408d 178 * 0 | 0 | Data signal
julientiron 1:bdbf36f8408d 179 * 0 | 1 | Pressure high (P_high)
julientiron 1:bdbf36f8408d 180 * 1 | 0 | Pressure low (P_low)
julientiron 1:bdbf36f8408d 181 * 1 | 1 | P_low OR P_high
julientiron 1:bdbf36f8408d 182
julientiron 1:bdbf36f8408d 183
julientiron 1:bdbf36f8408d 184 * \endcode
julientiron 1:bdbf36f8408d 185 */
julientiron 1:bdbf36f8408d 186 #define LPS25H_CTRL_REG3_ADDR 0x22
julientiron 1:bdbf36f8408d 187
julientiron 1:bdbf36f8408d 188 /**
julientiron 1:bdbf36f8408d 189 * @brief Pressure sensor control register 4
julientiron 1:bdbf36f8408d 190 * \code
julientiron 1:bdbf36f8408d 191 * Read/write
julientiron 1:bdbf36f8408d 192 * Default value: 0x00
julientiron 1:bdbf36f8408d 193 * 7 P2_EMPTY: Empty Signal on INT2 pin.
julientiron 1:bdbf36f8408d 194 * 6 P2_WTM: Watermark Signal on INT2 pin.
julientiron 1:bdbf36f8408d 195 * 5 P2_Overrun:Overrun Signal on INT2 pin.
julientiron 1:bdbf36f8408d 196 * 4 P2_DRDY: Data Ready Signal on INT2 pin.
julientiron 1:bdbf36f8408d 197 * 3 P1_EMPTY: Empty Signal on INT1 pin.
julientiron 1:bdbf36f8408d 198 * 2 P1_WTM: Watermark Signal on INT1 pin.
julientiron 1:bdbf36f8408d 199 * 1 P1_Overrunn:Overrun Signal on INT1 pin.
julientiron 1:bdbf36f8408d 200 * 0 P1_DRDY: Data Ready Signal on INT1 pin.
julientiron 1:bdbf36f8408d 201 * \endcode
julientiron 1:bdbf36f8408d 202 */
julientiron 1:bdbf36f8408d 203 #define LPS25H_CTRL_REG4_ADDR 0x23
julientiron 1:bdbf36f8408d 204
julientiron 1:bdbf36f8408d 205 /**
julientiron 1:bdbf36f8408d 206 * @brief Interrupt configuration Register
julientiron 1:bdbf36f8408d 207 * \code
julientiron 1:bdbf36f8408d 208 * Read/write
julientiron 1:bdbf36f8408d 209 * Default value: 0x00.
julientiron 1:bdbf36f8408d 210 * 7:3 Reserved.
julientiron 1:bdbf36f8408d 211 * 2 LIR: Latch Interrupt request into INT_SOURCE register. 0 - disable; 1 - enable
julientiron 1:bdbf36f8408d 212 * 1 PL_E: Enable interrupt generation on differential pressure low event. 0 - disable; 1 - enable
julientiron 1:bdbf36f8408d 213 * 0 PH_E: Enable interrupt generation on differential pressure high event. 0 - disable; 1 - enable
julientiron 1:bdbf36f8408d 214 * \endcode
julientiron 1:bdbf36f8408d 215 */
julientiron 1:bdbf36f8408d 216 #define LPS25H_INT_CFG_REG_ADDR 0x24
julientiron 1:bdbf36f8408d 217
julientiron 1:bdbf36f8408d 218 /**
julientiron 1:bdbf36f8408d 219 * @brief Interrupt source Register
julientiron 1:bdbf36f8408d 220 * \code
julientiron 1:bdbf36f8408d 221 * Read
julientiron 1:bdbf36f8408d 222 * Default value: 0x00.
julientiron 1:bdbf36f8408d 223 * 7:3 0.
julientiron 1:bdbf36f8408d 224 * 2 IA: Interrupt Active.0: no interrupt has been generated; 1: one or more interrupt events have been generated.
julientiron 1:bdbf36f8408d 225 * 1 PL: Differential pressure Low. 0: no interrupt has been generated; 1: Low differential pressure event has occurred.
julientiron 1:bdbf36f8408d 226 * 0 PH: Differential pressure High. 0: no interrupt has been generated; 1: High differential pressure event has occurred.
julientiron 1:bdbf36f8408d 227 * \endcode
julientiron 1:bdbf36f8408d 228 */
julientiron 1:bdbf36f8408d 229 #define LPS25H_INT_SOURCE_REG_ADDR 0x25
julientiron 1:bdbf36f8408d 230
julientiron 1:bdbf36f8408d 231 /**
julientiron 1:bdbf36f8408d 232 * @brief Threshold pressure (LSB)
julientiron 1:bdbf36f8408d 233 * \code
julientiron 1:bdbf36f8408d 234 * Read
julientiron 1:bdbf36f8408d 235 * Default value: 0x00.
julientiron 1:bdbf36f8408d 236 * 7:0 THS7-THS0: Low part of threshold value for pressure interrupt
julientiron 1:bdbf36f8408d 237 * generation. The complete threshold value is given by THS_P_H & THS_P_L and is
julientiron 1:bdbf36f8408d 238 * expressed as unsigned number. P_ths(mbar)=(THS_P_H & THS_P_L)[dec]/16.
julientiron 1:bdbf36f8408d 239 * \endcode
julientiron 1:bdbf36f8408d 240 */
julientiron 1:bdbf36f8408d 241 #define LPS25H_THS_P_LOW_REG_ADDR 0x30
julientiron 1:bdbf36f8408d 242
julientiron 1:bdbf36f8408d 243 /**
julientiron 1:bdbf36f8408d 244 * @brief Threshold pressure (MSB)
julientiron 1:bdbf36f8408d 245 * \code
julientiron 1:bdbf36f8408d 246 * Read
julientiron 1:bdbf36f8408d 247 * Default value: 0x00.
julientiron 1:bdbf36f8408d 248 * 7:0 THS15-THS8: High part of threshold value for pressure interrupt
julientiron 1:bdbf36f8408d 249 * generation. The complete threshold value is given by THS_P_H & THS_P_L and is
julientiron 1:bdbf36f8408d 250 * expressed as unsigned number. P_ths(mbar)=(THS_P_H & THS_P_L)[dec]/16.
julientiron 1:bdbf36f8408d 251 * \endcode
julientiron 1:bdbf36f8408d 252 */
julientiron 1:bdbf36f8408d 253 #define LPS25H_THS_P_HIGH_REG_ADDR 0x31
julientiron 1:bdbf36f8408d 254
julientiron 1:bdbf36f8408d 255 /**
julientiron 1:bdbf36f8408d 256 * @brief Status Register
julientiron 1:bdbf36f8408d 257 * \code
julientiron 1:bdbf36f8408d 258 * Read
julientiron 1:bdbf36f8408d 259 * Default value: 0x00
julientiron 1:bdbf36f8408d 260 * 7:6 0
julientiron 1:bdbf36f8408d 261 * 5 P_OR: Pressure data overrun. 0: no overrun has occurred; 1: new data for pressure has overwritten the previous one.
julientiron 1:bdbf36f8408d 262 * 4 T_OR: Temperature data overrun. 0: no overrun has occurred; 1: a new data for temperature has overwritten the previous one.
julientiron 1:bdbf36f8408d 263 * 3:2 0
julientiron 1:bdbf36f8408d 264 * 1 P_DA: Pressure data available. 0: new data for pressure is not yet available; 1: new data for pressure is available.
julientiron 1:bdbf36f8408d 265 * 0 T_DA: Temperature data available. 0: new data for temperature is not yet available; 1: new data for temperature is available.
julientiron 1:bdbf36f8408d 266 * \endcode
julientiron 1:bdbf36f8408d 267 */
julientiron 1:bdbf36f8408d 268 #define LPS25H_STATUS_REG_ADDR 0x27
julientiron 1:bdbf36f8408d 269
julientiron 1:bdbf36f8408d 270 /**
julientiron 1:bdbf36f8408d 271 * @brief Pressure data (LSB).
julientiron 1:bdbf36f8408d 272 * \code
julientiron 1:bdbf36f8408d 273 * Read
julientiron 1:bdbf36f8408d 274 * Default value: 0x00.
julientiron 1:bdbf36f8408d 275 * POUT7 - POUT0: Pressure data LSB (2's complement).
julientiron 1:bdbf36f8408d 276 * Pressure output data: Pout(mbar)=(PRESS_OUT_H & PRESS_OUT_L &
julientiron 1:bdbf36f8408d 277 * PRESS_OUT_XL)[dec]/4096.
julientiron 1:bdbf36f8408d 278 * \endcode
julientiron 1:bdbf36f8408d 279 */
julientiron 1:bdbf36f8408d 280 #define LPS25H_PRESS_POUT_XL_ADDR 0x28
julientiron 1:bdbf36f8408d 281
julientiron 1:bdbf36f8408d 282 /**
julientiron 1:bdbf36f8408d 283 * @brief Pressure data (Middle part).
julientiron 1:bdbf36f8408d 284 * \code
julientiron 1:bdbf36f8408d 285 * Read
julientiron 1:bdbf36f8408d 286 * Default value: 0x80.
julientiron 1:bdbf36f8408d 287 * POUT15 - POUT8: Pressure data middle part (2's complement).
julientiron 1:bdbf36f8408d 288 * Pressure output data: Pout(mbar)=(PRESS_OUT_H & PRESS_OUT_L &
julientiron 1:bdbf36f8408d 289 * PRESS_OUT_XL)[dec]/4096.
julientiron 1:bdbf36f8408d 290 * \endcode
julientiron 1:bdbf36f8408d 291 */
julientiron 1:bdbf36f8408d 292 #define LPS25H_PRESS_OUT_L_ADDR 0x29
julientiron 1:bdbf36f8408d 293
julientiron 1:bdbf36f8408d 294 /**
julientiron 1:bdbf36f8408d 295 * @brief Pressure data (MSB).
julientiron 1:bdbf36f8408d 296 * \code
julientiron 1:bdbf36f8408d 297 * Read
julientiron 1:bdbf36f8408d 298 * Default value: 0x2F.
julientiron 1:bdbf36f8408d 299 * POUT23 - POUT16: Pressure data MSB (2's complement).
julientiron 1:bdbf36f8408d 300 * Pressure output data: Pout(mbar)=(PRESS_OUT_H & PRESS_OUT_L &
julientiron 1:bdbf36f8408d 301 * PRESS_OUT_XL)[dec]/4096.
julientiron 1:bdbf36f8408d 302 * \endcode
julientiron 1:bdbf36f8408d 303 */
julientiron 1:bdbf36f8408d 304 #define LPS25H_PRESS_OUT_H_ADDR 0x2A
julientiron 1:bdbf36f8408d 305
julientiron 1:bdbf36f8408d 306 /**
julientiron 1:bdbf36f8408d 307 * @brief Temperature data (LSB).
julientiron 1:bdbf36f8408d 308 * \code
julientiron 1:bdbf36f8408d 309 * Read
julientiron 1:bdbf36f8408d 310 * Default value: 0x00.
julientiron 1:bdbf36f8408d 311 * TOUT7 - TOUT0: temperature data LSB.
julientiron 1:bdbf36f8408d 312 * T(degC) = 42.5 + (Temp_OUTH & TEMP_OUT_L)[dec]/480.
julientiron 1:bdbf36f8408d 313 * \endcode
julientiron 1:bdbf36f8408d 314 */
julientiron 1:bdbf36f8408d 315 #define LPS25H_TEMP_OUT_L_ADDR 0x2B
julientiron 1:bdbf36f8408d 316
julientiron 1:bdbf36f8408d 317 /**
julientiron 1:bdbf36f8408d 318 * @brief Temperature data (MSB).
julientiron 1:bdbf36f8408d 319 * \code
julientiron 1:bdbf36f8408d 320 * Read
julientiron 1:bdbf36f8408d 321 * Default value: 0x00.
julientiron 1:bdbf36f8408d 322 * TOUT15 - TOUT8: temperature data MSB.
julientiron 1:bdbf36f8408d 323 * T(degC) = 42.5 + (Temp_OUTH & TEMP_OUT_L)[dec]/480.
julientiron 1:bdbf36f8408d 324 * \endcode
julientiron 1:bdbf36f8408d 325 */
julientiron 1:bdbf36f8408d 326 #define LPS25H_TEMP_OUT_H_ADDR 0x2C
julientiron 1:bdbf36f8408d 327
julientiron 1:bdbf36f8408d 328 /**
julientiron 1:bdbf36f8408d 329 * @brief FIFO control register
julientiron 1:bdbf36f8408d 330 * \code
julientiron 1:bdbf36f8408d 331 * Read/write
julientiron 1:bdbf36f8408d 332 * Default value: 0x00
julientiron 1:bdbf36f8408d 333 * 7:5 F_MODE2, F_MODE1, F_MODE0: FIFO mode selection.
julientiron 1:bdbf36f8408d 334 * FM2 | FM1 | FM0 | FIFO MODE
julientiron 1:bdbf36f8408d 335 * ---------------------------------------------------
julientiron 1:bdbf36f8408d 336 * 0 | 0 | 0 | BYPASS MODE
julientiron 1:bdbf36f8408d 337 * 0 | 0 | 1 | FIFO MODE. Stops collecting data when full
julientiron 1:bdbf36f8408d 338 * 0 | 1 | 0 | STREAM MODE: Keep the newest measurements in the FIFO
julientiron 1:bdbf36f8408d 339 * 0 | 1 | 1 | STREAM MODE until trigger deasserted, then change to FIFO MODE
julientiron 1:bdbf36f8408d 340 * 1 | 0 | 0 | BYPASS MODE until trigger deasserted, then STREAM MODE
julientiron 1:bdbf36f8408d 341 * 1 | 0 | 1 | Reserved
julientiron 1:bdbf36f8408d 342 * 1 | 1 | 0 | FIFO_MEAN MODE: Fifo is used to generate a running average filtered pressure
julientiron 1:bdbf36f8408d 343 * 1 | 1 | 1 | BYPASS mode until trigger deasserted, then FIFO MODE
julientiron 1:bdbf36f8408d 344 *
julientiron 1:bdbf36f8408d 345 * 4:0 FIFO Mean Mode Sample size
julientiron 1:bdbf36f8408d 346 * WTM_POINT4 | WTM_POINT4 | WTM_POINT4 | WTM_POINT4 | WTM_POINT4 | Sample Size
julientiron 1:bdbf36f8408d 347 * ----------------------------------------------------------------------------------
julientiron 1:bdbf36f8408d 348 * 0 | 0 | 0 | 0 | 1 | 2
julientiron 1:bdbf36f8408d 349 * 0 | 0 | 0 | 1 | 1 | 4
julientiron 1:bdbf36f8408d 350 * 0 | 0 | 1 | 1 | 1 | 8
julientiron 1:bdbf36f8408d 351 * 0 | 1 | 1 | 1 | 1 | 16
julientiron 1:bdbf36f8408d 352 * 1 | 1 | 1 | 1 | 1 | 32
julientiron 1:bdbf36f8408d 353 * other values operation not guaranteed
julientiron 1:bdbf36f8408d 354 * \endcode
julientiron 1:bdbf36f8408d 355 */
julientiron 1:bdbf36f8408d 356 #define LPS25H_CTRL_FIFO_ADDR 0x2E
julientiron 1:bdbf36f8408d 357
julientiron 1:bdbf36f8408d 358 /**
julientiron 1:bdbf36f8408d 359 * @brief FIFO Status register
julientiron 1:bdbf36f8408d 360 * \code
julientiron 1:bdbf36f8408d 361 * Read/write
julientiron 1:bdbf36f8408d 362 * Default value: 0x00
julientiron 1:bdbf36f8408d 363 * 7 WTM_FIFO: Watermark status. 0:FIFO filling is lower than watermark level; 1: FIFO is equal or higher than watermark level.
julientiron 1:bdbf36f8408d 364 * 6 FULL_FIFO: Overrun bit status. 0 - FIFO not full; 1 -FIFO is full.
julientiron 1:bdbf36f8408d 365 * 5 EMPTY_FIFO: Empty FIFO bit. 0 - FIFO not empty; 1 -FIFO is empty.
julientiron 1:bdbf36f8408d 366 * 4:0 DIFF_POINT4...0: FIFOsStored data level.
julientiron 1:bdbf36f8408d 367 * \endcode
julientiron 1:bdbf36f8408d 368 */
julientiron 1:bdbf36f8408d 369 #define LPS25H_STATUS_FIFO_ADDR 0x2F
julientiron 1:bdbf36f8408d 370
julientiron 1:bdbf36f8408d 371 /**
julientiron 1:bdbf36f8408d 372 * @brief Pressure offset register
julientiron 1:bdbf36f8408d 373 * \code
julientiron 1:bdbf36f8408d 374 * Read/write
julientiron 1:bdbf36f8408d 375 * Default value: 0x00
julientiron 1:bdbf36f8408d 376 * 7:0 RPDS15...8:Pressure Offset for 1 point calibration after soldering.
julientiron 1:bdbf36f8408d 377 * \endcode
julientiron 1:bdbf36f8408d 378 */
julientiron 1:bdbf36f8408d 379 #define LPS25H_RPDS_TRIM_L_ADDR 0x39
julientiron 1:bdbf36f8408d 380
julientiron 1:bdbf36f8408d 381 /**
julientiron 1:bdbf36f8408d 382 * @brief Pressure offset register
julientiron 1:bdbf36f8408d 383 * \code
julientiron 1:bdbf36f8408d 384 * Read/write
julientiron 1:bdbf36f8408d 385 * Default value: 0x00
julientiron 1:bdbf36f8408d 386 * 7:0 RPDS23...16:Pressure Offset for 1 point calibration after soldering.
julientiron 1:bdbf36f8408d 387 * \endcode
julientiron 1:bdbf36f8408d 388 */
julientiron 1:bdbf36f8408d 389 #define LPS25H_RPDS_TRIM_H_ADDR 0x3A
julientiron 1:bdbf36f8408d 390
julientiron 1:bdbf36f8408d 391 /******************************************************************************/
julientiron 1:bdbf36f8408d 392 /**************************** END REGISTER MAPPING ***************************/
julientiron 1:bdbf36f8408d 393 /******************************************************************************/
julientiron 1:bdbf36f8408d 394
julientiron 1:bdbf36f8408d 395 /**
julientiron 1:bdbf36f8408d 396 * @brief Device Address
julientiron 1:bdbf36f8408d 397 */
julientiron 1:bdbf36f8408d 398 #define LPS25H_ADDRESS_LOW 0xB8
julientiron 1:bdbf36f8408d 399 #define LPS25H_ADDRESS_HIGH 0xBA
julientiron 1:bdbf36f8408d 400
julientiron 1:bdbf36f8408d 401
julientiron 1:bdbf36f8408d 402 /**
julientiron 1:bdbf36f8408d 403 * @brief Device Identifier. Default value of the WHO_AM_I register.
julientiron 1:bdbf36f8408d 404 */
julientiron 1:bdbf36f8408d 405 #define I_AM_LPS25H ((uint8_t)0xBD)
julientiron 1:bdbf36f8408d 406
julientiron 1:bdbf36f8408d 407 /** @defgroup Power_Mode_selection CTRL_REG1
julientiron 1:bdbf36f8408d 408 * @{
julientiron 1:bdbf36f8408d 409 */
julientiron 1:bdbf36f8408d 410 #define LPS25H_MODE_POWERDOWN ((uint8_t)0x00)
julientiron 1:bdbf36f8408d 411 #define LPS25H_MODE_ACTIVE ((uint8_t)0x80)
julientiron 1:bdbf36f8408d 412
julientiron 1:bdbf36f8408d 413 #define LPS25H_MODE_MASK ((uint8_t)0x80)
julientiron 1:bdbf36f8408d 414 /**
julientiron 1:bdbf36f8408d 415 * @}
julientiron 1:bdbf36f8408d 416 */
julientiron 1:bdbf36f8408d 417
julientiron 1:bdbf36f8408d 418 /** @defgroup LPS25H Output Data Rate selection CTRL_REG1
julientiron 1:bdbf36f8408d 419 * @{
julientiron 1:bdbf36f8408d 420 */
julientiron 1:bdbf36f8408d 421 #define LPS25H_ODR_ONE_SHOT ((uint8_t)0x00) /*!< Output Data Rate: P - one shot, T - one shot */
julientiron 1:bdbf36f8408d 422 #define LPS25H_ODR_1Hz ((uint8_t)0x10) /*!< Output Data Rate: P - 1Hz, T - 1Hz */
julientiron 1:bdbf36f8408d 423 #define LPS25H_ODR_7Hz ((uint8_t)0x20) /*!< Output Data Rate: P - 7Hz, T - 7Hz */
julientiron 1:bdbf36f8408d 424 #define LPS25H_ODR_12_5Hz ((uint8_t)0x30) /*!< Output Data Rate: P - 12.5Hz, T - 12.5Hz */
julientiron 1:bdbf36f8408d 425 #define LPS25H_ODR_25Hz ((uint8_t)0x40) /*!< Output Data Rate: P - 25Hz, T - 25Hz */
julientiron 1:bdbf36f8408d 426
julientiron 1:bdbf36f8408d 427 #define LPS25H_ODR_MASK ((uint8_t)0x70)
julientiron 1:bdbf36f8408d 428 /**
julientiron 1:bdbf36f8408d 429 * @}
julientiron 1:bdbf36f8408d 430 */
julientiron 1:bdbf36f8408d 431
julientiron 1:bdbf36f8408d 432 /** @defgroup LPS25H Interrupt circuit enable CTRL_REG1
julientiron 1:bdbf36f8408d 433 * @{
julientiron 1:bdbf36f8408d 434 */
julientiron 1:bdbf36f8408d 435 #define LPS25H_DIFF_DISABLE ((uint8_t)0x00) /*!< interrupt circuit enabled */
julientiron 1:bdbf36f8408d 436 #define LPS25H_DIFF_ENABLE ((uint8_t)0x08) /*!< interrupt generation disabled */
julientiron 1:bdbf36f8408d 437
julientiron 1:bdbf36f8408d 438 #define LPS25H_DIFF_EN_MASK ((uint8_t)0x08)
julientiron 1:bdbf36f8408d 439 /**
julientiron 1:bdbf36f8408d 440 * @}
julientiron 1:bdbf36f8408d 441 */
julientiron 1:bdbf36f8408d 442
julientiron 1:bdbf36f8408d 443 /** @defgroup LPS25H block data update CTRL_REG1
julientiron 1:bdbf36f8408d 444 * @{
julientiron 1:bdbf36f8408d 445 */
julientiron 1:bdbf36f8408d 446 #define LPS25H_BDU_CONT ((uint8_t)0x00) /*!< continuous update */
julientiron 1:bdbf36f8408d 447 #define LPS25H_BDU_READ ((uint8_t)0x04) /*!< output registers not updated until MSB and LSB reading */
julientiron 1:bdbf36f8408d 448
julientiron 1:bdbf36f8408d 449 #define LPS25H_BDU_MASK ((uint8_t)0x04)
julientiron 1:bdbf36f8408d 450 /**
julientiron 1:bdbf36f8408d 451 * @}
julientiron 1:bdbf36f8408d 452 */
julientiron 1:bdbf36f8408d 453
julientiron 1:bdbf36f8408d 454 /** @defgroup LPS25H SPI Serial Interface Mode selection CTRL_REG1
julientiron 1:bdbf36f8408d 455 * @{
julientiron 1:bdbf36f8408d 456 */
julientiron 1:bdbf36f8408d 457 #define LPS25H_SPI_SIM_4W ((uint8_t)0x00) /*!< 4-wire interface */
julientiron 1:bdbf36f8408d 458 #define LPS25H_SPI_SIM_3W ((uint8_t)0x01) /*!< 3-wire interface */
julientiron 1:bdbf36f8408d 459
julientiron 1:bdbf36f8408d 460 #define LPS25H_SPI_SIM_MASK ((uint8_t)0x01)
julientiron 1:bdbf36f8408d 461 /**
julientiron 1:bdbf36f8408d 462 * @}
julientiron 1:bdbf36f8408d 463 */
julientiron 1:bdbf36f8408d 464
julientiron 1:bdbf36f8408d 465 /** @defgroup LPS25H o refresh the content of the internal registers stored in the Flash memory
julientiron 1:bdbf36f8408d 466 block CTRL_REG2
julientiron 1:bdbf36f8408d 467 * @{
julientiron 1:bdbf36f8408d 468 */
julientiron 1:bdbf36f8408d 469 #define LPS25H_NORMAL_MODE ((uint8_t)0x00)
julientiron 1:bdbf36f8408d 470 #define LPS25H_RESET_MEMORY ((uint8_t)0x80)
julientiron 1:bdbf36f8408d 471
julientiron 1:bdbf36f8408d 472 #define LPS25H_RESET_MEMORY_MASK ((uint8_t)0x80)
julientiron 1:bdbf36f8408d 473 /**
julientiron 1:bdbf36f8408d 474 * @}
julientiron 1:bdbf36f8408d 475 */
julientiron 1:bdbf36f8408d 476
julientiron 1:bdbf36f8408d 477 /** @defgroup LPS25H Pressure resolution selection RES_CONF
julientiron 1:bdbf36f8408d 478 * @{
julientiron 1:bdbf36f8408d 479 */
julientiron 1:bdbf36f8408d 480 #define LPS25H_P_RES_AVG_8 ((uint8_t)0x00)
julientiron 1:bdbf36f8408d 481 #define LPS25H_P_RES_AVG_32 ((uint8_t)0x01)
julientiron 1:bdbf36f8408d 482 #define LPS25H_P_RES_AVG_128 ((uint8_t)0x02)
julientiron 1:bdbf36f8408d 483 #define LPS25H_P_RES_AVG_512 ((uint8_t)0x03)
julientiron 1:bdbf36f8408d 484
julientiron 1:bdbf36f8408d 485 #define LPS25H_P_RES_MASK ((uint8_t)0x03)
julientiron 1:bdbf36f8408d 486 /**
julientiron 1:bdbf36f8408d 487 * @}
julientiron 1:bdbf36f8408d 488 */
julientiron 1:bdbf36f8408d 489
julientiron 1:bdbf36f8408d 490 /** @defgroup LPS25H Temperature resolution RES_CONF
julientiron 1:bdbf36f8408d 491 * @{
julientiron 1:bdbf36f8408d 492 */
julientiron 1:bdbf36f8408d 493 #define LPS25H_T_RES_AVG_8 ((uint8_t)0x00)
julientiron 1:bdbf36f8408d 494 #define LPS25H_T_RES_AVG_16 ((uint8_t)0x04)
julientiron 1:bdbf36f8408d 495 #define LPS25H_T_RES_AVG_32 ((uint8_t)0x08)
julientiron 1:bdbf36f8408d 496 #define LPS25H_T_RES_AVG_64 ((uint8_t)0x0C)
julientiron 1:bdbf36f8408d 497
julientiron 1:bdbf36f8408d 498 #define LPS25H_T_RES_MASK ((uint8_t)0x0C)
julientiron 1:bdbf36f8408d 499 /**
julientiron 1:bdbf36f8408d 500 * @}
julientiron 1:bdbf36f8408d 501 */
julientiron 1:bdbf36f8408d 502
julientiron 1:bdbf36f8408d 503 #define LPS25H_SA0_LOW ((uint8_t)0x00)
julientiron 1:bdbf36f8408d 504 #define LPS25H_SA0_HIGH ((uint8_t)0x01)
julientiron 1:bdbf36f8408d 505
julientiron 1:bdbf36f8408d 506 /**
julientiron 1:bdbf36f8408d 507 * @}
julientiron 1:bdbf36f8408d 508 */
julientiron 1:bdbf36f8408d 509
julientiron 1:bdbf36f8408d 510 /** @defgroup LPS25H_Exported_Functions
julientiron 1:bdbf36f8408d 511 * @{
julientiron 1:bdbf36f8408d 512 */
julientiron 1:bdbf36f8408d 513 /* Sensor Configuration Functions */
julientiron 1:bdbf36f8408d 514 void LPS25H_Init(PRESSURE_InitTypeDef *LPS25H_Init);
julientiron 1:bdbf36f8408d 515 uint8_t LPS25H_ReadID(void);
julientiron 1:bdbf36f8408d 516 void LPS25H_RebootCmd(void);
julientiron 1:bdbf36f8408d 517 void LPS25H_GetPressure(float* pfData);
julientiron 1:bdbf36f8408d 518 void LPS25H_GetTemperature(float* pfData);
julientiron 1:bdbf36f8408d 519 void LPS25H_PowerOff(void);
julientiron 1:bdbf36f8408d 520 void LPS25H_SlaveAddrRemap(uint8_t);
julientiron 1:bdbf36f8408d 521
julientiron 1:bdbf36f8408d 522 /* Pressure sensor driver structure */
julientiron 1:bdbf36f8408d 523 extern PRESSURE_DrvTypeDef LPS25HDrv;
julientiron 1:bdbf36f8408d 524
julientiron 1:bdbf36f8408d 525 /* Pressure sensor IO functions */
julientiron 1:bdbf36f8408d 526 void PRESSURE_IO_Init(void);
julientiron 1:bdbf36f8408d 527 void PRESSURE_IO_Write(uint8_t* pBuffer, uint8_t DeviceAddr, uint8_t WriteAddr,
julientiron 1:bdbf36f8408d 528 uint16_t NumByteToWrite);
julientiron 1:bdbf36f8408d 529 void PRESSURE_IO_Read(uint8_t* pBuffer, uint8_t DeviceAddr,
julientiron 1:bdbf36f8408d 530 uint8_t RegisterAddr, uint16_t NumByteToRead);
julientiron 1:bdbf36f8408d 531
julientiron 1:bdbf36f8408d 532 /**
julientiron 1:bdbf36f8408d 533 * @}
julientiron 1:bdbf36f8408d 534 */
julientiron 1:bdbf36f8408d 535
julientiron 1:bdbf36f8408d 536 /**
julientiron 1:bdbf36f8408d 537 * @}
julientiron 1:bdbf36f8408d 538 */
julientiron 1:bdbf36f8408d 539
julientiron 1:bdbf36f8408d 540 /**
julientiron 1:bdbf36f8408d 541 * @}
julientiron 1:bdbf36f8408d 542 */
julientiron 1:bdbf36f8408d 543
julientiron 1:bdbf36f8408d 544 #ifdef __cplusplus
julientiron 1:bdbf36f8408d 545 }
julientiron 1:bdbf36f8408d 546 #endif
julientiron 1:bdbf36f8408d 547
julientiron 1:bdbf36f8408d 548 #endif /* __LPS25H_H */
julientiron 1:bdbf36f8408d 549
julientiron 1:bdbf36f8408d 550 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
julientiron 1:bdbf36f8408d 551