Example of free fall detection for LSM6DSL in X-NUCLEO-IKS01A2

Dependencies:   X_NUCLEO_IKS01A2 mbed

Fork of FreeFall_IKS01A2 by ST Expansion SW Team

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

Main function is to show how to detect the free fall 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 leave falling the board and then view the notification using an hyper terminal. When the free fall is detected, the LED is switched on for a while.
- the user button can be used to enable/disable the free fall detection feature.

Committer:
cparata
Date:
Fri Aug 19 12:26:01 2016 +0000
Revision:
2:8308cb42bc49
Parent:
0:6a670fda63c2
Add interfaces to all components

Who changed what in which revision?

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