Contains the BSP driver for the B-L475E-IOT01 board.

Dependents:   mbed-os-example-ble-Thermometer DISCO_L475VG_IOT01-Telegram-BOT DISCO_L475VG_IOT01-sche_cheveux DISCO_L475VG_IOT01-QSPI_FLASH_FILE_SYSTEM ... more

https://os.mbed.com/platforms/ST-Discovery-L475E-IOT01A/

Committer:
jeromecoutant
Date:
Tue Sep 24 15:30:09 2019 +0200
Revision:
7:bfe8272ced90
Parent:
4:137bb367ba50
Update BSP files with STM32Cube L4 V1.14.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bcostm 4:137bb367ba50 1 /**
bcostm 4:137bb367ba50 2 ******************************************************************************
bcostm 4:137bb367ba50 3 * @file lps22hb.h
bcostm 4:137bb367ba50 4 * @author MCD Application Team
bcostm 4:137bb367ba50 5 * @brief LPS22HB header driver file
bcostm 4:137bb367ba50 6 ******************************************************************************
bcostm 4:137bb367ba50 7 * @attention
bcostm 4:137bb367ba50 8 *
jeromecoutant 7:bfe8272ced90 9 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
jeromecoutant 7:bfe8272ced90 10 * All rights reserved.</center></h2>
bcostm 4:137bb367ba50 11 *
jeromecoutant 7:bfe8272ced90 12 * This software component is licensed by ST under BSD 3-Clause license,
jeromecoutant 7:bfe8272ced90 13 * the "License"; You may not use this file except in compliance with the
jeromecoutant 7:bfe8272ced90 14 * License. You may obtain a copy of the License at:
jeromecoutant 7:bfe8272ced90 15 * opensource.org/licenses/BSD-3-Clause
bcostm 4:137bb367ba50 16 *
bcostm 4:137bb367ba50 17 ******************************************************************************
bcostm 4:137bb367ba50 18 */
bcostm 4:137bb367ba50 19
bcostm 4:137bb367ba50 20 /* Define to prevent recursive inclusion -------------------------------------*/
bcostm 4:137bb367ba50 21 #ifndef __LPS22HB__H
bcostm 4:137bb367ba50 22 #define __LPS22HB__H
bcostm 4:137bb367ba50 23
bcostm 4:137bb367ba50 24 #ifdef __cplusplus
bcostm 4:137bb367ba50 25 extern "C" {
bcostm 4:137bb367ba50 26 #endif
bcostm 4:137bb367ba50 27
bcostm 4:137bb367ba50 28 /* Includes ------------------------------------------------------------------*/
bcostm 4:137bb367ba50 29 #include "../Common/psensor.h"
bcostm 4:137bb367ba50 30 #include "../Common/tsensor.h"
bcostm 4:137bb367ba50 31
bcostm 4:137bb367ba50 32 /** @addtogroup BSP
bcostm 4:137bb367ba50 33 * @{
bcostm 4:137bb367ba50 34 */
bcostm 4:137bb367ba50 35
bcostm 4:137bb367ba50 36 /** @addtogroup Component
bcostm 4:137bb367ba50 37 * @{
bcostm 4:137bb367ba50 38 */
bcostm 4:137bb367ba50 39
bcostm 4:137bb367ba50 40 /** @addtogroup LPS22HB
bcostm 4:137bb367ba50 41 * @{
bcostm 4:137bb367ba50 42 */
bcostm 4:137bb367ba50 43
bcostm 4:137bb367ba50 44 /** @defgroup LPS22HB_Exported_Macros LPS22HB Exported Macros
bcostm 4:137bb367ba50 45 * @{
bcostm 4:137bb367ba50 46 */
bcostm 4:137bb367ba50 47
bcostm 4:137bb367ba50 48 /**
bcostm 4:137bb367ba50 49 * @brief Bitfield positioning.
bcostm 4:137bb367ba50 50 */
bcostm 4:137bb367ba50 51 #define LPS22HB_BIT(x) ((uint8_t)x)
bcostm 4:137bb367ba50 52 /**
bcostm 4:137bb367ba50 53 * @}
bcostm 4:137bb367ba50 54 */
bcostm 4:137bb367ba50 55
bcostm 4:137bb367ba50 56
bcostm 4:137bb367ba50 57 /** @defgroup LPS22HB_Exported_Constants LPS22HB Exported Constants
bcostm 4:137bb367ba50 58 * @{
bcostm 4:137bb367ba50 59 */
bcostm 4:137bb367ba50 60
bcostm 4:137bb367ba50 61 /**
bcostm 4:137bb367ba50 62 * @brief Device Identification register.
bcostm 4:137bb367ba50 63 * Read
bcostm 4:137bb367ba50 64 * Default value: 0xB1
bcostm 4:137bb367ba50 65 * 7:0 This read-only register contains the device identifier that, for LPS22HB, is set to B1h.
bcostm 4:137bb367ba50 66 */
bcostm 4:137bb367ba50 67
bcostm 4:137bb367ba50 68 #define LPS22HB_WHO_AM_I_REG (uint8_t)0x0F
bcostm 4:137bb367ba50 69
bcostm 4:137bb367ba50 70 /**
bcostm 4:137bb367ba50 71 * @brief Device Identification value.
bcostm 4:137bb367ba50 72 */
bcostm 4:137bb367ba50 73 #define LPS22HB_WHO_AM_I_VAL (uint8_t)0xB1
bcostm 4:137bb367ba50 74
bcostm 4:137bb367ba50 75 /**
bcostm 4:137bb367ba50 76 * @brief Reference Pressure Register(LSB data)
bcostm 4:137bb367ba50 77 * Read/write
bcostm 4:137bb367ba50 78 * Default value: 0x00
bcostm 4:137bb367ba50 79 * 7:0 REFL7-0: Lower part of the reference pressure value that
bcostm 4:137bb367ba50 80 * is sum to the sensor output pressure.
bcostm 4:137bb367ba50 81 */
bcostm 4:137bb367ba50 82 #define LPS22HB_REF_P_XL_REG (uint8_t)0x15
bcostm 4:137bb367ba50 83
bcostm 4:137bb367ba50 84 /**
bcostm 4:137bb367ba50 85 * @brief Reference Pressure Register (Middle data)
bcostm 4:137bb367ba50 86 * Read/write
bcostm 4:137bb367ba50 87 * Default value: 0x00
bcostm 4:137bb367ba50 88 * 7:0 REFL15-8: Middle part of the reference pressure value that
bcostm 4:137bb367ba50 89 * is sum to the sensor output pressure.
bcostm 4:137bb367ba50 90 */
bcostm 4:137bb367ba50 91 #define LPS22HB_REF_P_L_REG (uint8_t)0x16
bcostm 4:137bb367ba50 92
bcostm 4:137bb367ba50 93 /**
bcostm 4:137bb367ba50 94 * @brief Reference Pressure Register (MSB data)
bcostm 4:137bb367ba50 95 * Read/write
bcostm 4:137bb367ba50 96 * Default value: 0x00
bcostm 4:137bb367ba50 97 * 7:0 REFL23-16 Higest part of the reference pressure value that
bcostm 4:137bb367ba50 98 * is sum to the sensor output pressure.
bcostm 4:137bb367ba50 99 */
bcostm 4:137bb367ba50 100 #define LPS22HB_REF_P_H_REG (uint8_t)0x17
bcostm 4:137bb367ba50 101
bcostm 4:137bb367ba50 102 /**
bcostm 4:137bb367ba50 103 * @brief Pressure and temperature resolution mode Register
bcostm 4:137bb367ba50 104 * Read/write
bcostm 4:137bb367ba50 105 * Default value: 0x05
bcostm 4:137bb367ba50 106 * 7:2 These bits must be set to 0 for proper operation of the device
bcostm 4:137bb367ba50 107 * 1: Reserved
bcostm 4:137bb367ba50 108 * 0 LC_EN: Low Current Mode Enable. Default 0
bcostm 4:137bb367ba50 109 */
bcostm 4:137bb367ba50 110 #define LPS22HB_RES_CONF_REG (uint8_t)0x1A
bcostm 4:137bb367ba50 111 #define LPS22HB_LCEN_MASK (uint8_t)0x01
bcostm 4:137bb367ba50 112
bcostm 4:137bb367ba50 113 /**
bcostm 4:137bb367ba50 114 * @brief Control Register 1
bcostm 4:137bb367ba50 115 * Read/write
bcostm 4:137bb367ba50 116 * Default value: 0x00
bcostm 4:137bb367ba50 117 * 7: This bit must be set to 0 for proper operation of the device
bcostm 4:137bb367ba50 118 * 6:4 ODR2, ODR1, ODR0: output data rate selection.Default 000
bcostm 4:137bb367ba50 119 * ODR2 | ODR1 | ODR0 | Pressure output data-rate(Hz) | Pressure output data-rate(Hz)
bcostm 4:137bb367ba50 120 * ----------------------------------------------------------------------------------
bcostm 4:137bb367ba50 121 * 0 | 0 | 0 | one shot | one shot
bcostm 4:137bb367ba50 122 * 0 | 0 | 1 | 1 | 1
bcostm 4:137bb367ba50 123 * 0 | 1 | 0 | 10 | 10
bcostm 4:137bb367ba50 124 * 0 | 1 | 1 | 25 | 25
bcostm 4:137bb367ba50 125 * 1 | 0 | 0 | 50 | 50
bcostm 4:137bb367ba50 126 * 1 | 0 | 1 | 75 | 75
bcostm 4:137bb367ba50 127 * 1 | 1 | 0 | Reserved | Reserved
bcostm 4:137bb367ba50 128 * 1 | 1 | 1 | Reserved | Reserved
bcostm 4:137bb367ba50 129 *
bcostm 4:137bb367ba50 130 * 3 EN_LPFP: Enable Low Pass filter on Pressure data. Default value:0
bcostm 4:137bb367ba50 131 * 2:LPF_CFG Low-pass configuration register. (0: Filter cutoff is ODR/9; 1: filter cutoff is ODR/20)
bcostm 4:137bb367ba50 132 * 1 BDU: block data update. 0 - continuous update; 1 - output registers not updated until MSB and LSB reading.
bcostm 4:137bb367ba50 133 * 0 SIM: SPI Serial Interface Mode selection. 0 - SPI 4-wire; 1 - SPI 3-wire
bcostm 4:137bb367ba50 134 */
bcostm 4:137bb367ba50 135 #define LPS22HB_CTRL_REG1 (uint8_t)0x10
bcostm 4:137bb367ba50 136
bcostm 4:137bb367ba50 137 #define LPS22HB_ODR_MASK (uint8_t)0x70
bcostm 4:137bb367ba50 138 #define LPS22HB_LPFP_MASK (uint8_t)0x08
bcostm 4:137bb367ba50 139 #define LPS22HB_LPFP_CUTOFF_MASK (uint8_t)0x04
bcostm 4:137bb367ba50 140 #define LPS22HB_BDU_MASK (uint8_t)0x02
bcostm 4:137bb367ba50 141 #define LPS22HB_SIM_MASK (uint8_t)0x01
bcostm 4:137bb367ba50 142
bcostm 4:137bb367ba50 143 #define LPS22HB_LPFP_BIT LPS22HB_BIT(3)
bcostm 4:137bb367ba50 144
bcostm 4:137bb367ba50 145 /**
bcostm 4:137bb367ba50 146 * @brief Control Register 2
bcostm 4:137bb367ba50 147 * Read/write
bcostm 4:137bb367ba50 148 * Default value: 0x10
bcostm 4:137bb367ba50 149 * 7 BOOT: Reboot memory content. 0: normal mode; 1: reboot memory content. Self-clearing upon completation
bcostm 4:137bb367ba50 150 * 6 FIFO_EN: FIFO Enable. 0: disable; 1: enable
bcostm 4:137bb367ba50 151 * 5 STOP_ON_FTH: Stop on FIFO Threshold FIFO Watermark level use. 0: disable; 1: enable
bcostm 4:137bb367ba50 152 * 4 IF_ADD_INC: Register address automatically incrementeed during a multiple byte access with a serial interface (I2C or SPI).
bcostm 4:137bb367ba50 153 * Default value 1.( 0: disable; 1: enable)
bcostm 4:137bb367ba50 154 * 3 I2C DIS: Disable I2C interface 0: I2C Enabled; 1: I2C disabled
bcostm 4:137bb367ba50 155 * 2 SWRESET: Software reset. 0: normal mode; 1: SW reset. Self-clearing upon completation
bcostm 4:137bb367ba50 156 * 1 AUTO_ZERO: Autozero enable. 0: normal mode; 1: autozero enable.
bcostm 4:137bb367ba50 157 * 0 ONE_SHOT: One shot enable. 0: waiting for start of conversion; 1: start for a new dataset
bcostm 4:137bb367ba50 158 */
bcostm 4:137bb367ba50 159 #define LPS22HB_CTRL_REG2 (uint8_t)0x11
bcostm 4:137bb367ba50 160
bcostm 4:137bb367ba50 161 #define LPS22HB_BOOT_BIT LPS22HB_BIT(7)
bcostm 4:137bb367ba50 162 #define LPS22HB_FIFO_EN_BIT LPS22HB_BIT(6)
bcostm 4:137bb367ba50 163 #define LPS22HB_WTM_EN_BIT LPS22HB_BIT(5)
bcostm 4:137bb367ba50 164 #define LPS22HB_ADD_INC_BIT LPS22HB_BIT(4)
bcostm 4:137bb367ba50 165 #define LPS22HB_I2C_BIT LPS22HB_BIT(3)
bcostm 4:137bb367ba50 166 #define LPS22HB_SW_RESET_BIT LPS22HB_BIT(2)
bcostm 4:137bb367ba50 167
bcostm 4:137bb367ba50 168 #define LPS22HB_FIFO_EN_MASK (uint8_t)0x40
bcostm 4:137bb367ba50 169 #define LPS22HB_WTM_EN_MASK (uint8_t)0x20
bcostm 4:137bb367ba50 170 #define LPS22HB_ADD_INC_MASK (uint8_t)0x10
bcostm 4:137bb367ba50 171 #define LPS22HB_I2C_MASK (uint8_t)0x08
bcostm 4:137bb367ba50 172 #define LPS22HB_ONE_SHOT_MASK (uint8_t)0x01
bcostm 4:137bb367ba50 173
bcostm 4:137bb367ba50 174
bcostm 4:137bb367ba50 175 /**
bcostm 4:137bb367ba50 176 * @brief CTRL Reg3 Interrupt Control Register
bcostm 4:137bb367ba50 177 * Read/write
bcostm 4:137bb367ba50 178 * Default value: 0x00
bcostm 4:137bb367ba50 179 * 7 INT_H_L: Interrupt active high, low. 0:active high; 1: active low.
bcostm 4:137bb367ba50 180 * 6 PP_OD: Push-Pull/OpenDrain selection on interrupt pads. 0: Push-pull; 1: open drain.
bcostm 4:137bb367ba50 181 * 5 F_FSS5: FIFO full flag on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
bcostm 4:137bb367ba50 182 * 4 F_FTH: FIFO threshold (watermark) status on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
bcostm 4:137bb367ba50 183 * 3 F_OVR: FIFO overrun interrupt on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
bcostm 4:137bb367ba50 184 * 2 DRDY: Data-ready signal on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
bcostm 4:137bb367ba50 185 * 1:0 INT_S2, INT_S1: data signal on INT pad control bits.
bcostm 4:137bb367ba50 186 * INT_S2 | INT_S1 | INT pin
bcostm 4:137bb367ba50 187 * ------------------------------------------------------
bcostm 4:137bb367ba50 188 * 0 | 0 | Data signal( in order of priority:PTH_DRDY or F_FTH or F_OVR_or F_FSS5
bcostm 4:137bb367ba50 189 * 0 | 1 | Pressure high (P_high)
bcostm 4:137bb367ba50 190 * 1 | 0 | Pressure low (P_low)
bcostm 4:137bb367ba50 191 * 1 | 1 | P_low OR P_high
bcostm 4:137bb367ba50 192 */
bcostm 4:137bb367ba50 193 #define LPS22HB_CTRL_REG3 (uint8_t)0x12
bcostm 4:137bb367ba50 194
bcostm 4:137bb367ba50 195 #define LPS22HB_PP_OD_BIT LPS22HB_BIT(6)
bcostm 4:137bb367ba50 196 #define LPS22HB_FIFO_FULL_BIT LPS22HB_BIT(5)
bcostm 4:137bb367ba50 197 #define LPS22HB_FIFO_FTH_BIT LPS22HB_BIT(4)
bcostm 4:137bb367ba50 198 #define LPS22HB_FIFO_OVR_BIT LPS22HB_BIT(3)
bcostm 4:137bb367ba50 199 #define LPS22HB_DRDY_BIT LPS22HB_BIT(2)
bcostm 4:137bb367ba50 200
bcostm 4:137bb367ba50 201
bcostm 4:137bb367ba50 202 #define LPS22HB_INT_H_L_MASK (uint8_t)0x80
bcostm 4:137bb367ba50 203 #define LPS22HB_PP_OD_MASK (uint8_t)0x40
bcostm 4:137bb367ba50 204 #define LPS22HB_FIFO_FULL_MASK (uint8_t)0x20
bcostm 4:137bb367ba50 205 #define LPS22HB_FIFO_FTH_MASK (uint8_t)0x10
bcostm 4:137bb367ba50 206 #define LPS22HB_FIFO_OVR_MASK (uint8_t)0x08
bcostm 4:137bb367ba50 207 #define LPS22HB_DRDY_MASK (uint8_t)0x04
bcostm 4:137bb367ba50 208 #define LPS22HB_INT_S12_MASK (uint8_t)0x03
bcostm 4:137bb367ba50 209
bcostm 4:137bb367ba50 210
bcostm 4:137bb367ba50 211 /**
bcostm 4:137bb367ba50 212 * @brief Interrupt Differential configuration Register
bcostm 4:137bb367ba50 213 * Read/write
bcostm 4:137bb367ba50 214 * Default value: 0x00.
bcostm 4:137bb367ba50 215 * 7 AUTORIFP: AutoRifP Enable
bcostm 4:137bb367ba50 216 * 6 RESET_ARP: Reset AutoRifP function
bcostm 4:137bb367ba50 217 * 4 AUTOZERO: Autozero enabled
bcostm 4:137bb367ba50 218 * 5 RESET_AZ: Reset Autozero Function
bcostm 4:137bb367ba50 219 * 3 DIFF_EN: Interrupt generation enable
bcostm 4:137bb367ba50 220 * 2 LIR: Latch Interrupt request into INT_SOURCE register. 0 - interrupt request not latched
bcostm 4:137bb367ba50 221 * 1 - interrupt request latched
bcostm 4:137bb367ba50 222 * 1 PL_E: Enable interrupt generation on differential pressure low event. 0 - disable; 1 - enable
bcostm 4:137bb367ba50 223 * 0 PH_E: Enable interrupt generation on differential pressure high event. 0 - disable; 1 - enable
bcostm 4:137bb367ba50 224 */
bcostm 4:137bb367ba50 225 #define LPS22HB_INTERRUPT_CFG_REG (uint8_t)0x0B
bcostm 4:137bb367ba50 226
bcostm 4:137bb367ba50 227 #define LPS22HB_DIFF_EN_BIT LPS22HB_BIT(3)
bcostm 4:137bb367ba50 228 #define LPS22HB_LIR_BIT LPS22HB_BIT(2)
bcostm 4:137bb367ba50 229 #define LPS22HB_PLE_BIT LPS22HB_BIT(1)
bcostm 4:137bb367ba50 230 #define LPS22HB_PHE_BIT LPS22HB_BIT(0)
bcostm 4:137bb367ba50 231
bcostm 4:137bb367ba50 232 #define LPS22HB_AUTORIFP_MASK (uint8_t)0x80
bcostm 4:137bb367ba50 233 #define LPS22HB_RESET_ARP_MASK (uint8_t)0x40
bcostm 4:137bb367ba50 234 #define LPS22HB_AUTOZERO_MASK (uint8_t)0x20
bcostm 4:137bb367ba50 235 #define LPS22HB_RESET_AZ_MASK (uint8_t)0x10
bcostm 4:137bb367ba50 236 #define LPS22HB_DIFF_EN_MASK (uint8_t)0x08
bcostm 4:137bb367ba50 237 #define LPS22HB_LIR_MASK (uint8_t)0x04
bcostm 4:137bb367ba50 238 #define LPS22HB_PLE_MASK (uint8_t)0x02
bcostm 4:137bb367ba50 239 #define LPS22HB_PHE_MASK (uint8_t)0x01
bcostm 4:137bb367ba50 240
bcostm 4:137bb367ba50 241
bcostm 4:137bb367ba50 242
bcostm 4:137bb367ba50 243 /**
bcostm 4:137bb367ba50 244 * @brief Interrupt source Register (It is cleared by reading it)
bcostm 4:137bb367ba50 245 * Read
bcostm 4:137bb367ba50 246 * 7 BOOT_STATUS: If 1 indicates that the Boot (Reboot) phase is running.
bcostm 4:137bb367ba50 247 * 6:3 Reserved: Keep these bits at 0
bcostm 4:137bb367ba50 248 * 2 IA: Interrupt Active.0: no interrupt has been generated
bcostm 4:137bb367ba50 249 * 1: one or more interrupt events have been generated.
bcostm 4:137bb367ba50 250 * 1 PL: Differential pressure Low. 0: no interrupt has been generated
bcostm 4:137bb367ba50 251 * 1: Low differential pressure event has occurred.
bcostm 4:137bb367ba50 252 * 0 PH: Differential pressure High. 0: no interrupt has been generated
bcostm 4:137bb367ba50 253 * 1: High differential pressure event has occurred.
bcostm 4:137bb367ba50 254 */
bcostm 4:137bb367ba50 255 #define LPS22HB_INTERRUPT_SOURCE_REG (uint8_t)0x25
bcostm 4:137bb367ba50 256
bcostm 4:137bb367ba50 257 #define LPS22HB_BOOT_STATUS_BIT LPS22HB_BIT(7)
bcostm 4:137bb367ba50 258 #define LPS22HB_IA_BIT LPS22HB_BIT(2)
bcostm 4:137bb367ba50 259 #define LPS22HB_PL_BIT LPS22HB_BIT(1)
bcostm 4:137bb367ba50 260 #define LPS22HB_PH_BIT LPS22HB_BIT(0)
bcostm 4:137bb367ba50 261
bcostm 4:137bb367ba50 262 #define LPS22HB_BOOT_STATUS_MASK (uint8_t)0x80
bcostm 4:137bb367ba50 263 #define LPS22HB_IA_MASK (uint8_t)0x04
bcostm 4:137bb367ba50 264 #define LPS22HB_PL_MASK (uint8_t)0x02
bcostm 4:137bb367ba50 265 #define LPS22HB_PH_MASK (uint8_t)0x01
bcostm 4:137bb367ba50 266
bcostm 4:137bb367ba50 267
bcostm 4:137bb367ba50 268 /**
bcostm 4:137bb367ba50 269 * @brief Status Register
bcostm 4:137bb367ba50 270 * Read
bcostm 4:137bb367ba50 271 * 7:6 Reserved: 0
bcostm 4:137bb367ba50 272 * 5 T_OR: Temperature data overrun. 0: no overrun has occurred
bcostm 4:137bb367ba50 273 * 1: a new data for temperature has overwritten the previous one.
bcostm 4:137bb367ba50 274 * 4 P_OR: Pressure data overrun. 0: no overrun has occurred
bcostm 4:137bb367ba50 275 * 1: new data for pressure has overwritten the previous one.
bcostm 4:137bb367ba50 276 * 3:2 Reserved: 0
bcostm 4:137bb367ba50 277 * 1 T_DA: Temperature data available. 0: new data for temperature is not yet available
bcostm 4:137bb367ba50 278 * 1: new data for temperature is available.
bcostm 4:137bb367ba50 279 * 0 P_DA: Pressure data available. 0: new data for pressure is not yet available
bcostm 4:137bb367ba50 280 * 1: new data for pressure is available.
bcostm 4:137bb367ba50 281 */
bcostm 4:137bb367ba50 282 #define LPS22HB_STATUS_REG (uint8_t)0x27
bcostm 4:137bb367ba50 283
bcostm 4:137bb367ba50 284 #define LPS22HB_TOR_BIT LPS22HB_BIT(5)
bcostm 4:137bb367ba50 285 #define LPS22HB_POR_BIT LPS22HB_BIT(4)
bcostm 4:137bb367ba50 286 #define LPS22HB_TDA_BIT LPS22HB_BIT(1)
bcostm 4:137bb367ba50 287 #define LPS22HB_PDA_BIT LPS22HB_BIT(0)
bcostm 4:137bb367ba50 288
bcostm 4:137bb367ba50 289 #define LPS22HB_TOR_MASK (uint8_t)0x20
bcostm 4:137bb367ba50 290 #define LPS22HB_POR_MASK (uint8_t)0x10
bcostm 4:137bb367ba50 291 #define LPS22HB_TDA_MASK (uint8_t)0x02
bcostm 4:137bb367ba50 292 #define LPS22HB_PDA_MASK (uint8_t)0x01
bcostm 4:137bb367ba50 293
bcostm 4:137bb367ba50 294
bcostm 4:137bb367ba50 295 /**
bcostm 4:137bb367ba50 296 * @brief Pressure data (LSB) register.
bcostm 4:137bb367ba50 297 * Read
bcostm 4:137bb367ba50 298 * Default value: 0x00.(To be verified)
bcostm 4:137bb367ba50 299 * POUT7 - POUT0: Pressure data LSB (2's complement).
bcostm 4:137bb367ba50 300 * Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
bcostm 4:137bb367ba50 301 * PRESS_OUT_XL)[dec]/4096.
bcostm 4:137bb367ba50 302 */
bcostm 4:137bb367ba50 303 #define LPS22HB_PRESS_OUT_XL_REG (uint8_t)0x28
bcostm 4:137bb367ba50 304
bcostm 4:137bb367ba50 305 /**
bcostm 4:137bb367ba50 306 * @brief Pressure data (Middle part) register.
bcostm 4:137bb367ba50 307 * Read
bcostm 4:137bb367ba50 308 * Default value: 0x80.
bcostm 4:137bb367ba50 309 * POUT15 - POUT8: Pressure data middle part (2's complement).
bcostm 4:137bb367ba50 310 * Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
bcostm 4:137bb367ba50 311 * PRESS_OUT_XL)[dec]/4096.
bcostm 4:137bb367ba50 312 */
bcostm 4:137bb367ba50 313 #define LPS22HB_PRESS_OUT_L_REG (uint8_t)0x29
bcostm 4:137bb367ba50 314
bcostm 4:137bb367ba50 315 /**
bcostm 4:137bb367ba50 316 * @brief Pressure data (MSB) register.
bcostm 4:137bb367ba50 317 * Read
bcostm 4:137bb367ba50 318 * Default value: 0x2F.
bcostm 4:137bb367ba50 319 * POUT23 - POUT16: Pressure data MSB (2's complement).
bcostm 4:137bb367ba50 320 * Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
bcostm 4:137bb367ba50 321 * PRESS_OUT_XL)[dec]/4096.
bcostm 4:137bb367ba50 322 */
bcostm 4:137bb367ba50 323 #define LPS22HB_PRESS_OUT_H_REG (uint8_t)0x2A
bcostm 4:137bb367ba50 324
bcostm 4:137bb367ba50 325 /**
bcostm 4:137bb367ba50 326 * @brief Temperature data (LSB) register.
bcostm 4:137bb367ba50 327 * Read
bcostm 4:137bb367ba50 328 * Default value: 0x00.
bcostm 4:137bb367ba50 329 * TOUT7 - TOUT0: temperature data LSB.
bcostm 4:137bb367ba50 330 * Tout(degC)=TEMP_OUT/100
bcostm 4:137bb367ba50 331 */
bcostm 4:137bb367ba50 332 #define LPS22HB_TEMP_OUT_L_REG (uint8_t)0x2B
bcostm 4:137bb367ba50 333
bcostm 4:137bb367ba50 334 /**
bcostm 4:137bb367ba50 335 * @brief Temperature data (MSB) register.
bcostm 4:137bb367ba50 336 * Read
bcostm 4:137bb367ba50 337 * Default value: 0x00.
bcostm 4:137bb367ba50 338 * TOUT15 - TOUT8: temperature data MSB.
bcostm 4:137bb367ba50 339 * Tout(degC)=TEMP_OUT/100
bcostm 4:137bb367ba50 340 */
bcostm 4:137bb367ba50 341 #define LPS22HBH_TEMP_OUT_H_REG (uint8_t)0x2C
bcostm 4:137bb367ba50 342
bcostm 4:137bb367ba50 343 /**
bcostm 4:137bb367ba50 344 * @brief Threshold pressure (LSB) register.
bcostm 4:137bb367ba50 345 * Read/write
bcostm 4:137bb367ba50 346 * Default value: 0x00.
bcostm 4:137bb367ba50 347 * 7:0 THS7-THS0: LSB Threshold pressure Low part of threshold value for pressure interrupt
bcostm 4:137bb367ba50 348 * generation. The complete threshold value is given by THS_P_H & THS_P_L and is
bcostm 4:137bb367ba50 349 * expressed as unsigned number. P_ths(hPA)=(THS_P_H & THS_P_L)[dec]/16.
bcostm 4:137bb367ba50 350 */
bcostm 4:137bb367ba50 351 #define LPS22HB_THS_P_LOW_REG (uint8_t)0x0C
bcostm 4:137bb367ba50 352
bcostm 4:137bb367ba50 353 /**
bcostm 4:137bb367ba50 354 * @brief Threshold pressure (MSB)
bcostm 4:137bb367ba50 355 * Read/write
bcostm 4:137bb367ba50 356 * Default value: 0x00.
bcostm 4:137bb367ba50 357 * 7:0 THS15-THS8: MSB Threshold pressure. High part of threshold value for pressure interrupt
bcostm 4:137bb367ba50 358 * generation. The complete threshold value is given by THS_P_H & THS_P_L and is
bcostm 4:137bb367ba50 359 * expressed as unsigned number. P_ths(mbar)=(THS_P_H & THS_P_L)[dec]/16.
bcostm 4:137bb367ba50 360 */
bcostm 4:137bb367ba50 361 #define LPS22HB_THS_P_HIGH_REG (uint8_t)0x0D
bcostm 4:137bb367ba50 362
bcostm 4:137bb367ba50 363 /**
bcostm 4:137bb367ba50 364 * @brief FIFO control register
bcostm 4:137bb367ba50 365 * Read/write
bcostm 4:137bb367ba50 366 * Default value: 0x00
bcostm 4:137bb367ba50 367 * 7:5 F_MODE2, F_MODE1, F_MODE0: FIFO mode selection.
bcostm 4:137bb367ba50 368 * FM2 | FM1 | FM0 | FIFO MODE
bcostm 4:137bb367ba50 369 * ---------------------------------------------------
bcostm 4:137bb367ba50 370 * 0 | 0 | 0 | BYPASS MODE
bcostm 4:137bb367ba50 371 * 0 | 0 | 1 | FIFO MODE. Stops collecting data when full
bcostm 4:137bb367ba50 372 * 0 | 1 | 0 | STREAM MODE: Keep the newest measurements in the FIFO
bcostm 4:137bb367ba50 373 * 0 | 1 | 1 | STREAM MODE until trigger deasserted, then change to FIFO MODE
bcostm 4:137bb367ba50 374 * 1 | 0 | 0 | BYPASS MODE until trigger deasserted, then STREAM MODE
bcostm 4:137bb367ba50 375 * 1 | 0 | 1 | Reserved for future use
bcostm 4:137bb367ba50 376 * 1 | 1 | 0 | Reserved
bcostm 4:137bb367ba50 377 * 1 | 1 | 1 | BYPASS mode until trigger deasserted, then FIFO MODE
bcostm 4:137bb367ba50 378 *
bcostm 4:137bb367ba50 379 * 4:0 WTM_POINT4-0 : FIFO Watermark level selection (0-31)
bcostm 4:137bb367ba50 380 */
bcostm 4:137bb367ba50 381 #define LPS22HB_CTRL_FIFO_REG (uint8_t)0x14
bcostm 4:137bb367ba50 382
bcostm 4:137bb367ba50 383 #define LPS22HB_FIFO_MODE_MASK (uint8_t)0xE0
bcostm 4:137bb367ba50 384 #define LPS22HB_WTM_POINT_MASK (uint8_t)0x1F
bcostm 4:137bb367ba50 385
bcostm 4:137bb367ba50 386
bcostm 4:137bb367ba50 387 /**
bcostm 4:137bb367ba50 388 * @brief FIFO Status register
bcostm 4:137bb367ba50 389 * Read
bcostm 4:137bb367ba50 390 * 7 FTH_FIFO: FIFO threshold status. 0:FIFO filling is lower than FTH level
bcostm 4:137bb367ba50 391 * 1: FIFO is equal or higher than FTH level.
bcostm 4:137bb367ba50 392 * 6 OVR: Overrun bit status. 0 - FIFO not full
bcostm 4:137bb367ba50 393 * 1 - FIFO is full and at least one sample in the FIFO has been overwritten.
bcostm 4:137bb367ba50 394 * 5:0 FSS: FIFO Stored data level. 000000: FIFO empty, 100000: FIFO is full and has 32 unread samples.
bcostm 4:137bb367ba50 395 */
bcostm 4:137bb367ba50 396 #define LPS22HB_STATUS_FIFO_REG (uint8_t)0x26
bcostm 4:137bb367ba50 397
bcostm 4:137bb367ba50 398 #define LPS22HB_FTH_FIFO_BIT LPS22HB_BIT(7)
bcostm 4:137bb367ba50 399 #define LPS22HB_OVR_FIFO_BIT LPS22HB_BIT(6)
bcostm 4:137bb367ba50 400
bcostm 4:137bb367ba50 401 #define LPS22HB_FTH_FIFO_MASK (uint8_t)0x80
bcostm 4:137bb367ba50 402 #define LPS22HB_OVR_FIFO_MASK (uint8_t)0x40
bcostm 4:137bb367ba50 403 #define LPS22HB_LEVEL_FIFO_MASK (uint8_t)0x3F
bcostm 4:137bb367ba50 404 #define LPS22HB_FIFO_EMPTY (uint8_t)0x00
bcostm 4:137bb367ba50 405 #define LPS22HB_FIFO_FULL (uint8_t)0x20
bcostm 4:137bb367ba50 406
bcostm 4:137bb367ba50 407
bcostm 4:137bb367ba50 408
bcostm 4:137bb367ba50 409 /**
bcostm 4:137bb367ba50 410 * @brief Pressure offset register (LSB)
bcostm 4:137bb367ba50 411 * Read/write
bcostm 4:137bb367ba50 412 * Default value: 0x00
bcostm 4:137bb367ba50 413 * 7:0 RPDS7-0:Pressure Offset for 1 point calibration (OPC) after soldering.
bcostm 4:137bb367ba50 414 * This register contains the low part of the pressure offset value after soldering,for
bcostm 4:137bb367ba50 415 * differential pressure computing. The complete value is given by RPDS_L & RPDS_H
bcostm 4:137bb367ba50 416 * and is expressed as signed 2 complement value.
bcostm 4:137bb367ba50 417 */
bcostm 4:137bb367ba50 418 #define LPS22HB_RPDS_L_REG (uint8_t)0x18
bcostm 4:137bb367ba50 419
bcostm 4:137bb367ba50 420 /**
bcostm 4:137bb367ba50 421 * @brief Pressure offset register (MSB)
bcostm 4:137bb367ba50 422 * Read/write
bcostm 4:137bb367ba50 423 * Default value: 0x00
bcostm 4:137bb367ba50 424 * 7:0 RPDS15-8:Pressure Offset for 1 point calibration (OPC) after soldering.
bcostm 4:137bb367ba50 425 * This register contains the high part of the pressure offset value after soldering (see description RPDS_L)
bcostm 4:137bb367ba50 426 */
bcostm 4:137bb367ba50 427 #define LPS22HB_RPDS_H_REG (uint8_t)0x19
bcostm 4:137bb367ba50 428
bcostm 4:137bb367ba50 429
bcostm 4:137bb367ba50 430 /**
bcostm 4:137bb367ba50 431 * @brief Clock Tree Configuration register
bcostm 4:137bb367ba50 432 * Read/write
bcostm 4:137bb367ba50 433 * Default value: 0x00
bcostm 4:137bb367ba50 434 * 7:6 Reserved.
bcostm 4:137bb367ba50 435 * 5: CTE: Clock Tree Enhancement
bcostm 4:137bb367ba50 436 */
bcostm 4:137bb367ba50 437 #define LPS22HB_CLOCK_TREE_CONFIGURATION (uint8_t)0x43
bcostm 4:137bb367ba50 438 #define LPS22HB_CTE_MASK (uint8_t)0x20
bcostm 4:137bb367ba50 439
bcostm 4:137bb367ba50 440 /**
bcostm 4:137bb367ba50 441 * @}
bcostm 4:137bb367ba50 442 */
bcostm 4:137bb367ba50 443
bcostm 4:137bb367ba50 444
bcostm 4:137bb367ba50 445 /** @defgroup LPS22HB_Pressure_Exported_Functions LPS22HB Pressure Exported Functions
bcostm 4:137bb367ba50 446 * @{
bcostm 4:137bb367ba50 447 */
bcostm 4:137bb367ba50 448 /* PRESSURE functions */
bcostm 4:137bb367ba50 449 void LPS22HB_P_Init(uint16_t DeviceAddr);
bcostm 4:137bb367ba50 450 uint8_t LPS22HB_P_ReadID(uint16_t DeviceAddr);
bcostm 4:137bb367ba50 451 float LPS22HB_P_ReadPressure(uint16_t DeviceAddr);
bcostm 4:137bb367ba50 452 /**
bcostm 4:137bb367ba50 453 * @}
bcostm 4:137bb367ba50 454 */
bcostm 4:137bb367ba50 455
bcostm 4:137bb367ba50 456 /** @defgroup HTS221_PressImported_Globals PRESSURE Imported Globals
bcostm 4:137bb367ba50 457 * @{
bcostm 4:137bb367ba50 458 */
bcostm 4:137bb367ba50 459 /* PRESSURE driver structure */
bcostm 4:137bb367ba50 460 extern PSENSOR_DrvTypeDef LPS22HB_P_Drv;
bcostm 4:137bb367ba50 461 /**
bcostm 4:137bb367ba50 462 * @}
bcostm 4:137bb367ba50 463 */
bcostm 4:137bb367ba50 464
bcostm 4:137bb367ba50 465 /** @defgroup LPS22HB_Temperature_Exported_Functions LPS22HB Temperature Exported Functions
bcostm 4:137bb367ba50 466 * @{
bcostm 4:137bb367ba50 467 */
bcostm 4:137bb367ba50 468 /* TEMPERATURE functions */
bcostm 4:137bb367ba50 469 void LPS22HB_T_Init(uint16_t DeviceAddr, TSENSOR_InitTypeDef *pInitStruct);
bcostm 4:137bb367ba50 470 float LPS22HB_T_ReadTemp(uint16_t DeviceAddr);
bcostm 4:137bb367ba50 471 /**
bcostm 4:137bb367ba50 472 * @}
bcostm 4:137bb367ba50 473 */
bcostm 4:137bb367ba50 474
bcostm 4:137bb367ba50 475 /** @defgroup HTS221_TempImported_Globals Temperature Imported Globals
bcostm 4:137bb367ba50 476 * @{
bcostm 4:137bb367ba50 477 */
bcostm 4:137bb367ba50 478 /* Temperature driver structure */
bcostm 4:137bb367ba50 479 extern TSENSOR_DrvTypeDef LPS22HB_T_Drv;
bcostm 4:137bb367ba50 480 /**
bcostm 4:137bb367ba50 481 * @}
bcostm 4:137bb367ba50 482 */
bcostm 4:137bb367ba50 483
bcostm 4:137bb367ba50 484 /** @defgroup LPS22HB_Imported_Functions LPS22HB Imported Functions
bcostm 4:137bb367ba50 485 * @{
bcostm 4:137bb367ba50 486 */
bcostm 4:137bb367ba50 487 /* IO functions */
bcostm 4:137bb367ba50 488 extern void SENSOR_IO_Init(void);
bcostm 4:137bb367ba50 489 extern void SENSOR_IO_Write(uint8_t Addr, uint8_t Reg, uint8_t Value);
bcostm 4:137bb367ba50 490 extern uint8_t SENSOR_IO_Read(uint8_t Addr, uint8_t Reg);
bcostm 4:137bb367ba50 491 extern uint16_t SENSOR_IO_ReadMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
bcostm 4:137bb367ba50 492 extern void SENSOR_IO_WriteMultiple(uint8_t Addr, uint8_t Reg, uint8_t *Buffer, uint16_t Length);
bcostm 4:137bb367ba50 493
bcostm 4:137bb367ba50 494 /**
bcostm 4:137bb367ba50 495 * @}
bcostm 4:137bb367ba50 496 */
bcostm 4:137bb367ba50 497
bcostm 4:137bb367ba50 498 #ifdef __cplusplus
bcostm 4:137bb367ba50 499 }
bcostm 4:137bb367ba50 500 #endif
bcostm 4:137bb367ba50 501
bcostm 4:137bb367ba50 502 #endif /* __LPS22HB__H */
bcostm 4:137bb367ba50 503
bcostm 4:137bb367ba50 504 /**
bcostm 4:137bb367ba50 505 * @}
bcostm 4:137bb367ba50 506 */
bcostm 4:137bb367ba50 507
bcostm 4:137bb367ba50 508 /**
bcostm 4:137bb367ba50 509 * @}
bcostm 4:137bb367ba50 510 */
bcostm 4:137bb367ba50 511
bcostm 4:137bb367ba50 512 /**
bcostm 4:137bb367ba50 513 * @}
bcostm 4:137bb367ba50 514 */
bcostm 4:137bb367ba50 515
bcostm 4:137bb367ba50 516 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/