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