Example of tilt detection for LSM6DSL in X-NUCLEO-IKS01A2

Dependencies:   X_NUCLEO_IKS01A2 mbed

Fork of Tilt_IKS01A2 by ST Expansion SW Team

Tilt Detection Demo Application based on sensor expansion board X-NUCLEO-IKS01A2

Main function is to show how to detect the tilt event using the sensor expansion board and send a notification using UART to a connected PC or Desktop and display it on terminal applications like TeraTerm.
After connection has been established:
- the user can try to tilt the board and then view the notification using an hyper terminal. When the tilt event is detected, the LED is switched on for a while.
- the user button can be used to enable/disable the tilt detection feature.

Committer:
cparata
Date:
Fri Aug 19 12:34:01 2016 +0000
Revision:
2:39ad2a393143
Parent:
0:489965565a0d
Add interfaces to all components

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cparata 0:489965565a0d 1 /**
cparata 0:489965565a0d 2 ******************************************************************************
cparata 0:489965565a0d 3 * @file LPS22HB_Driver.h
cparata 0:489965565a0d 4 * @author HESA Application Team
cparata 0:489965565a0d 5 * @version V1.1
cparata 0:489965565a0d 6 * @date 10-August-2016
cparata 0:489965565a0d 7 * @brief LPS22HB driver header file
cparata 0:489965565a0d 8 ******************************************************************************
cparata 0:489965565a0d 9 * @attention
cparata 0:489965565a0d 10 *
cparata 0:489965565a0d 11 * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2>
cparata 0:489965565a0d 12 *
cparata 0:489965565a0d 13 * Redistribution and use in source and binary forms, with or without modification,
cparata 0:489965565a0d 14 * are permitted provided that the following conditions are met:
cparata 0:489965565a0d 15 * 1. Redistributions of source code must retain the above copyright notice,
cparata 0:489965565a0d 16 * this list of conditions and the following disclaimer.
cparata 0:489965565a0d 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
cparata 0:489965565a0d 18 * this list of conditions and the following disclaimer in the documentation
cparata 0:489965565a0d 19 * and/or other materials provided with the distribution.
cparata 0:489965565a0d 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
cparata 0:489965565a0d 21 * may be used to endorse or promote products derived from this software
cparata 0:489965565a0d 22 * without specific prior written permission.
cparata 0:489965565a0d 23 *
cparata 0:489965565a0d 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
cparata 0:489965565a0d 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
cparata 0:489965565a0d 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
cparata 0:489965565a0d 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
cparata 0:489965565a0d 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
cparata 0:489965565a0d 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
cparata 0:489965565a0d 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
cparata 0:489965565a0d 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
cparata 0:489965565a0d 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
cparata 0:489965565a0d 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cparata 0:489965565a0d 34 *
cparata 0:489965565a0d 35 ******************************************************************************
cparata 0:489965565a0d 36 */
cparata 0:489965565a0d 37
cparata 0:489965565a0d 38 /* Define to prevent recursive inclusion -------------------------------------*/
cparata 0:489965565a0d 39 #ifndef __LPS22HB_DRIVER__H
cparata 0:489965565a0d 40 #define __LPS22HB_DRIVER__H
cparata 0:489965565a0d 41
cparata 0:489965565a0d 42 #include <stdint.h>
cparata 0:489965565a0d 43
cparata 0:489965565a0d 44 #ifdef __cplusplus
cparata 0:489965565a0d 45 extern "C" {
cparata 0:489965565a0d 46 #endif
cparata 0:489965565a0d 47
cparata 0:489965565a0d 48 // the user must include the proper file where HAL_ReadReg and HAL_WriteReg are implemented
cparata 0:489965565a0d 49 //#include "HAL_EnvSensors.h"
cparata 0:489965565a0d 50
cparata 0:489965565a0d 51 /* Uncomment the line below to expanse the "assert_param" macro in the drivers code */
cparata 0:489965565a0d 52 //#define USE_FULL_ASSERT_LPS22HB
cparata 0:489965565a0d 53
cparata 0:489965565a0d 54 /* Exported macro ------------------------------------------------------------*/
cparata 0:489965565a0d 55 #ifdef USE_FULL_ASSERT_LPS22HB
cparata 0:489965565a0d 56
cparata 0:489965565a0d 57 /**
cparata 0:489965565a0d 58 * @brief The assert_param macro is used for function's parameters check.
cparata 0:489965565a0d 59 * @param expr: If expr is false, it calls assert_failed function which reports
cparata 0:489965565a0d 60 * the name of the source file and the source line number of the call
cparata 0:489965565a0d 61 * that failed. If expr is true, it returns no value.
cparata 0:489965565a0d 62 * @retval None
cparata 0:489965565a0d 63 */
cparata 0:489965565a0d 64 #define LPS22HB_assert_param(expr) ((expr) ? (void)0 : LPS22HB_assert_failed((uint8_t *)__FILE__, __LINE__))
cparata 0:489965565a0d 65 /* Exported functions ------------------------------------------------------- */
cparata 0:489965565a0d 66 void LPS22HB_assert_failed(uint8_t* file, uint32_t line);
cparata 0:489965565a0d 67 #else
cparata 0:489965565a0d 68 #define LPS22HB_assert_param(expr) ((void)0)
cparata 0:489965565a0d 69 #endif /* USE_FULL_ASSERT_LPS22HB */
cparata 0:489965565a0d 70
cparata 0:489965565a0d 71 /** @addtogroup Environmental_Sensor
cparata 0:489965565a0d 72 * @{
cparata 0:489965565a0d 73 */
cparata 0:489965565a0d 74
cparata 0:489965565a0d 75 /** @addtogroup LPS22HB_DRIVER
cparata 0:489965565a0d 76 * @{
cparata 0:489965565a0d 77 */
cparata 0:489965565a0d 78
cparata 0:489965565a0d 79 /* Exported Types -------------------------------------------------------------*/
cparata 0:489965565a0d 80 /** @defgroup LPS22HB_Exported_Types
cparata 0:489965565a0d 81 * @{
cparata 0:489965565a0d 82 */
cparata 0:489965565a0d 83
cparata 0:489965565a0d 84 /**
cparata 0:489965565a0d 85 * @brief Error type.
cparata 0:489965565a0d 86 */
cparata 0:489965565a0d 87 typedef enum {LPS22HB_OK = (uint8_t)0, LPS22HB_ERROR = !LPS22HB_OK} LPS22HB_Error_et;
cparata 0:489965565a0d 88
cparata 0:489965565a0d 89 /**
cparata 0:489965565a0d 90 * @brief Enable/Disable type.
cparata 0:489965565a0d 91 */
cparata 0:489965565a0d 92 typedef enum {LPS22HB_DISABLE = (uint8_t)0, LPS22HB_ENABLE = !LPS22HB_DISABLE} LPS22HB_State_et;
cparata 0:489965565a0d 93 #define IS_LPS22HB_State(MODE) ((MODE == LPS22HB_ENABLE) || (MODE == LPS22HB_DISABLE) )
cparata 0:489965565a0d 94
cparata 0:489965565a0d 95 /**
cparata 0:489965565a0d 96 * @brief Bit status type.
cparata 0:489965565a0d 97 */
cparata 0:489965565a0d 98 typedef enum {LPS22HB_RESET = (uint8_t)0, LPS22HB_SET = !LPS22HB_RESET} LPS22HB_BitStatus_et;
cparata 0:489965565a0d 99 #define IS_LPS22HB_BitStatus(MODE) ((MODE == LPS22HB_RESET) || (MODE == LPS22HB_SET))
cparata 0:489965565a0d 100
cparata 0:489965565a0d 101 /*RES_CONF see LC_EN bit*/
cparata 0:489965565a0d 102 /**
cparata 0:489965565a0d 103 * @brief LPS22HB Power/Noise Mode configuration.
cparata 0:489965565a0d 104 */
cparata 0:489965565a0d 105 typedef enum {
cparata 0:489965565a0d 106 LPS22HB_LowNoise = (uint8_t)0x00, /*!< Low Noise mode */
cparata 0:489965565a0d 107 LPS22HB_LowPower = (uint8_t)0x01 /*!< Low Current mode */
cparata 0:489965565a0d 108 } LPS22HB_PowerMode_et;
cparata 0:489965565a0d 109
cparata 0:489965565a0d 110 #define IS_LPS22HB_PowerMode(MODE) ((MODE == LPS22HB_LowNoise) || (MODE == LPS22HB_LowPower))
cparata 0:489965565a0d 111
cparata 0:489965565a0d 112 /**
cparata 0:489965565a0d 113 * @brief Output data rate configuration.
cparata 0:489965565a0d 114 */
cparata 0:489965565a0d 115 typedef enum {
cparata 0:489965565a0d 116
cparata 0:489965565a0d 117 LPS22HB_ODR_ONE_SHOT = (uint8_t)0x00, /*!< Output Data Rate: one shot */
cparata 0:489965565a0d 118 LPS22HB_ODR_1HZ = (uint8_t)0x10, /*!< Output Data Rate: 1Hz */
cparata 0:489965565a0d 119 LPS22HB_ODR_10HZ = (uint8_t)0x20, /*!< Output Data Rate: 10Hz */
cparata 0:489965565a0d 120 LPS22HB_ODR_25HZ = (uint8_t)0x30, /*!< Output Data Rate: 25Hz */
cparata 0:489965565a0d 121 LPS22HB_ODR_50HZ = (uint8_t)0x40, /*!< Output Data Rate: 50Hz */
cparata 0:489965565a0d 122 LPS22HB_ODR_75HZ = (uint8_t)0x50 /*!< Output Data Rate: 75Hz */
cparata 0:489965565a0d 123 } LPS22HB_Odr_et;
cparata 0:489965565a0d 124
cparata 0:489965565a0d 125 #define IS_LPS22HB_ODR(ODR) ((ODR == LPS22HB_ODR_ONE_SHOT) || (ODR == LPS22HB_ODR_1HZ) || \
cparata 0:489965565a0d 126 (ODR == LPS22HB_ODR_10HZ) || (ODR == LPS22HB_ODR_25HZ)|| (ODR == LPS22HB_ODR_50HZ) || (ODR == LPS22HB_ODR_75HZ))
cparata 0:489965565a0d 127
cparata 0:489965565a0d 128 /**
cparata 0:489965565a0d 129 * @brief Low Pass Filter Cutoff Configuration.
cparata 0:489965565a0d 130 */
cparata 0:489965565a0d 131 typedef enum {
cparata 0:489965565a0d 132
cparata 0:489965565a0d 133 LPS22HB_ODR_9 = (uint8_t)0x00, /*!< Filter Cutoff ODR/9 */
cparata 0:489965565a0d 134 LPS22HB_ODR_20 = (uint8_t)0x04 /*!< Filter Cutoff ODR/20 */
cparata 0:489965565a0d 135 } LPS22HB_LPF_Cutoff_et;
cparata 0:489965565a0d 136
cparata 0:489965565a0d 137 #define IS_LPS22HB_LPF_Cutoff(CUTOFF) ((CUTOFF == LPS22HB_ODR_9) || (CUTOFF == LPS22HB_ODR_20) )
cparata 0:489965565a0d 138
cparata 0:489965565a0d 139 /**
cparata 0:489965565a0d 140 * @brief Block data update.
cparata 0:489965565a0d 141 */
cparata 0:489965565a0d 142
cparata 0:489965565a0d 143 typedef enum {
cparata 0:489965565a0d 144 LPS22HB_BDU_CONTINUOUS_UPDATE = (uint8_t)0x00, /*!< Data updated continuously */
cparata 0:489965565a0d 145 LPS22HB_BDU_NO_UPDATE = (uint8_t)0x02 /*!< Data updated after a read operation */
cparata 0:489965565a0d 146 } LPS22HB_Bdu_et;
cparata 0:489965565a0d 147 #define IS_LPS22HB_BDUMode(MODE) ((MODE == LPS22HB_BDU_CONTINUOUS_UPDATE) || (MODE == LPS22HB_BDU_NO_UPDATE))
cparata 0:489965565a0d 148
cparata 0:489965565a0d 149 /**
cparata 0:489965565a0d 150 * @brief LPS22HB Spi Mode configuration.
cparata 0:489965565a0d 151 */
cparata 0:489965565a0d 152 typedef enum {
cparata 0:489965565a0d 153 LPS22HB_SPI_4_WIRE = (uint8_t)0x00,
cparata 0:489965565a0d 154 LPS22HB_SPI_3_WIRE = (uint8_t)0x01
cparata 0:489965565a0d 155 } LPS22HB_SPIMode_et;
cparata 0:489965565a0d 156
cparata 0:489965565a0d 157 #define IS_LPS22HB_SPIMode(MODE) ((MODE == LPS22HB_SPI_4_WIRE) || (MODE == LPS22HB_SPI_3_WIRE))
cparata 0:489965565a0d 158
cparata 0:489965565a0d 159
cparata 0:489965565a0d 160 /**
cparata 0:489965565a0d 161 * @brief LPS22HB Interrupt Active Level Configuration (on High or Low)
cparata 0:489965565a0d 162 */
cparata 0:489965565a0d 163 typedef enum
cparata 0:489965565a0d 164 {
cparata 0:489965565a0d 165 LPS22HB_ActiveHigh = (uint8_t)0x00,
cparata 0:489965565a0d 166 LPS22HB_ActiveLow = (uint8_t)0x80
cparata 0:489965565a0d 167 }LPS22HB_InterruptActiveLevel_et;
cparata 0:489965565a0d 168 #define IS_LPS22HB_InterruptActiveLevel(MODE) ((MODE == LPS22HB_ActiveHigh) || (MODE == LPS22HB_ActiveLow))
cparata 0:489965565a0d 169
cparata 0:489965565a0d 170 /**
cparata 0:489965565a0d 171 * @brief LPS22HB Push-pull/Open Drain selection on Interrupt pads.
cparata 0:489965565a0d 172 */
cparata 0:489965565a0d 173 typedef enum
cparata 0:489965565a0d 174 {
cparata 0:489965565a0d 175 LPS22HB_PushPull = (uint8_t)0x00,
cparata 0:489965565a0d 176 LPS22HB_OpenDrain = (uint8_t)0x40
cparata 0:489965565a0d 177 }LPS22HB_OutputType_et;
cparata 0:489965565a0d 178 #define IS_LPS22HB_OutputType(MODE) ((MODE == LPS22HB_PushPull) || (MODE == LPS22HB_OpenDrain))
cparata 0:489965565a0d 179
cparata 0:489965565a0d 180
cparata 0:489965565a0d 181 /**
cparata 0:489965565a0d 182 * @brief Data Signal on INT pad control bits.
cparata 0:489965565a0d 183 */
cparata 0:489965565a0d 184 typedef enum
cparata 0:489965565a0d 185 {
cparata 0:489965565a0d 186 LPS22HB_DATA = (uint8_t)0x00,
cparata 0:489965565a0d 187 LPS22HB_P_HIGH = (uint8_t)0x01,
cparata 0:489965565a0d 188 LPS22HB_P_LOW = (uint8_t)0x02,
cparata 0:489965565a0d 189 LPS22HB_P_LOW_HIGH = (uint8_t)0x03
cparata 0:489965565a0d 190 }LPS22HB_OutputSignalConfig_et;
cparata 0:489965565a0d 191 #define IS_LPS22HB_OutputSignal(MODE) ((MODE == LPS22HB_DATA) || (MODE == LPS22HB_P_HIGH)||\
cparata 0:489965565a0d 192 (MODE == LPS22HB_P_LOW) || (MODE == LPS22HB_P_LOW_HIGH))
cparata 0:489965565a0d 193
cparata 0:489965565a0d 194
cparata 0:489965565a0d 195
cparata 0:489965565a0d 196 /**
cparata 0:489965565a0d 197 * @brief LPS22HB Interrupt Differential Status.
cparata 0:489965565a0d 198 */
cparata 0:489965565a0d 199
cparata 0:489965565a0d 200 typedef struct
cparata 0:489965565a0d 201 {
cparata 0:489965565a0d 202 uint8_t PH; /*!< High Differential Pressure event occured */
cparata 0:489965565a0d 203 uint8_t PL; /*!< Low Differential Pressure event occured */
cparata 0:489965565a0d 204 uint8_t IA; /*!< One or more interrupt events have been generated.Interrupt Active */
cparata 0:489965565a0d 205 uint8_t BOOT; /*!< i '1' indicates that the Boot (Reboot) phase is running */
cparata 0:489965565a0d 206 }LPS22HB_InterruptDiffStatus_st;
cparata 0:489965565a0d 207
cparata 0:489965565a0d 208
cparata 0:489965565a0d 209 /**
cparata 0:489965565a0d 210 * @brief LPS22HB Pressure and Temperature data status.
cparata 0:489965565a0d 211 */
cparata 0:489965565a0d 212 typedef struct
cparata 0:489965565a0d 213 {
cparata 0:489965565a0d 214 uint8_t TempDataAvailable; /*!< Temperature data available bit */
cparata 0:489965565a0d 215 uint8_t PressDataAvailable; /*!< Pressure data available bit */
cparata 0:489965565a0d 216 uint8_t TempDataOverrun; /*!< Temperature data over-run bit */
cparata 0:489965565a0d 217 uint8_t PressDataOverrun; /*!< Pressure data over-run bit */
cparata 0:489965565a0d 218 }LPS22HB_DataStatus_st;
cparata 0:489965565a0d 219
cparata 0:489965565a0d 220
cparata 0:489965565a0d 221 /**
cparata 0:489965565a0d 222 * @brief LPS22HB Clock Tree configuration.
cparata 0:489965565a0d 223 */
cparata 0:489965565a0d 224 typedef enum {
cparata 0:489965565a0d 225 LPS22HB_CTE_NotBalanced = (uint8_t)0x00,
cparata 0:489965565a0d 226 LPS22HB_CTE_Balanced = (uint8_t)0x20
cparata 0:489965565a0d 227 } LPS22HB_CTE_et;
cparata 0:489965565a0d 228
cparata 0:489965565a0d 229 #define IS_LPS22HB_CTE(MODE) ((MODE == LPS22HB_CTE_NotBalanced) || (MODE == LPS22HB_CTE_Balanced))
cparata 0:489965565a0d 230
cparata 0:489965565a0d 231 /**
cparata 0:489965565a0d 232 * @brief LPS22HB Fifo Mode.
cparata 0:489965565a0d 233 */
cparata 0:489965565a0d 234
cparata 0:489965565a0d 235 typedef enum {
cparata 0:489965565a0d 236 LPS22HB_FIFO_BYPASS_MODE = (uint8_t)0x00, /*!< The FIFO is disabled and empty. The pressure is read directly*/
cparata 0:489965565a0d 237 LPS22HB_FIFO_MODE = (uint8_t)0x20, /*!< Stops collecting data when full */
cparata 0:489965565a0d 238 LPS22HB_FIFO_STREAM_MODE = (uint8_t)0x40, /*!< Keep the newest measurements in the FIFO*/
cparata 0:489965565a0d 239 LPS22HB_FIFO_TRIGGER_STREAMTOFIFO_MODE = (uint8_t)0x60, /*!< STREAM MODE until trigger deasserted, then change to FIFO MODE*/
cparata 0:489965565a0d 240 LPS22HB_FIFO_TRIGGER_BYPASSTOSTREAM_MODE = (uint8_t)0x80, /*!< BYPASS MODE until trigger deasserted, then STREAM MODE*/
cparata 0:489965565a0d 241 LPS22HB_FIFO_TRIGGER_BYPASSTOFIFO_MODE = (uint8_t)0xE0 /*!< BYPASS mode until trigger deasserted, then FIFO MODE*/
cparata 0:489965565a0d 242 } LPS22HB_FifoMode_et;
cparata 0:489965565a0d 243
cparata 0:489965565a0d 244 #define IS_LPS22HB_FifoMode(MODE) ((MODE == LPS22HB_FIFO_BYPASS_MODE) || (MODE ==LPS22HB_FIFO_MODE)||\
cparata 0:489965565a0d 245 (MODE == LPS22HB_FIFO_STREAM_MODE) || (MODE == LPS22HB_FIFO_TRIGGER_STREAMTOFIFO_MODE)||\
cparata 0:489965565a0d 246 (MODE == LPS22HB_FIFO_TRIGGER_BYPASSTOSTREAM_MODE) || (MODE == LPS22HB_FIFO_TRIGGER_BYPASSTOFIFO_MODE))
cparata 0:489965565a0d 247
cparata 0:489965565a0d 248
cparata 0:489965565a0d 249 /**
cparata 0:489965565a0d 250 * @brief LPS22HB Fifo Satus.
cparata 0:489965565a0d 251 */
cparata 0:489965565a0d 252 typedef struct {
cparata 0:489965565a0d 253 uint8_t FIFO_LEVEL; /*!< FIFO Stored data level: 00000: FIFO empty; 10000: FIFO is FULL and ha 32 unread samples */
cparata 0:489965565a0d 254 uint8_t FIFO_EMPTY; /*!< Empty FIFO Flag .1 FIFO is empty (see FIFO_level) */
cparata 0:489965565a0d 255 uint8_t FIFO_FULL; /*!< Full FIFO flag.1 FIFO is Full (see FIFO_level) */
cparata 0:489965565a0d 256 uint8_t FIFO_OVR; /*!< Overrun bit status. 1 FIFO is full and at least one sample in the FIFO has been overwritten */
cparata 0:489965565a0d 257 uint8_t FIFO_FTH; /*!< FIFO Threshold (Watermark) Status. 1 FIFO filling is equal or higher then FTH (wtm) level.*/
cparata 0:489965565a0d 258 }LPS22HB_FifoStatus_st;
cparata 0:489965565a0d 259
cparata 0:489965565a0d 260
cparata 0:489965565a0d 261
cparata 0:489965565a0d 262 /**
cparata 0:489965565a0d 263 * @brief LPS22HB Configuration structure definition.
cparata 0:489965565a0d 264 */
cparata 0:489965565a0d 265 typedef struct
cparata 0:489965565a0d 266 {
cparata 0:489965565a0d 267 LPS22HB_PowerMode_et PowerMode; /*!< Enable Low Current Mode (low Power) or Low Noise Mode*/
cparata 0:489965565a0d 268 LPS22HB_Odr_et OutputDataRate; /*!< Output Data Rate */
cparata 0:489965565a0d 269 LPS22HB_Bdu_et BDU; /*!< Enable to inhibit the output registers update between the reading of upper and lower register parts.*/
cparata 0:489965565a0d 270 LPS22HB_State_et LowPassFilter; /*!< Enable/ Disable Low Pass Filter */
cparata 0:489965565a0d 271 LPS22HB_LPF_Cutoff_et LPF_Cutoff; /*!< Low Pass Filter Configuration */
cparata 0:489965565a0d 272 LPS22HB_SPIMode_et Sim; /*!< SPI Serial Interface Mode selection */
cparata 0:489965565a0d 273 LPS22HB_State_et IfAddInc; /*!< Enable/Disable Register address automatically inceremented during a multiple byte access */
cparata 0:489965565a0d 274 }LPS22HB_ConfigTypeDef_st;
cparata 0:489965565a0d 275
cparata 0:489965565a0d 276
cparata 0:489965565a0d 277 /**
cparata 0:489965565a0d 278 * @brief LPS22HB Interrupt structure definition .
cparata 0:489965565a0d 279 */
cparata 0:489965565a0d 280 typedef struct {
cparata 0:489965565a0d 281 LPS22HB_InterruptActiveLevel_et INT_H_L; /*!< Interrupt active high, low. Default value: 0 */
cparata 0:489965565a0d 282 LPS22HB_OutputType_et PP_OD; /*!< Push-pull/open drain selection on interrupt pads. Default value: 0 */
cparata 0:489965565a0d 283 LPS22HB_OutputSignalConfig_et OutputSignal_INT; /*!< Data signal on INT Pad: Data,Pressure High, Preessure Low,P High or Low*/
cparata 0:489965565a0d 284 LPS22HB_State_et DRDY; /*!< Enable/Disable Data Ready Interrupt on INT_DRDY Pin*/
cparata 0:489965565a0d 285 LPS22HB_State_et FIFO_OVR; /*!< Enable/Disable FIFO Overrun Interrupt on INT_DRDY Pin*/
cparata 0:489965565a0d 286 LPS22HB_State_et FIFO_FTH; /*!< Enable/Disable FIFO threshold (Watermark) interrupt on INT_DRDY pin.*/
cparata 0:489965565a0d 287 LPS22HB_State_et FIFO_FULL; /*!< Enable/Disable FIFO FULL interrupt on INT_DRDY pin.*/
cparata 0:489965565a0d 288 LPS22HB_State_et LatchIRQ; /*!< Latch Interrupt request in to INT_SOURCE reg*/
cparata 0:489965565a0d 289 int16_t THS_threshold; /*!< Threshold value for pressure interrupt generation*/
cparata 0:489965565a0d 290 LPS22HB_State_et AutoRifP; /*!< Enable/Disable AutoRifP function */
cparata 0:489965565a0d 291 LPS22HB_State_et AutoZero; /*!< Enable/Disable AutoZero function */
cparata 0:489965565a0d 292 }LPS22HB_InterruptTypeDef_st;
cparata 0:489965565a0d 293
cparata 0:489965565a0d 294 /**
cparata 0:489965565a0d 295 * @brief LPS22HB FIFO structure definition.
cparata 0:489965565a0d 296 */
cparata 0:489965565a0d 297 typedef struct {
cparata 0:489965565a0d 298 LPS22HB_FifoMode_et FIFO_MODE; /*!< Fifo Mode Selection */
cparata 0:489965565a0d 299 LPS22HB_State_et WTM_INT; /*!< Enable/Disable the watermark interrupt*/
cparata 0:489965565a0d 300 uint8_t WTM_LEVEL; /*!< FIFO threshold/Watermark level selection*/
cparata 0:489965565a0d 301 }LPS22HB_FIFOTypeDef_st;
cparata 0:489965565a0d 302
cparata 0:489965565a0d 303 #define IS_LPS22HB_WtmLevel(LEVEL) ((LEVEL > 0) && (LEVEL <=31))
cparata 0:489965565a0d 304 /**
cparata 0:489965565a0d 305 * @brief LPS22HB Measure Type definition.
cparata 0:489965565a0d 306 */
cparata 0:489965565a0d 307 typedef struct {
cparata 0:489965565a0d 308 int16_t Tout;
cparata 0:489965565a0d 309 int32_t Pout;
cparata 0:489965565a0d 310 }LPS22HB_MeasureTypeDef_st;
cparata 0:489965565a0d 311
cparata 0:489965565a0d 312
cparata 0:489965565a0d 313 /**
cparata 0:489965565a0d 314 * @brief LPS22HB Driver Version Info structure definition.
cparata 0:489965565a0d 315 */
cparata 0:489965565a0d 316 typedef struct {
cparata 0:489965565a0d 317 uint8_t Major;
cparata 0:489965565a0d 318 uint8_t Minor;
cparata 0:489965565a0d 319 uint8_t Point;
cparata 0:489965565a0d 320 }LPS22HB_DriverVersion_st;
cparata 0:489965565a0d 321
cparata 0:489965565a0d 322
cparata 0:489965565a0d 323 /**
cparata 0:489965565a0d 324 * @brief Bitfield positioning.
cparata 0:489965565a0d 325 */
cparata 0:489965565a0d 326 #define LPS22HB_BIT(x) ((uint8_t)x)
cparata 0:489965565a0d 327
cparata 0:489965565a0d 328 /**
cparata 0:489965565a0d 329 * @brief I2C address.
cparata 0:489965565a0d 330 */
cparata 0:489965565a0d 331 /* SD0/SA0(pin 5) is connected to the voltage supply */
cparata 0:489965565a0d 332 #define LPS22HB_ADDRESS_HIGH 0xBA /**< LPS22HB I2C Address High */
cparata 0:489965565a0d 333 /* SDO/SA0 (pin5) is connected to the GND */
cparata 0:489965565a0d 334 #define LPS22HB_ADDRESS_LOW 0xB8 /**< LPS22HB I2C Address Low */
cparata 0:489965565a0d 335
cparata 0:489965565a0d 336 /**
cparata 0:489965565a0d 337 * @brief Set the LPS22HB driver version.
cparata 0:489965565a0d 338 */
cparata 0:489965565a0d 339
cparata 0:489965565a0d 340 #define LPS22HB_DriverVersion_Major (uint8_t)1
cparata 0:489965565a0d 341 #define LPS22HB_DriverVersion_Minor (uint8_t)0
cparata 0:489965565a0d 342 #define LPS22HB_DriverVersion_Point (uint8_t)0
cparata 0:489965565a0d 343
cparata 0:489965565a0d 344 /**
cparata 0:489965565a0d 345 * @}
cparata 0:489965565a0d 346 */
cparata 0:489965565a0d 347
cparata 0:489965565a0d 348
cparata 0:489965565a0d 349 /* Exported Constants ---------------------------------------------------------*/
cparata 0:489965565a0d 350 /** @defgroup LPS22HB_Exported_Constants
cparata 0:489965565a0d 351 * @{
cparata 0:489965565a0d 352 */
cparata 0:489965565a0d 353
cparata 0:489965565a0d 354
cparata 0:489965565a0d 355 /**
cparata 0:489965565a0d 356 * @addtogroup LPS22HB_Register
cparata 0:489965565a0d 357 * @{
cparata 0:489965565a0d 358 */
cparata 0:489965565a0d 359
cparata 0:489965565a0d 360
cparata 0:489965565a0d 361
cparata 0:489965565a0d 362 /**
cparata 0:489965565a0d 363 * @brief Device Identification register.
cparata 0:489965565a0d 364 * \code
cparata 0:489965565a0d 365 * Read
cparata 0:489965565a0d 366 * Default value: 0xB1
cparata 0:489965565a0d 367 * 7:0 This read-only register contains the device identifier that, for LPS22HB, is set to B1h.
cparata 0:489965565a0d 368 * \endcode
cparata 0:489965565a0d 369 */
cparata 0:489965565a0d 370
cparata 0:489965565a0d 371 #define LPS22HB_WHO_AM_I_REG (uint8_t)0x0F
cparata 0:489965565a0d 372
cparata 0:489965565a0d 373 /**
cparata 0:489965565a0d 374 * @brief Device Identification value.
cparata 0:489965565a0d 375 */
cparata 0:489965565a0d 376 #define LPS22HB_WHO_AM_I_VAL (uint8_t)0xB1
cparata 0:489965565a0d 377
cparata 0:489965565a0d 378
cparata 0:489965565a0d 379 /**
cparata 0:489965565a0d 380 * @brief Reference Pressure Register(LSB data)
cparata 0:489965565a0d 381 * \code
cparata 0:489965565a0d 382 * Read/write
cparata 0:489965565a0d 383 * Default value: 0x00
cparata 0:489965565a0d 384 * 7:0 REFL7-0: Lower part of the reference pressure value that
cparata 0:489965565a0d 385 * is sum to the sensor output pressure.
cparata 0:489965565a0d 386 * \endcode
cparata 0:489965565a0d 387 */
cparata 0:489965565a0d 388 #define LPS22HB_REF_P_XL_REG (uint8_t)0x15
cparata 0:489965565a0d 389
cparata 0:489965565a0d 390
cparata 0:489965565a0d 391 /**
cparata 0:489965565a0d 392 * @brief Reference Pressure Register (Middle data)
cparata 0:489965565a0d 393 * \code
cparata 0:489965565a0d 394 * Read/write
cparata 0:489965565a0d 395 * Default value: 0x00
cparata 0:489965565a0d 396 * 7:0 REFL15-8: Middle part of the reference pressure value that
cparata 0:489965565a0d 397 * is sum to the sensor output pressure.
cparata 0:489965565a0d 398 * \endcode
cparata 0:489965565a0d 399 */
cparata 0:489965565a0d 400 #define LPS22HB_REF_P_L_REG (uint8_t)0x16
cparata 0:489965565a0d 401
cparata 0:489965565a0d 402 /**
cparata 0:489965565a0d 403 * @brief Reference Pressure Register (MSB data)
cparata 0:489965565a0d 404 * \code
cparata 0:489965565a0d 405 * Read/write
cparata 0:489965565a0d 406 * Default value: 0x00
cparata 0:489965565a0d 407 * 7:0 REFL23-16 Higest part of the reference pressure value that
cparata 0:489965565a0d 408 * is sum to the sensor output pressure.
cparata 0:489965565a0d 409 * \endcode
cparata 0:489965565a0d 410 */
cparata 0:489965565a0d 411 #define LPS22HB_REF_P_H_REG (uint8_t)0x17
cparata 0:489965565a0d 412
cparata 0:489965565a0d 413
cparata 0:489965565a0d 414 /**
cparata 0:489965565a0d 415 * @brief Pressure and temperature resolution mode Register
cparata 0:489965565a0d 416 * \code
cparata 0:489965565a0d 417 * Read/write
cparata 0:489965565a0d 418 * Default value: 0x05
cparata 0:489965565a0d 419 * 7:2 These bits must be set to 0 for proper operation of the device
cparata 0:489965565a0d 420 * 1: Reserved
cparata 0:489965565a0d 421 * 0 LC_EN: Low Current Mode Enable. Default 0
cparata 0:489965565a0d 422 * \endcode
cparata 0:489965565a0d 423 */
cparata 0:489965565a0d 424 #define LPS22HB_RES_CONF_REG (uint8_t)0x1A
cparata 0:489965565a0d 425
cparata 0:489965565a0d 426 #define LPS22HB_LCEN_MASK (uint8_t)0x01
cparata 0:489965565a0d 427
cparata 0:489965565a0d 428 /**
cparata 0:489965565a0d 429 * @brief Control Register 1
cparata 0:489965565a0d 430 * \code
cparata 0:489965565a0d 431 * Read/write
cparata 0:489965565a0d 432 * Default value: 0x00
cparata 0:489965565a0d 433 * 7: This bit must be set to 0 for proper operation of the device
cparata 0:489965565a0d 434 * 6:4 ODR2, ODR1, ODR0: output data rate selection.Default 000
cparata 0:489965565a0d 435 * ODR2 | ODR1 | ODR0 | Pressure output data-rate(Hz) | Pressure output data-rate(Hz)
cparata 0:489965565a0d 436 * ----------------------------------------------------------------------------------
cparata 0:489965565a0d 437 * 0 | 0 | 0 | one shot | one shot
cparata 0:489965565a0d 438 * 0 | 0 | 1 | 1 | 1
cparata 0:489965565a0d 439 * 0 | 1 | 0 | 10 | 10
cparata 0:489965565a0d 440 * 0 | 1 | 1 | 25 | 25
cparata 0:489965565a0d 441 * 1 | 0 | 0 | 50 | 50
cparata 0:489965565a0d 442 * 1 | 0 | 1 | 75 | 75
cparata 0:489965565a0d 443 * 1 | 1 | 0 | Reserved | Reserved
cparata 0:489965565a0d 444 * 1 | 1 | 1 | Reserved | Reserved
cparata 0:489965565a0d 445 *
cparata 0:489965565a0d 446 * 3 EN_LPFP: Enable Low Pass filter on Pressure data. Default value:0
cparata 0:489965565a0d 447 * 2:LPF_CFG Low-pass configuration register. (0: Filter cutoff is ODR/9; 1: filter cutoff is ODR/20)
cparata 0:489965565a0d 448 * 1 BDU: block data update. 0 - continuous update; 1 - output registers not updated until MSB and LSB reading.
cparata 0:489965565a0d 449 * 0 SIM: SPI Serial Interface Mode selection. 0 - SPI 4-wire; 1 - SPI 3-wire
cparata 0:489965565a0d 450 * \endcode
cparata 0:489965565a0d 451 */
cparata 0:489965565a0d 452 #define LPS22HB_CTRL_REG1 (uint8_t)0x10
cparata 0:489965565a0d 453
cparata 0:489965565a0d 454 #define LPS22HB_ODR_MASK (uint8_t)0x70
cparata 0:489965565a0d 455 #define LPS22HB_LPFP_MASK (uint8_t)0x08
cparata 0:489965565a0d 456 #define LPS22HB_LPFP_CUTOFF_MASK (uint8_t)0x04
cparata 0:489965565a0d 457 #define LPS22HB_BDU_MASK (uint8_t)0x02
cparata 0:489965565a0d 458 #define LPS22HB_SIM_MASK (uint8_t)0x01
cparata 0:489965565a0d 459
cparata 0:489965565a0d 460 #define LPS22HB_LPFP_BIT LPS22HB_BIT(3)
cparata 0:489965565a0d 461
cparata 0:489965565a0d 462
cparata 0:489965565a0d 463 /**
cparata 0:489965565a0d 464 * @brief Control Register 2
cparata 0:489965565a0d 465 * \code
cparata 0:489965565a0d 466 * Read/write
cparata 0:489965565a0d 467 * Default value: 0x10
cparata 0:489965565a0d 468 * 7 BOOT: Reboot memory content. 0: normal mode; 1: reboot memory content. Self-clearing upon completation
cparata 0:489965565a0d 469 * 6 FIFO_EN: FIFO Enable. 0: disable; 1: enable
cparata 0:489965565a0d 470 * 5 STOP_ON_FTH: Stop on FIFO Threshold FIFO Watermark level use. 0: disable; 1: enable
cparata 0:489965565a0d 471 * 4 IF_ADD_INC: Register address automatically incrementeed during a multiple byte access with a serial interface (I2C or SPI). Default value 1.( 0: disable; 1: enable)
cparata 0:489965565a0d 472 * 3 I2C DIS: Disable I2C interface 0: I2C Enabled; 1: I2C disabled
cparata 0:489965565a0d 473 * 2 SWRESET: Software reset. 0: normal mode; 1: SW reset. Self-clearing upon completation
cparata 0:489965565a0d 474 * 1 AUTO_ZERO: Autozero enable. 0: normal mode; 1: autozero enable.
cparata 0:489965565a0d 475 * 0 ONE_SHOT: One shot enable. 0: waiting for start of conversion; 1: start for a new dataset
cparata 0:489965565a0d 476 * \endcode
cparata 0:489965565a0d 477 */
cparata 0:489965565a0d 478 #define LPS22HB_CTRL_REG2 (uint8_t)0x11
cparata 0:489965565a0d 479
cparata 0:489965565a0d 480 #define LPS22HB_BOOT_BIT LPS22HB_BIT(7)
cparata 0:489965565a0d 481 #define LPS22HB_FIFO_EN_BIT LPS22HB_BIT(6)
cparata 0:489965565a0d 482 #define LPS22HB_WTM_EN_BIT LPS22HB_BIT(5)
cparata 0:489965565a0d 483 #define LPS22HB_ADD_INC_BIT LPS22HB_BIT(4)
cparata 0:489965565a0d 484 #define LPS22HB_I2C_BIT LPS22HB_BIT(3)
cparata 0:489965565a0d 485 #define LPS22HB_SW_RESET_BIT LPS22HB_BIT(2)
cparata 0:489965565a0d 486
cparata 0:489965565a0d 487 #define LPS22HB_FIFO_EN_MASK (uint8_t)0x40
cparata 0:489965565a0d 488 #define LPS22HB_WTM_EN_MASK (uint8_t)0x20
cparata 0:489965565a0d 489 #define LPS22HB_ADD_INC_MASK (uint8_t)0x10
cparata 0:489965565a0d 490 #define LPS22HB_I2C_MASK (uint8_t)0x08
cparata 0:489965565a0d 491 #define LPS22HB_ONE_SHOT_MASK (uint8_t)0x01
cparata 0:489965565a0d 492
cparata 0:489965565a0d 493
cparata 0:489965565a0d 494 /**
cparata 0:489965565a0d 495 * @brief CTRL Reg3 Interrupt Control Register
cparata 0:489965565a0d 496 * \code
cparata 0:489965565a0d 497 * Read/write
cparata 0:489965565a0d 498 * Default value: 0x00
cparata 0:489965565a0d 499 * 7 INT_H_L: Interrupt active high, low. 0:active high; 1: active low.
cparata 0:489965565a0d 500 * 6 PP_OD: Push-Pull/OpenDrain selection on interrupt pads. 0: Push-pull; 1: open drain.
cparata 0:489965565a0d 501 * 5 F_FSS5: FIFO full flag on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
cparata 0:489965565a0d 502 * 4 F_FTH: FIFO threshold (watermark) status on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
cparata 0:489965565a0d 503 * 3 F_OVR: FIFO overrun interrupt on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
cparata 0:489965565a0d 504 * 2 DRDY: Data-ready signal on INT_DRDY pin. Defaul value: 0. (0: Diasable; 1 : Enable).
cparata 0:489965565a0d 505 * 1:0 INT_S2, INT_S1: data signal on INT pad control bits.
cparata 0:489965565a0d 506 * INT_S2 | INT_S1 | INT pin
cparata 0:489965565a0d 507 * ------------------------------------------------------
cparata 0:489965565a0d 508 * 0 | 0 | Data signal( in order of priority:PTH_DRDY or F_FTH or F_OVR_or F_FSS5
cparata 0:489965565a0d 509 * 0 | 1 | Pressure high (P_high)
cparata 0:489965565a0d 510 * 1 | 0 | Pressure low (P_low)
cparata 0:489965565a0d 511 * 1 | 1 | P_low OR P_high
cparata 0:489965565a0d 512 * \endcode
cparata 0:489965565a0d 513 */
cparata 0:489965565a0d 514 #define LPS22HB_CTRL_REG3 (uint8_t)0x12
cparata 0:489965565a0d 515
cparata 0:489965565a0d 516 #define LPS22HB_PP_OD_BIT LPS22HB_BIT(6)
cparata 0:489965565a0d 517 #define LPS22HB_FIFO_FULL_BIT LPS22HB_BIT(5)
cparata 0:489965565a0d 518 #define LPS22HB_FIFO_FTH_BIT LPS22HB_BIT(4)
cparata 0:489965565a0d 519 #define LPS22HB_FIFO_OVR_BIT LPS22HB_BIT(3)
cparata 0:489965565a0d 520 #define LPS22HB_DRDY_BIT LPS22HB_BIT(2)
cparata 0:489965565a0d 521
cparata 0:489965565a0d 522
cparata 0:489965565a0d 523 #define LPS22HB_INT_H_L_MASK (uint8_t)0x80
cparata 0:489965565a0d 524 #define LPS22HB_PP_OD_MASK (uint8_t)0x40
cparata 0:489965565a0d 525 #define LPS22HB_FIFO_FULL_MASK (uint8_t)0x20
cparata 0:489965565a0d 526 #define LPS22HB_FIFO_FTH_MASK (uint8_t)0x10
cparata 0:489965565a0d 527 #define LPS22HB_FIFO_OVR_MASK (uint8_t)0x08
cparata 0:489965565a0d 528 #define LPS22HB_DRDY_MASK (uint8_t)0x04
cparata 0:489965565a0d 529 #define LPS22HB_INT_S12_MASK (uint8_t)0x03
cparata 0:489965565a0d 530
cparata 0:489965565a0d 531
cparata 0:489965565a0d 532 /**
cparata 0:489965565a0d 533 * @brief Interrupt Differential configuration Register
cparata 0:489965565a0d 534 * \code
cparata 0:489965565a0d 535 * Read/write
cparata 0:489965565a0d 536 * Default value: 0x00.
cparata 0:489965565a0d 537 * 7 AUTORIFP: AutoRifP Enable ??
cparata 0:489965565a0d 538 * 6 RESET_ARP: Reset AutoRifP function
cparata 0:489965565a0d 539 * 4 AUTOZERO: Autozero enabled
cparata 0:489965565a0d 540 * 5 RESET_AZ: Reset Autozero Function
cparata 0:489965565a0d 541 * 3 DIFF_EN: Interrupt generation enable
cparata 0:489965565a0d 542 * 2 LIR: Latch Interrupt request into INT_SOURCE register. 0 - interrupt request not latched; 1 - interrupt request latched
cparata 0:489965565a0d 543 * 1 PL_E: Enable interrupt generation on differential pressure low event. 0 - disable; 1 - enable
cparata 0:489965565a0d 544 * 0 PH_E: Enable interrupt generation on differential pressure high event. 0 - disable; 1 - enable
cparata 0:489965565a0d 545 * \endcode
cparata 0:489965565a0d 546 */
cparata 0:489965565a0d 547 #define LPS22HB_INTERRUPT_CFG_REG (uint8_t)0x0B
cparata 0:489965565a0d 548
cparata 0:489965565a0d 549 #define LPS22HB_DIFF_EN_BIT LPS22HB_BIT(3)
cparata 0:489965565a0d 550 #define LPS22HB_LIR_BIT LPS22HB_BIT(2)
cparata 0:489965565a0d 551 #define LPS22HB_PLE_BIT LPS22HB_BIT(1)
cparata 0:489965565a0d 552 #define LPS22HB_PHE_BIT LPS22HB_BIT(0)
cparata 0:489965565a0d 553
cparata 0:489965565a0d 554 #define LPS22HB_AUTORIFP_MASK (uint8_t)0x80
cparata 0:489965565a0d 555 #define LPS22HB_RESET_ARP_MASK (uint8_t)0x40
cparata 0:489965565a0d 556 #define LPS22HB_AUTOZERO_MASK (uint8_t)0x20
cparata 0:489965565a0d 557 #define LPS22HB_RESET_AZ_MASK (uint8_t)0x10
cparata 0:489965565a0d 558 #define LPS22HB_DIFF_EN_MASK (uint8_t)0x08
cparata 0:489965565a0d 559 #define LPS22HB_LIR_MASK (uint8_t)0x04
cparata 0:489965565a0d 560 #define LPS22HB_PLE_MASK (uint8_t)0x02
cparata 0:489965565a0d 561 #define LPS22HB_PHE_MASK (uint8_t)0x01
cparata 0:489965565a0d 562
cparata 0:489965565a0d 563
cparata 0:489965565a0d 564
cparata 0:489965565a0d 565 /**
cparata 0:489965565a0d 566 * @brief Interrupt source Register (It is cleared by reading it)
cparata 0:489965565a0d 567 * \code
cparata 0:489965565a0d 568 * Read
cparata 0:489965565a0d 569 * Default value: ----.
cparata 0:489965565a0d 570 * 7 BOOT_STATUS: If 1 indicates that the Boot (Reboot) phase is running.
cparata 0:489965565a0d 571 * 6:3 Reserved: Keep these bits at 0
cparata 0:489965565a0d 572 * 2 IA: Interrupt Active.0: no interrupt has been generated; 1: one or more interrupt events have been generated.
cparata 0:489965565a0d 573 * 1 PL: Differential pressure Low. 0: no interrupt has been generated; 1: Low differential pressure event has occurred.
cparata 0:489965565a0d 574 * 0 PH: Differential pressure High. 0: no interrupt has been generated; 1: High differential pressure event has occurred.
cparata 0:489965565a0d 575 * \endcode
cparata 0:489965565a0d 576 */
cparata 0:489965565a0d 577 #define LPS22HB_INTERRUPT_SOURCE_REG (uint8_t)0x25
cparata 0:489965565a0d 578
cparata 0:489965565a0d 579 #define LPS22HB_BOOT_STATUS_BIT LPS22HB_BIT(7)
cparata 0:489965565a0d 580 #define LPS22HB_IA_BIT LPS22HB_BIT(2)
cparata 0:489965565a0d 581 #define LPS22HB_PL_BIT LPS22HB_BIT(1)
cparata 0:489965565a0d 582 #define LPS22HB_PH_BIT LPS22HB_BIT(0)
cparata 0:489965565a0d 583
cparata 0:489965565a0d 584 #define LPS22HB_BOOT_STATUS_MASK (uint8_t)0x80
cparata 0:489965565a0d 585 #define LPS22HB_IA_MASK (uint8_t)0x04
cparata 0:489965565a0d 586 #define LPS22HB_PL_MASK (uint8_t)0x02
cparata 0:489965565a0d 587 #define LPS22HB_PH_MASK (uint8_t)0x01
cparata 0:489965565a0d 588
cparata 0:489965565a0d 589
cparata 0:489965565a0d 590 /**
cparata 0:489965565a0d 591 * @brief Status Register
cparata 0:489965565a0d 592 * \code
cparata 0:489965565a0d 593 * Read
cparata 0:489965565a0d 594 * Default value: ---
cparata 0:489965565a0d 595 * 7:6 Reserved: 0
cparata 0:489965565a0d 596 * 5 T_OR: Temperature data overrun. 0: no overrun has occurred; 1: a new data for temperature has overwritten the previous one.
cparata 0:489965565a0d 597 * 4 P_OR: Pressure data overrun. 0: no overrun has occurred; 1: new data for pressure has overwritten the previous one.
cparata 0:489965565a0d 598 * 3:2 Reserved: 0
cparata 0:489965565a0d 599 * 1 T_DA: Temperature data available. 0: new data for temperature is not yet available; 1: new data for temperature is available.
cparata 0:489965565a0d 600 * 0 P_DA: Pressure data available. 0: new data for pressure is not yet available; 1: new data for pressure is available.
cparata 0:489965565a0d 601 * \endcode
cparata 0:489965565a0d 602 */
cparata 0:489965565a0d 603 #define LPS22HB_STATUS_REG (uint8_t)0x27
cparata 0:489965565a0d 604
cparata 0:489965565a0d 605 #define LPS22HB_TOR_BIT LPS22HB_BIT(5)
cparata 0:489965565a0d 606 #define LPS22HB_POR_BIT LPS22HB_BIT(4)
cparata 0:489965565a0d 607 #define LPS22HB_TDA_BIT LPS22HB_BIT(1)
cparata 0:489965565a0d 608 #define LPS22HB_PDA_BIT LPS22HB_BIT(0)
cparata 0:489965565a0d 609
cparata 0:489965565a0d 610 #define LPS22HB_TOR_MASK (uint8_t)0x20
cparata 0:489965565a0d 611 #define LPS22HB_POR_MASK (uint8_t)0x10
cparata 0:489965565a0d 612 #define LPS22HB_TDA_MASK (uint8_t)0x02
cparata 0:489965565a0d 613 #define LPS22HB_PDA_MASK (uint8_t)0x01
cparata 0:489965565a0d 614
cparata 0:489965565a0d 615
cparata 0:489965565a0d 616
cparata 0:489965565a0d 617 /**
cparata 0:489965565a0d 618 * @brief Pressure data (LSB) register.
cparata 0:489965565a0d 619 * \code
cparata 0:489965565a0d 620 * Read
cparata 0:489965565a0d 621 * Default value: 0x00.(To be verified)
cparata 0:489965565a0d 622 * POUT7 - POUT0: Pressure data LSB (2's complement).
cparata 0:489965565a0d 623 * Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
cparata 0:489965565a0d 624 * PRESS_OUT_XL)[dec]/4096.
cparata 0:489965565a0d 625 * \endcode
cparata 0:489965565a0d 626 */
cparata 0:489965565a0d 627
cparata 0:489965565a0d 628 #define LPS22HB_PRESS_OUT_XL_REG (uint8_t)0x28
cparata 0:489965565a0d 629 /**
cparata 0:489965565a0d 630 * @brief Pressure data (Middle part) register.
cparata 0:489965565a0d 631 * \code
cparata 0:489965565a0d 632 * Read
cparata 0:489965565a0d 633 * Default value: 0x80.
cparata 0:489965565a0d 634 * POUT15 - POUT8: Pressure data middle part (2's complement).
cparata 0:489965565a0d 635 * Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
cparata 0:489965565a0d 636 * PRESS_OUT_XL)[dec]/4096.
cparata 0:489965565a0d 637 * \endcode
cparata 0:489965565a0d 638 */
cparata 0:489965565a0d 639 #define LPS22HB_PRESS_OUT_L_REG (uint8_t)0x29
cparata 0:489965565a0d 640
cparata 0:489965565a0d 641 /**
cparata 0:489965565a0d 642 * @brief Pressure data (MSB) register.
cparata 0:489965565a0d 643 * \code
cparata 0:489965565a0d 644 * Read
cparata 0:489965565a0d 645 * Default value: 0x2F.
cparata 0:489965565a0d 646 * POUT23 - POUT16: Pressure data MSB (2's complement).
cparata 0:489965565a0d 647 * Pressure output data: Pout(hPA)=(PRESS_OUT_H & PRESS_OUT_L &
cparata 0:489965565a0d 648 * PRESS_OUT_XL)[dec]/4096.
cparata 0:489965565a0d 649 * \endcode
cparata 0:489965565a0d 650 */
cparata 0:489965565a0d 651 #define LPS22HB_PRESS_OUT_H_REG (uint8_t)0x2A
cparata 0:489965565a0d 652
cparata 0:489965565a0d 653 /**
cparata 0:489965565a0d 654 * @brief Temperature data (LSB) register.
cparata 0:489965565a0d 655 * \code
cparata 0:489965565a0d 656 * Read
cparata 0:489965565a0d 657 * Default value: 0x00.
cparata 0:489965565a0d 658 * TOUT7 - TOUT0: temperature data LSB.
cparata 0:489965565a0d 659 * Tout(degC)=TEMP_OUT/100
cparata 0:489965565a0d 660 * \endcode
cparata 0:489965565a0d 661 */
cparata 0:489965565a0d 662 #define LPS22HB_TEMP_OUT_L_REG (uint8_t)0x2B
cparata 0:489965565a0d 663
cparata 0:489965565a0d 664 /**
cparata 0:489965565a0d 665 * @brief Temperature data (MSB) register.
cparata 0:489965565a0d 666 * \code
cparata 0:489965565a0d 667 * Read
cparata 0:489965565a0d 668 * Default value: 0x00.
cparata 0:489965565a0d 669 * TOUT15 - TOUT8: temperature data MSB.
cparata 0:489965565a0d 670 * Tout(degC)=TEMP_OUT/100
cparata 0:489965565a0d 671 * \endcode
cparata 0:489965565a0d 672 */
cparata 0:489965565a0d 673 #define LPS22HBH_TEMP_OUT_H_REG (uint8_t)0x2C
cparata 0:489965565a0d 674
cparata 0:489965565a0d 675 /**
cparata 0:489965565a0d 676 * @brief Threshold pressure (LSB) register.
cparata 0:489965565a0d 677 * \code
cparata 0:489965565a0d 678 * Read/write
cparata 0:489965565a0d 679 * Default value: 0x00.
cparata 0:489965565a0d 680 * 7:0 THS7-THS0: LSB Threshold pressure Low part of threshold value for pressure interrupt
cparata 0:489965565a0d 681 * generation. The complete threshold value is given by THS_P_H & THS_P_L and is
cparata 0:489965565a0d 682 * expressed as unsigned number. P_ths(hPA)=(THS_P_H & THS_P_L)[dec]/16.
cparata 0:489965565a0d 683 * \endcode
cparata 0:489965565a0d 684 */
cparata 0:489965565a0d 685 #define LPS22HB_THS_P_LOW_REG (uint8_t)0x0C
cparata 0:489965565a0d 686
cparata 0:489965565a0d 687 /**
cparata 0:489965565a0d 688 * @brief Threshold pressure (MSB)
cparata 0:489965565a0d 689 * \code
cparata 0:489965565a0d 690 * Read/write
cparata 0:489965565a0d 691 * Default value: 0x00.
cparata 0:489965565a0d 692 * 7:0 THS15-THS8: MSB Threshold pressure. High part of threshold value for pressure interrupt
cparata 0:489965565a0d 693 * generation. The complete threshold value is given by THS_P_H & THS_P_L and is
cparata 0:489965565a0d 694 * expressed as unsigned number. P_ths(mbar)=(THS_P_H & THS_P_L)[dec]/16.
cparata 0:489965565a0d 695 * \endcode
cparata 0:489965565a0d 696 */
cparata 0:489965565a0d 697 #define LPS22HB_THS_P_HIGH_REG (uint8_t)0x0D
cparata 0:489965565a0d 698
cparata 0:489965565a0d 699 /**
cparata 0:489965565a0d 700 * @brief FIFO control register
cparata 0:489965565a0d 701 * \code
cparata 0:489965565a0d 702 * Read/write
cparata 0:489965565a0d 703 * Default value: 0x00
cparata 0:489965565a0d 704 * 7:5 F_MODE2, F_MODE1, F_MODE0: FIFO mode selection.
cparata 0:489965565a0d 705 * FM2 | FM1 | FM0 | FIFO MODE
cparata 0:489965565a0d 706 * ---------------------------------------------------
cparata 0:489965565a0d 707 * 0 | 0 | 0 | BYPASS MODE
cparata 0:489965565a0d 708 * 0 | 0 | 1 | FIFO MODE. Stops collecting data when full
cparata 0:489965565a0d 709 * 0 | 1 | 0 | STREAM MODE: Keep the newest measurements in the FIFO
cparata 0:489965565a0d 710 * 0 | 1 | 1 | STREAM MODE until trigger deasserted, then change to FIFO MODE
cparata 0:489965565a0d 711 * 1 | 0 | 0 | BYPASS MODE until trigger deasserted, then STREAM MODE
cparata 0:489965565a0d 712 * 1 | 0 | 1 | Reserved for future use
cparata 0:489965565a0d 713 * 1 | 1 | 0 | Reserved
cparata 0:489965565a0d 714 * 1 | 1 | 1 | BYPASS mode until trigger deasserted, then FIFO MODE
cparata 0:489965565a0d 715 *
cparata 0:489965565a0d 716 * 4:0 WTM_POINT4-0 : FIFO Watermark level selection (0-31)
cparata 0:489965565a0d 717 */
cparata 0:489965565a0d 718 #define LPS22HB_CTRL_FIFO_REG (uint8_t)0x14
cparata 0:489965565a0d 719
cparata 0:489965565a0d 720 #define LPS22HB_FIFO_MODE_MASK (uint8_t)0xE0
cparata 0:489965565a0d 721 #define LPS22HB_WTM_POINT_MASK (uint8_t)0x1F
cparata 0:489965565a0d 722
cparata 0:489965565a0d 723
cparata 0:489965565a0d 724 /**
cparata 0:489965565a0d 725 * @brief FIFO Status register
cparata 0:489965565a0d 726 * \code
cparata 0:489965565a0d 727 * Read
cparata 0:489965565a0d 728 * Default value: ----
cparata 0:489965565a0d 729 * 7 FTH_FIFO: FIFO threshold status. 0:FIFO filling is lower than FTH level; 1: FIFO is equal or higher than FTH level.
cparata 0:489965565a0d 730 * 6 OVR: Overrun bit status. 0 - FIFO not full; 1 -FIFO is full and at least one sample in the FIFO has been overwritten.
cparata 0:489965565a0d 731 * 5:0 FSS: FIFO Stored data level. 000000: FIFO empty, 100000: FIFO is full and has 32 unread samples.
cparata 0:489965565a0d 732 * \endcode
cparata 0:489965565a0d 733 */
cparata 0:489965565a0d 734 #define LPS22HB_STATUS_FIFO_REG (uint8_t)0x26
cparata 0:489965565a0d 735
cparata 0:489965565a0d 736 #define LPS22HB_FTH_FIFO_BIT LPS22HB_BIT(7)
cparata 0:489965565a0d 737 #define LPS22HB_OVR_FIFO_BIT LPS22HB_BIT(6)
cparata 0:489965565a0d 738
cparata 0:489965565a0d 739 #define LPS22HB_FTH_FIFO_MASK (uint8_t)0x80
cparata 0:489965565a0d 740 #define LPS22HB_OVR_FIFO_MASK (uint8_t)0x40
cparata 0:489965565a0d 741 #define LPS22HB_LEVEL_FIFO_MASK (uint8_t)0x3F
cparata 0:489965565a0d 742 #define LPS22HB_FIFO_EMPTY (uint8_t)0x00
cparata 0:489965565a0d 743 #define LPS22HB_FIFO_FULL (uint8_t)0x20
cparata 0:489965565a0d 744
cparata 0:489965565a0d 745
cparata 0:489965565a0d 746
cparata 0:489965565a0d 747 /**
cparata 0:489965565a0d 748 * @brief Pressure offset register (LSB)
cparata 0:489965565a0d 749 * \code
cparata 0:489965565a0d 750 * Read/write
cparata 0:489965565a0d 751 * Default value: 0x00
cparata 0:489965565a0d 752 * 7:0 RPDS7-0:Pressure Offset for 1 point calibration (OPC) after soldering.
cparata 0:489965565a0d 753 * This register contains the low part of the pressure offset value after soldering,for
cparata 0:489965565a0d 754 * differential pressure computing. The complete value is given by RPDS_L & RPDS_H
cparata 0:489965565a0d 755 * and is expressed as signed 2 complement value.
cparata 0:489965565a0d 756 * \endcode
cparata 0:489965565a0d 757 */
cparata 0:489965565a0d 758 #define LPS22HB_RPDS_L_REG (uint8_t)0x18
cparata 0:489965565a0d 759
cparata 0:489965565a0d 760 /**
cparata 0:489965565a0d 761 * @brief Pressure offset register (MSB)
cparata 0:489965565a0d 762 * \code
cparata 0:489965565a0d 763 * Read/write
cparata 0:489965565a0d 764 * Default value: 0x00
cparata 0:489965565a0d 765 * 7:0 RPDS15-8:Pressure Offset for 1 point calibration (OPC) after soldering.
cparata 0:489965565a0d 766 * This register contains the high part of the pressure offset value after soldering (see description RPDS_L)
cparata 0:489965565a0d 767 * \endcode
cparata 0:489965565a0d 768 */
cparata 0:489965565a0d 769 #define LPS22HB_RPDS_H_REG (uint8_t)0x19
cparata 0:489965565a0d 770
cparata 0:489965565a0d 771
cparata 0:489965565a0d 772 /**
cparata 0:489965565a0d 773 * @brief Clock Tree Configuration register
cparata 0:489965565a0d 774 * \code
cparata 0:489965565a0d 775 * Read/write
cparata 0:489965565a0d 776 * Default value: 0x00
cparata 0:489965565a0d 777 * 7:6 Reserved.
cparata 0:489965565a0d 778 * 5: CTE: Clock Tree Enhancement
cparata 0:489965565a0d 779 * \endcode
cparata 0:489965565a0d 780 */
cparata 0:489965565a0d 781
cparata 0:489965565a0d 782 #define LPS22HB_CLOCK_TREE_CONFIGURATION (uint8_t)0x43
cparata 0:489965565a0d 783
cparata 0:489965565a0d 784 #define LPS22HB_CTE_MASK (uint8_t)0x20
cparata 0:489965565a0d 785
cparata 0:489965565a0d 786 /**
cparata 0:489965565a0d 787 * @}
cparata 0:489965565a0d 788 */
cparata 0:489965565a0d 789
cparata 0:489965565a0d 790
cparata 0:489965565a0d 791 /**
cparata 0:489965565a0d 792 * @}
cparata 0:489965565a0d 793 */
cparata 0:489965565a0d 794
cparata 0:489965565a0d 795
cparata 0:489965565a0d 796 /* Exported Functions -------------------------------------------------------------*/
cparata 0:489965565a0d 797 /** @defgroup LPS22HB_Exported_Functions
cparata 0:489965565a0d 798 * @{
cparata 0:489965565a0d 799 */
cparata 0:489965565a0d 800
cparata 0:489965565a0d 801 LPS22HB_Error_et LPS22HB_ReadReg( void *handle, uint8_t RegAddr, uint16_t NumByteToRead, uint8_t *Data );
cparata 0:489965565a0d 802 LPS22HB_Error_et LPS22HB_WriteReg( void *handle, uint8_t RegAddr, uint16_t NumByteToWrite, uint8_t *Data );
cparata 0:489965565a0d 803
cparata 0:489965565a0d 804 /**
cparata 0:489965565a0d 805 * @brief Init the HAL layer.
cparata 0:489965565a0d 806 * @param None
cparata 0:489965565a0d 807 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 808 */
cparata 0:489965565a0d 809 #define LPS22HB_HalInit (LPS22HB_Error_et)HAL_Init_I2C
cparata 0:489965565a0d 810
cparata 0:489965565a0d 811 /**
cparata 0:489965565a0d 812 * @brief DeInit the HAL layer.
cparata 0:489965565a0d 813 * @param None
cparata 0:489965565a0d 814 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 815 */
cparata 0:489965565a0d 816 #define LPS22HB_HalDeInit (LPS22HB_Error_et)HAL_DeInit_I2C
cparata 0:489965565a0d 817
cparata 0:489965565a0d 818
cparata 0:489965565a0d 819 /**
cparata 0:489965565a0d 820 * @brief Get the LPS22HB driver version.
cparata 0:489965565a0d 821 * @param None
cparata 0:489965565a0d 822 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 823 */
cparata 0:489965565a0d 824 LPS22HB_Error_et LPS22HB_Get_DriverVersion(LPS22HB_DriverVersion_st *Version);
cparata 0:489965565a0d 825
cparata 0:489965565a0d 826 /**
cparata 0:489965565a0d 827 * @brief Initialization function for LPS22HB.
cparata 0:489965565a0d 828 * This function make a memory boot.
cparata 0:489965565a0d 829 * Init the sensor with a standard basic confifuration.
cparata 0:489965565a0d 830 * Low Power, ODR 25 Hz, Low Pass Filter disabled; BDU enabled; I2C enabled;
cparata 0:489965565a0d 831 * NO FIFO; NO Interrupt Enabled.
cparata 0:489965565a0d 832 * @param None.
cparata 0:489965565a0d 833 * @retval Error code[LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 834 */
cparata 0:489965565a0d 835 LPS22HB_Error_et LPS22HB_Init(void *handle);
cparata 0:489965565a0d 836
cparata 0:489965565a0d 837 /**
cparata 0:489965565a0d 838 * @brief DeInit the LPS2Hb driver.
cparata 0:489965565a0d 839 * @param None
cparata 0:489965565a0d 840 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 841 */
cparata 0:489965565a0d 842
cparata 0:489965565a0d 843 LPS22HB_Error_et LPS22HB_DeInit(void *handle);
cparata 0:489965565a0d 844
cparata 0:489965565a0d 845
cparata 0:489965565a0d 846 /**
cparata 0:489965565a0d 847 * @brief Read identification code by WHO_AM_I register
cparata 0:489965565a0d 848 * @param Buffer to empty by Device identification Value.
cparata 0:489965565a0d 849 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 850 */
cparata 0:489965565a0d 851 LPS22HB_Error_et LPS22HB_Get_DeviceID(void *handle, uint8_t* deviceid);
cparata 0:489965565a0d 852
cparata 0:489965565a0d 853
cparata 0:489965565a0d 854 /**
cparata 0:489965565a0d 855 * @brief Set LPS22HB Low Power or Low Noise Mode Configuration
cparata 0:489965565a0d 856 * @param LPS22HB_LowNoise or LPS22HB_LowPower mode
cparata 0:489965565a0d 857 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 858 */
cparata 0:489965565a0d 859 LPS22HB_Error_et LPS22HB_Set_PowerMode(void *handle, LPS22HB_PowerMode_et mode);
cparata 0:489965565a0d 860
cparata 0:489965565a0d 861 /**
cparata 0:489965565a0d 862 * @brief Get LPS22HB Power Mode
cparata 0:489965565a0d 863 * @param Buffer to empty with Mode: Low Noise or Low Current
cparata 0:489965565a0d 864 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 865 */
cparata 0:489965565a0d 866 LPS22HB_Error_et LPS22HB_Get_PowerMode(void *handle, LPS22HB_PowerMode_et* mode);
cparata 0:489965565a0d 867
cparata 0:489965565a0d 868
cparata 0:489965565a0d 869 /**
cparata 0:489965565a0d 870 * @brief Set LPS22HB Output Data Rate
cparata 0:489965565a0d 871 * @param Output Data Rate
cparata 0:489965565a0d 872 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 873 */
cparata 0:489965565a0d 874 LPS22HB_Error_et LPS22HB_Set_Odr(void *handle, LPS22HB_Odr_et odr);
cparata 0:489965565a0d 875
cparata 0:489965565a0d 876
cparata 0:489965565a0d 877 /**
cparata 0:489965565a0d 878 * @brief Get LPS22HB Output Data Rate
cparata 0:489965565a0d 879 * @param Buffer to empty with Output Data Rate
cparata 0:489965565a0d 880 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 881 */
cparata 0:489965565a0d 882 LPS22HB_Error_et LPS22HB_Get_Odr(void *handle, LPS22HB_Odr_et* odr);
cparata 0:489965565a0d 883
cparata 0:489965565a0d 884 /**
cparata 0:489965565a0d 885 * @brief Enable/Disale low-pass filter on LPS22HB pressure data
cparata 0:489965565a0d 886 * @param state: enable or disable
cparata 0:489965565a0d 887 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 888 */
cparata 0:489965565a0d 889 LPS22HB_Error_et LPS22HB_Set_LowPassFilter(void *handle, LPS22HB_State_et state);
cparata 0:489965565a0d 890
cparata 0:489965565a0d 891
cparata 0:489965565a0d 892 /**
cparata 0:489965565a0d 893 * @brief Set low-pass filter cutoff configuration on LPS22HB pressure data
cparata 0:489965565a0d 894 * @param Filter Cutoff ODR/9 or ODR/20
cparata 0:489965565a0d 895 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 896 */
cparata 0:489965565a0d 897 LPS22HB_Error_et LPS22HB_Set_LowPassFilterCutoff(void *handle, LPS22HB_LPF_Cutoff_et cutoff);
cparata 0:489965565a0d 898
cparata 0:489965565a0d 899 /**
cparata 0:489965565a0d 900 * @brief Set Block Data Update mode
cparata 0:489965565a0d 901 * @param LPS22HB_BDU_CONTINUOS_UPDATE/ LPS22HB_BDU_NO_UPDATE
cparata 0:489965565a0d 902 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 903 */
cparata 0:489965565a0d 904 LPS22HB_Error_et LPS22HB_Set_Bdu(void *handle, LPS22HB_Bdu_et bdu);
cparata 0:489965565a0d 905
cparata 0:489965565a0d 906
cparata 0:489965565a0d 907 /**
cparata 0:489965565a0d 908 * @brief Get Block Data Update mode
cparata 0:489965565a0d 909 * @param Buffer to empty whit the bdu mode read from sensor
cparata 0:489965565a0d 910 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 911 */
cparata 0:489965565a0d 912 LPS22HB_Error_et LPS22HB_Get_Bdu(void *handle, LPS22HB_Bdu_et* bdu);
cparata 0:489965565a0d 913
cparata 0:489965565a0d 914 /**
cparata 0:489965565a0d 915 * @brief Set SPI mode: 3 Wire Interface OR 4 Wire Interface
cparata 0:489965565a0d 916 * @param LPS22HB_SPI_4_WIRE/LPS22HB_SPI_3_WIRE
cparata 0:489965565a0d 917 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 918 */
cparata 0:489965565a0d 919 LPS22HB_Error_et LPS22HB_Set_SpiInterface(void *handle, LPS22HB_SPIMode_et spimode);
cparata 0:489965565a0d 920
cparata 0:489965565a0d 921 /**
cparata 0:489965565a0d 922 * @brief Get SPI mode: 3 Wire Interface OR 4 Wire Interface
cparata 0:489965565a0d 923 * @param buffer to empty with SPI mode
cparata 0:489965565a0d 924 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 925 */
cparata 0:489965565a0d 926 LPS22HB_Error_et LPS22HB_Get_SpiInterface(void *handle, LPS22HB_SPIMode_et* spimode);
cparata 0:489965565a0d 927
cparata 0:489965565a0d 928 /**
cparata 0:489965565a0d 929 * @brief Software Reset
cparata 0:489965565a0d 930 * @param void
cparata 0:489965565a0d 931 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 932 */
cparata 0:489965565a0d 933 LPS22HB_Error_et LPS22HB_SwReset(void *handle);
cparata 0:489965565a0d 934
cparata 0:489965565a0d 935 /**
cparata 0:489965565a0d 936 * @brief Reboot Memory Content.
cparata 0:489965565a0d 937 * @param void
cparata 0:489965565a0d 938 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 939 */
cparata 0:489965565a0d 940 LPS22HB_Error_et LPS22HB_MemoryBoot(void *handle);
cparata 0:489965565a0d 941
cparata 0:489965565a0d 942 /**
cparata 0:489965565a0d 943 * @brief Software Reset ann BOOT
cparata 0:489965565a0d 944 * @param void
cparata 0:489965565a0d 945 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 946 */
cparata 0:489965565a0d 947 LPS22HB_Error_et LPS22HB_SwResetAndMemoryBoot(void *handle);
cparata 0:489965565a0d 948
cparata 0:489965565a0d 949
cparata 0:489965565a0d 950 /**
cparata 0:489965565a0d 951 * @brief Enable or Disable FIFO
cparata 0:489965565a0d 952 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 953 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 954 */
cparata 0:489965565a0d 955 LPS22HB_Error_et LPS22HB_Set_FifoModeUse(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 956
cparata 0:489965565a0d 957 /**
cparata 0:489965565a0d 958 * @brief Enable or Disable FIFO Watermark level use. Stop on FIFO Threshold
cparata 0:489965565a0d 959 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 960 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 961 */
cparata 0:489965565a0d 962 LPS22HB_Error_et LPS22HB_Set_FifoWatermarkLevelUse(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 963
cparata 0:489965565a0d 964 /**
cparata 0:489965565a0d 965 * @brief Enable or Disable the Automatic increment register address during a multiple byte access with a serial interface (I2C or SPI)
cparata 0:489965565a0d 966 * @param LPS22HB_ENABLE/LPS22HB_DISABLE. Default is LPS22HB_ENABLE
cparata 0:489965565a0d 967 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 968 */
cparata 0:489965565a0d 969 LPS22HB_Error_et LPS22HB_Set_AutomaticIncrementRegAddress(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 970
cparata 0:489965565a0d 971
cparata 0:489965565a0d 972 /**
cparata 0:489965565a0d 973 * @brief Set One Shot bit to start a new conversion (ODR mode has to be 000)
cparata 0:489965565a0d 974 * @param void
cparata 0:489965565a0d 975 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 976 */
cparata 0:489965565a0d 977 LPS22HB_Error_et LPS22HB_StartOneShotMeasurement(void *handle);
cparata 0:489965565a0d 978
cparata 0:489965565a0d 979 /**
cparata 0:489965565a0d 980 * @brief Enable/Disable I2C
cparata 0:489965565a0d 981 * @param State. Enable (reset bit)/ Disable (set bit)
cparata 0:489965565a0d 982 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 983 */
cparata 0:489965565a0d 984 LPS22HB_Error_et LPS22HB_Set_I2C(void *handle, LPS22HB_State_et i2cstate);
cparata 0:489965565a0d 985
cparata 0:489965565a0d 986
cparata 0:489965565a0d 987 /*CTRL_REG3 Interrupt Control*/
cparata 0:489965565a0d 988 /**
cparata 0:489965565a0d 989 * @brief Set Interrupt Active on High or Low Level
cparata 0:489965565a0d 990 * @param LPS22HB_ActiveHigh/LPS22HB_ActiveLow
cparata 0:489965565a0d 991 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 992 */
cparata 0:489965565a0d 993 LPS22HB_Error_et LPS22HB_Set_InterruptActiveLevel(void *handle, LPS22HB_InterruptActiveLevel_et mode);
cparata 0:489965565a0d 994
cparata 0:489965565a0d 995 /**
cparata 0:489965565a0d 996 * @brief Set Push-pull/open drain selection on interrupt pads.
cparata 0:489965565a0d 997 * @param LPS22HB_PushPull/LPS22HB_OpenDrain
cparata 0:489965565a0d 998 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 999 */
cparata 0:489965565a0d 1000 LPS22HB_Error_et LPS22HB_Set_InterruptOutputType(void *handle, LPS22HB_OutputType_et output);
cparata 0:489965565a0d 1001
cparata 0:489965565a0d 1002 /**
cparata 0:489965565a0d 1003 * @brief Set Data signal on INT1 pad control bits.
cparata 0:489965565a0d 1004 * @param LPS22HB_DATA,LPS22HB_P_HIGH_LPS22HB_P_LOW,LPS22HB_P_LOW_HIGH
cparata 0:489965565a0d 1005 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1006 */
cparata 0:489965565a0d 1007 LPS22HB_Error_et LPS22HB_Set_InterruptControlConfig(void *handle, LPS22HB_OutputSignalConfig_et config);
cparata 0:489965565a0d 1008
cparata 0:489965565a0d 1009
cparata 0:489965565a0d 1010 /**
cparata 0:489965565a0d 1011 * @brief Enable/Disable Data-ready signal on INT_DRDY pin.
cparata 0:489965565a0d 1012 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 1013 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1014 */
cparata 0:489965565a0d 1015 LPS22HB_Error_et LPS22HB_Set_DRDYInterrupt(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 1016
cparata 0:489965565a0d 1017 /**
cparata 0:489965565a0d 1018 * @brief Enable/Disable FIFO overrun interrupt on INT_DRDY pin.
cparata 0:489965565a0d 1019 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 1020 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1021 */
cparata 0:489965565a0d 1022 LPS22HB_Error_et LPS22HB_Set_FIFO_OVR_Interrupt(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 1023
cparata 0:489965565a0d 1024 /**
cparata 0:489965565a0d 1025 * @brief Enable/Disable FIFO threshold (Watermark) interrupt on INT_DRDY pin.
cparata 0:489965565a0d 1026 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 1027 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1028 */
cparata 0:489965565a0d 1029 LPS22HB_Error_et LPS22HB_Set_FIFO_FTH_Interrupt(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 1030
cparata 0:489965565a0d 1031 /**
cparata 0:489965565a0d 1032 * @brief Enable/Disable FIFO FULL interrupt on INT_DRDY pin.
cparata 0:489965565a0d 1033 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 1034 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1035 */
cparata 0:489965565a0d 1036 LPS22HB_Error_et LPS22HB_Set_FIFO_FULL_Interrupt(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 1037
cparata 0:489965565a0d 1038 /**
cparata 0:489965565a0d 1039 * @brief Enable AutoRifP function
cparata 0:489965565a0d 1040 * @param none
cparata 0:489965565a0d 1041 * @detail When this function is enabled, an internal register is set with the current pressure values
cparata 0:489965565a0d 1042 * and the content is subtracted from the pressure output value and result is used for the interrupt generation.
cparata 0:489965565a0d 1043 * the AutoRifP is slf creared.
cparata 0:489965565a0d 1044 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1045 */
cparata 0:489965565a0d 1046 LPS22HB_Error_et LPS22HB_Set_AutoRifP(void *handle);
cparata 0:489965565a0d 1047
cparata 0:489965565a0d 1048 /**
cparata 0:489965565a0d 1049 * @brief Disable AutoRifP
cparata 0:489965565a0d 1050 * @param none
cparata 0:489965565a0d 1051 * @detail the RESET_ARP bit is used to disable the AUTORIFP function. This bis i is selfdleared
cparata 0:489965565a0d 1052 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1053 */
cparata 0:489965565a0d 1054 LPS22HB_Error_et LPS22HB_ResetAutoRifP(void *handle);
cparata 0:489965565a0d 1055
cparata 0:489965565a0d 1056 /**?????
cparata 0:489965565a0d 1057 * @brief Set AutoZero Function bit
cparata 0:489965565a0d 1058 * @detail When set to ‘1’, the actual pressure output is copied in the REF_P reg (@0x15..0x17)
cparata 0:489965565a0d 1059 * @param None
cparata 0:489965565a0d 1060 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1061 */
cparata 0:489965565a0d 1062 LPS22HB_Error_et LPS22HB_Set_AutoZeroFunction(void *handle);
cparata 0:489965565a0d 1063
cparata 0:489965565a0d 1064 /**???
cparata 0:489965565a0d 1065 * @brief Set ResetAutoZero Function bit
cparata 0:489965565a0d 1066 * @details REF_P reg (@0x015..17) set pressure reference to default value RPDS reg (0x18/19).
cparata 0:489965565a0d 1067 * @param None
cparata 0:489965565a0d 1068 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1069 */
cparata 0:489965565a0d 1070 LPS22HB_Error_et LPS22HB_ResetAutoZeroFunction(void *handle);
cparata 0:489965565a0d 1071
cparata 0:489965565a0d 1072
cparata 0:489965565a0d 1073 /**
cparata 0:489965565a0d 1074 * @brief Enable/ Disable the computing of differential pressure output (Interrupt Generation)
cparata 0:489965565a0d 1075 * @param LPS22HB_ENABLE,LPS22HB_DISABLE
cparata 0:489965565a0d 1076 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1077 */
cparata 0:489965565a0d 1078 LPS22HB_Error_et LPS22HB_Set_InterruptDifferentialGeneration(void *handle, LPS22HB_State_et diff_en) ;
cparata 0:489965565a0d 1079
cparata 0:489965565a0d 1080
cparata 0:489965565a0d 1081
cparata 0:489965565a0d 1082 /**
cparata 0:489965565a0d 1083 * @brief Get the DIFF_EN bit value
cparata 0:489965565a0d 1084 * @param buffer to empty with the read value of DIFF_EN bit
cparata 0:489965565a0d 1085 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1086 */
cparata 0:489965565a0d 1087 LPS22HB_Error_et LPS22HB_Get_InterruptDifferentialGeneration(void *handle, LPS22HB_State_et* diff_en);
cparata 0:489965565a0d 1088
cparata 0:489965565a0d 1089
cparata 0:489965565a0d 1090 /**
cparata 0:489965565a0d 1091 * @brief Latch Interrupt request to the INT_SOURCE register.
cparata 0:489965565a0d 1092 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 1093 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1094 */
cparata 0:489965565a0d 1095 LPS22HB_Error_et LPS22HB_LatchInterruptRequest(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 1096
cparata 0:489965565a0d 1097 /**
cparata 0:489965565a0d 1098 * @brief Enable\Disable Interrupt Generation on differential pressure Low event
cparata 0:489965565a0d 1099 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 1100 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1101 */
cparata 0:489965565a0d 1102 LPS22HB_Error_et LPS22HB_Set_PLE(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 1103
cparata 0:489965565a0d 1104 /**
cparata 0:489965565a0d 1105 * @brief Enable\Disable Interrupt Generation on differential pressure High event
cparata 0:489965565a0d 1106 * @param LPS22HB_ENABLE/LPS22HB_DISABLE
cparata 0:489965565a0d 1107 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1108 */
cparata 0:489965565a0d 1109 LPS22HB_Error_et LPS22HB_Set_PHE(void *handle, LPS22HB_State_et status);
cparata 0:489965565a0d 1110
cparata 0:489965565a0d 1111 /**
cparata 0:489965565a0d 1112 * @brief Get the Interrupt Generation on differential pressure status event and the Boot Status.
cparata 0:489965565a0d 1113 * @detail The INT_SOURCE register is cleared by reading it.
cparata 0:489965565a0d 1114 * @param Status Event Flag: BOOT, PH,PL,IA
cparata 0:489965565a0d 1115 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1116 */
cparata 0:489965565a0d 1117 LPS22HB_Error_et LPS22HB_Get_InterruptDifferentialEventStatus(void *handle, LPS22HB_InterruptDiffStatus_st* interruptsource);
cparata 0:489965565a0d 1118
cparata 0:489965565a0d 1119
cparata 0:489965565a0d 1120 /**
cparata 0:489965565a0d 1121 * @brief Get the status of Pressure and Temperature data
cparata 0:489965565a0d 1122 * @param Data Status Flag: TempDataAvailable, TempDataOverrun, PressDataAvailable, PressDataOverrun
cparata 0:489965565a0d 1123 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1124 */
cparata 0:489965565a0d 1125 LPS22HB_Error_et LPS22HB_Get_DataStatus(void *handle, LPS22HB_DataStatus_st* datastatus);
cparata 0:489965565a0d 1126
cparata 0:489965565a0d 1127
cparata 0:489965565a0d 1128 /**
cparata 0:489965565a0d 1129 * @brief Get the LPS22HB raw presure value
cparata 0:489965565a0d 1130 * @param The buffer to empty with the pressure raw value
cparata 0:489965565a0d 1131 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1132 */
cparata 0:489965565a0d 1133 LPS22HB_Error_et LPS22HB_Get_RawPressure(void *handle, int32_t *raw_press);
cparata 0:489965565a0d 1134
cparata 0:489965565a0d 1135 /**
cparata 0:489965565a0d 1136 * @brief Get the LPS22HB Pressure value in hPA.
cparata 0:489965565a0d 1137 * @param The buffer to empty with the pressure value that must be divided by 100 to get the value in hPA
cparata 0:489965565a0d 1138 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1139 */
cparata 0:489965565a0d 1140 LPS22HB_Error_et LPS22HB_Get_Pressure(void *handle, int32_t* Pout);
cparata 0:489965565a0d 1141
cparata 0:489965565a0d 1142 /**
cparata 0:489965565a0d 1143 * @brief Read LPS22HB output register, and calculate the raw temperature.
cparata 0:489965565a0d 1144 * @param The buffer to empty with the temperature raw value
cparata 0:489965565a0d 1145 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1146 */
cparata 0:489965565a0d 1147 LPS22HB_Error_et LPS22HB_Get_RawTemperature(void *handle, int16_t *raw_data);
cparata 0:489965565a0d 1148
cparata 0:489965565a0d 1149 /**
cparata 0:489965565a0d 1150 * @brief Read the Temperature value in °C.
cparata 0:489965565a0d 1151 * @param The buffer to empty with the temperature value that must be divided by 10 to get the value in ['C]
cparata 0:489965565a0d 1152 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1153 */
cparata 0:489965565a0d 1154 LPS22HB_Error_et LPS22HB_Get_Temperature(void *handle, int16_t* Tout);
cparata 0:489965565a0d 1155
cparata 0:489965565a0d 1156 /**
cparata 0:489965565a0d 1157 * @brief Get the threshold value used for pressure interrupt generation.
cparata 0:489965565a0d 1158 * @param The buffer to empty with the temperature value
cparata 0:489965565a0d 1159 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1160 */
cparata 0:489965565a0d 1161 LPS22HB_Error_et LPS22HB_Get_PressureThreshold(void *handle, int16_t *P_ths);
cparata 0:489965565a0d 1162
cparata 0:489965565a0d 1163 /**
cparata 0:489965565a0d 1164 * @brief Set the threshold value used for pressure interrupt generation.
cparata 0:489965565a0d 1165 * @param The buffer to empty with the temperature value
cparata 0:489965565a0d 1166 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1167 */
cparata 0:489965565a0d 1168 LPS22HB_Error_et LPS22HB_Set_PressureThreshold(void *handle, int16_t P_ths);
cparata 0:489965565a0d 1169
cparata 0:489965565a0d 1170 /**
cparata 0:489965565a0d 1171 * @brief Set Fifo Mode.
cparata 0:489965565a0d 1172 * @param Fifo Mode struct
cparata 0:489965565a0d 1173 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1174 */
cparata 0:489965565a0d 1175 LPS22HB_Error_et LPS22HB_Set_FifoMode(void *handle, LPS22HB_FifoMode_et fifomode);
cparata 0:489965565a0d 1176 /**
cparata 0:489965565a0d 1177 * @brief Get Fifo Mode.
cparata 0:489965565a0d 1178 * @param Buffer to empty with fifo mode value
cparata 0:489965565a0d 1179 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1180 */
cparata 0:489965565a0d 1181 LPS22HB_Error_et LPS22HB_Get_FifoMode(void *handle, LPS22HB_FifoMode_et* fifomode);
cparata 0:489965565a0d 1182
cparata 0:489965565a0d 1183 /**
cparata 0:489965565a0d 1184 * @brief Set Fifo Watermark Level.
cparata 0:489965565a0d 1185 * @param Watermark level value [0 31]
cparata 0:489965565a0d 1186 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1187 */
cparata 0:489965565a0d 1188 LPS22HB_Error_et LPS22HB_Set_FifoWatermarkLevel(void *handle, uint8_t wtmlevel);
cparata 0:489965565a0d 1189
cparata 0:489965565a0d 1190 /**
cparata 0:489965565a0d 1191 * @brief Get FIFO Watermark Level
cparata 0:489965565a0d 1192 * @param buffer to empty with watermak level[0,31] value read from sensor
cparata 0:489965565a0d 1193 * @retval Status [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1194 */
cparata 0:489965565a0d 1195 LPS22HB_Error_et LPS22HB_Get_FifoWatermarkLevel(void *handle, uint8_t *wtmlevel);
cparata 0:489965565a0d 1196
cparata 0:489965565a0d 1197
cparata 0:489965565a0d 1198 /**
cparata 0:489965565a0d 1199 * @brief Get Fifo Status.
cparata 0:489965565a0d 1200 * @param Buffer to empty with fifo status
cparata 0:489965565a0d 1201 * @retval Status [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1202 */
cparata 0:489965565a0d 1203 LPS22HB_Error_et LPS22HB_Get_FifoStatus(void *handle, LPS22HB_FifoStatus_st* status);
cparata 0:489965565a0d 1204
cparata 0:489965565a0d 1205
cparata 0:489965565a0d 1206 /**
cparata 0:489965565a0d 1207 * @brief Get the reference pressure after soldering for computing differential pressure (hPA)
cparata 0:489965565a0d 1208 * @param buffer to empty with the he pressure value (hPA)
cparata 0:489965565a0d 1209 * @retval Status [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1210 */
cparata 0:489965565a0d 1211 LPS22HB_Error_et LPS22HB_Get_PressureOffsetValue(void *handle, int16_t *pressoffset);
cparata 0:489965565a0d 1212
cparata 0:489965565a0d 1213 /**
cparata 0:489965565a0d 1214 * @brief Get the Reference Pressure value
cparata 0:489965565a0d 1215 * @detail It is a 24-bit data added to the sensor output measurement to detect a measured pressure beyond programmed limits.
cparata 0:489965565a0d 1216 * @param Buffer to empty with reference pressure value
cparata 0:489965565a0d 1217 * @retval Status [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1218 */
cparata 0:489965565a0d 1219 LPS22HB_Error_et LPS22HB_Get_ReferencePressure(void *handle, int32_t* RefP);
cparata 0:489965565a0d 1220
cparata 0:489965565a0d 1221
cparata 0:489965565a0d 1222 /**
cparata 0:489965565a0d 1223 * @brief Check if the single measurement has completed.
cparata 0:489965565a0d 1224 * @param the returned value is set to 1, when the measurement is completed
cparata 0:489965565a0d 1225 * @retval Status [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1226 */
cparata 0:489965565a0d 1227 LPS22HB_Error_et LPS22HB_IsMeasurementCompleted(void *handle, uint8_t* Is_Measurement_Completed);
cparata 0:489965565a0d 1228
cparata 0:489965565a0d 1229
cparata 0:489965565a0d 1230 /**
cparata 0:489965565a0d 1231 * @brief Get the values of the last single measurement.
cparata 0:489965565a0d 1232 * @param Pressure and temperature value
cparata 0:489965565a0d 1233 * @retvalStatus [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1234 */
cparata 0:489965565a0d 1235 LPS22HB_Error_et LPS22HB_Get_Measurement(void *handle, LPS22HB_MeasureTypeDef_st *Measurement_Value);
cparata 0:489965565a0d 1236
cparata 0:489965565a0d 1237
cparata 0:489965565a0d 1238 /**
cparata 0:489965565a0d 1239 * @brief Set Generic Configuration
cparata 0:489965565a0d 1240 * @param Struct to empty with the chosen values
cparata 0:489965565a0d 1241 * @retval Error code[LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1242 */
cparata 0:489965565a0d 1243 LPS22HB_Error_et LPS22HB_Set_GenericConfig(void *handle, LPS22HB_ConfigTypeDef_st* pxLPS22HBInit);
cparata 0:489965565a0d 1244
cparata 0:489965565a0d 1245 /**
cparata 0:489965565a0d 1246 * @brief Get Generic configuration
cparata 0:489965565a0d 1247 * @param Struct to empty with configuration values
cparata 0:489965565a0d 1248 * @retval Error code[LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1249 */
cparata 0:489965565a0d 1250 LPS22HB_Error_et LPS22HB_Get_GenericConfig(void *handle, LPS22HB_ConfigTypeDef_st* pxLPS22HBInit);
cparata 0:489965565a0d 1251
cparata 0:489965565a0d 1252 /**
cparata 0:489965565a0d 1253 * @brief Set Interrupt configuration
cparata 0:489965565a0d 1254 * @param Struct holding the configuration values
cparata 0:489965565a0d 1255 * @retval Error code[LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1256 */
cparata 0:489965565a0d 1257 LPS22HB_Error_et LPS22HB_Set_InterruptConfig(void *handle, LPS22HB_InterruptTypeDef_st* pLPS22HBInt);
cparata 0:489965565a0d 1258
cparata 0:489965565a0d 1259 /**
cparata 0:489965565a0d 1260 * @brief LPS22HBGet_InterruptConfig
cparata 0:489965565a0d 1261 * @param Struct to empty with configuration values
cparata 0:489965565a0d 1262 * @retval S Error code[LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1263 */
cparata 0:489965565a0d 1264 LPS22HB_Error_et LPS22HB_Get_InterruptConfig(void *handle, LPS22HB_InterruptTypeDef_st* pLPS22HBInt);
cparata 0:489965565a0d 1265
cparata 0:489965565a0d 1266 /**
cparata 0:489965565a0d 1267 * @brief Set Fifo configuration
cparata 0:489965565a0d 1268 * @param Struct holding the configuration values
cparata 0:489965565a0d 1269 * @retval Error code[LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1270 */
cparata 0:489965565a0d 1271 LPS22HB_Error_et LPS22HB_Set_FifoConfig(void *handle, LPS22HB_FIFOTypeDef_st* pLPS22HBFIFO);
cparata 0:489965565a0d 1272
cparata 0:489965565a0d 1273 /**
cparata 0:489965565a0d 1274 * @brief Get Fifo configuration
cparata 0:489965565a0d 1275 * @param Struct to empty with the configuration values
cparata 0:489965565a0d 1276 * @retval Error code[LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1277 */
cparata 0:489965565a0d 1278 LPS22HB_Error_et LPS22HB_Get_FifoConfig(void *handle, LPS22HB_FIFOTypeDef_st* pLPS22HBFIFO);
cparata 0:489965565a0d 1279
cparata 0:489965565a0d 1280 /**
cparata 0:489965565a0d 1281 * @brief Clock Tree Confoguration
cparata 0:489965565a0d 1282 * @param LPS22HB_CTE_NotBalanced, LPS22HB_CTE_ABalanced
cparata 0:489965565a0d 1283 * @retval Error Code [LPS22HB_ERROR, LPS22HB_OK]
cparata 0:489965565a0d 1284 */
cparata 0:489965565a0d 1285 LPS22HB_Error_et LPS22HB_Set_ClockTreeConfifuration(void *handle, LPS22HB_CTE_et mode);
cparata 0:489965565a0d 1286
cparata 0:489965565a0d 1287 /**
cparata 0:489965565a0d 1288 * @}
cparata 0:489965565a0d 1289 */
cparata 0:489965565a0d 1290
cparata 0:489965565a0d 1291 /**
cparata 0:489965565a0d 1292 * @}
cparata 0:489965565a0d 1293 */
cparata 0:489965565a0d 1294
cparata 0:489965565a0d 1295 /**
cparata 0:489965565a0d 1296 * @}
cparata 0:489965565a0d 1297 */
cparata 0:489965565a0d 1298
cparata 0:489965565a0d 1299 #ifdef __cplusplus
cparata 0:489965565a0d 1300 }
cparata 0:489965565a0d 1301 #endif
cparata 0:489965565a0d 1302
cparata 0:489965565a0d 1303 #endif /* __LPS22HB_DRIVER__H */
cparata 0:489965565a0d 1304
cparata 0:489965565a0d 1305 /******************* (C) COPYRIGHT 2013 STMicroelectronics *****END OF FILE****/