Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
LPS25HB.h
00001 /** 00002 * @brief LPS25HB.h 00003 * @details MEMS pressure sensor: 260-1260 hPa absolute digital output barometer. 00004 * Header file. 00005 * 00006 * 00007 * @return N/A 00008 * 00009 * @author Manuel Caballero 00010 * @date 10/June/2019 00011 * @version 10/June/2019 The ORIGIN 00012 * @pre N/A. 00013 * @warning N/A 00014 * @pre This code belongs to AqueronteBlog ( http://unbarquero.blogspot.com ). 00015 */ 00016 #ifndef LPS25HB_H 00017 #define LPS25HB_H 00018 00019 #include "mbed.h" 00020 00021 00022 /** 00023 Example: 00024 @code 00025 #include "mbed.h" 00026 #include "LPS25HB.h" 00027 00028 LPS25HB myLPS25HB ( I2C_SDA, I2C_SCL, LPS25HB::LPS25HB_ADDRESS_1, 400000 ); // I2C_SDA | I2C_SCL 00029 Serial pc ( USBTX, USBRX ); // tx, rx 00030 00031 DigitalOut myled ( LED1 ); 00032 Ticker newAction; 00033 00034 00035 //@brief Constants. 00036 00037 00038 //@brief Variables. 00039 volatile uint32_t myState; // State that indicates when to perform a new sample 00040 00041 00042 //@brief FUNCTION PROTOTYPES 00043 void changeDATA ( void ); 00044 00045 00046 //@brief FUNCTION FOR APPLICATION MAIN ENTRY. 00047 int main() 00048 { 00049 LPS25HB::LPS25HB_status_t aux; 00050 LPS25HB::LPS25HB_data_t myLPS25HB_Data; 00051 00052 pc.baud ( 115200 ); 00053 00054 00055 myled = 1; 00056 wait(3); 00057 myled = 0; 00058 00059 // Perform a software reset 00060 aux = myLPS25HB.LPS25HB_SetSoftwareReset (); 00061 00062 do { 00063 aux = myLPS25HB.LPS25HB_GetSoftwareReset ( &myLPS25HB_Data ); // Dangerous!!! The uC may get stuck here... 00064 // [WORKAROUND] Insert a counter 00065 } while ( myLPS25HB_Data.swreset == LPS25HB::CTRL_REG2_SWRESET_SW_RESET ); 00066 00067 // Reboot memory content 00068 aux = myLPS25HB.LPS25HB_SetRebootMemoryContent (); 00069 00070 do { 00071 aux = myLPS25HB.LPS25HB_GetRebootMemoryContent ( &myLPS25HB_Data ); // Dangerous!!! The uC may get stuck here... 00072 // [WORKAROUND] Insert a counter 00073 } while ( myLPS25HB_Data.boot == LPS25HB::CTRL_REG2_BOOT_REBOOT_MODE ); 00074 00075 // Set device in lOW-POWER mode 00076 aux = myLPS25HB.LPS25HB_SetPowerMode ( LPS25HB::CTRL_REG1_PD_POWER_DOWN_MODE ); 00077 00078 // Get device ID 00079 aux = myLPS25HB.LPS25HB_GetDeviceID ( &myLPS25HB_Data ); 00080 pc.printf ( "Device ID: %x\r\n", myLPS25HB_Data.deviceID ); 00081 00082 // Set temperature resolution: 64 internal average 00083 myLPS25HB_Data.avgt = LPS25HB::RES_CONF_AVGT_64; 00084 aux = myLPS25HB.LPS25HB_SetTemperatureResolution ( myLPS25HB_Data ); 00085 00086 // Set pressure resolution: 512 internal average 00087 myLPS25HB_Data.avgp = LPS25HB::RES_CONF_AVGP_512; 00088 aux = myLPS25HB.LPS25HB_SetPressureResolution ( myLPS25HB_Data ); 00089 00090 // Set ODR: One-shot mode enabled 00091 myLPS25HB_Data.odr = LPS25HB::CTRL_REG1_ODR_ONE_SHOT_MODE; 00092 aux = myLPS25HB.LPS25HB_SetOutputDataRate ( myLPS25HB_Data ); 00093 00094 // Interrupt generation disabled 00095 aux = myLPS25HB.LPS25HB_SetInterruptGeneration ( LPS25HB::CTRL_REG1_DIFF_EN_ENABLED ); 00096 00097 // Block data update: output registers not updated until MSB and LSB have been read 00098 aux = myLPS25HB.LPS25HB_SetBlockDataUpdate ( LPS25HB::CTRL_REG1_BDU_1 ); 00099 00100 // FIFO disabled 00101 myLPS25HB_Data.fifo_en = LPS25HB::CTRL_REG2_FIFO_EN_DISABLED; 00102 aux = myLPS25HB.LPS25HB_SetFIFOEnable ( myLPS25HB_Data ); 00103 00104 // Autozero: Normal mode 00105 myLPS25HB_Data.autozero = LPS25HB::CTRL_REG2_AUTOZERO_NORMAL_MODE; 00106 aux = myLPS25HB.LPS25HB_SetAutozero ( myLPS25HB_Data ); 00107 00108 // Set device in ACTIVE mode 00109 aux = myLPS25HB.LPS25HB_SetPowerMode ( LPS25HB::CTRL_REG1_PD_ACTIVE_MODE ); 00110 00111 00112 myState = 0UL; // Reset the variable 00113 newAction.attach( &changeDATA, 1U ); // the address of the function to be attached ( changeDATA ) and the interval ( 1s ) 00114 00115 00116 // Let the callbacks take care of everything 00117 while(1) { 00118 sleep(); 00119 00120 if ( myState == 1UL ) { 00121 myled = 1U; 00122 00123 // Trigger to get a new data value 00124 aux = myLPS25HB.LPS25HB_SetOneShot (); 00125 00126 // Wait until the conversion is done 00127 do { 00128 aux = myLPS25HB.LPS25HB_GetOneShot ( &myLPS25HB_Data ); 00129 } while( myLPS25HB_Data.one_shot == LPS25HB::CTRL_REG2_ONE_SHOT_NEW_DATASET ); // Dangerous!!! The uC may get stuck here... 00130 // [WORKAROUND] Insert a counter 00131 00132 // Wait until there is a new data ( both pressure and temperature ) 00133 do { 00134 aux = myLPS25HB.LPS25HB_GetStatusRegister ( &myLPS25HB_Data ); 00135 } while( ( myLPS25HB_Data.status_reg & ( LPS25HB::STATUS_REG_P_DA_MASK | LPS25HB::STATUS_REG_T_DA_MASK ) ) != ( LPS25HB::STATUS_REG_P_DA_NEW_DATA | LPS25HB::STATUS_REG_T_DA_NEW_DATA ) ); // Dangerous!!! The uC may get stuck here... 00136 // [WORKAROUND] Insert a counter 00137 00138 // Get pressure 00139 aux = myLPS25HB.LPS25HB_GetPressure ( &myLPS25HB_Data ); 00140 00141 // Get temperature 00142 aux = myLPS25HB.LPS25HB_GetTemperature ( &myLPS25HB_Data ); 00143 00144 // Send data through the UART 00145 pc.printf ( "T: %0.1f C, P: %0.1f mbar\r\n", myLPS25HB_Data.temperature, myLPS25HB_Data.pressure ); 00146 00147 00148 // Reset the variables 00149 myState = 0UL; 00150 myled = 0U; 00151 } 00152 } 00153 } 00154 00155 00156 // @brief changeDATA ( void ) 00157 // 00158 // @details It changes myState variable 00159 // 00160 // @param[in] N/A 00161 // 00162 // @param[out] N/A. 00163 // 00164 // @return N/A. 00165 // 00166 // @author Manuel Caballero 00167 // @date 31/May/2019 00168 // @version 31/May/2019 The ORIGIN 00169 // @pre N/A 00170 // @warning N/A. 00171 void changeDATA ( void ) 00172 { 00173 myState = 1UL; 00174 } 00175 @endcode 00176 */ 00177 00178 00179 /*! 00180 Library for the LPS25HB MEMS pressure sensor: 260-1260 hPa absolute digital output barometer. 00181 */ 00182 class LPS25HB 00183 { 00184 public: 00185 /** 00186 * @brief DEFAULT ADDRESSES 00187 */ 00188 typedef enum { 00189 LPS25HB_ADDRESS_0 = ( 0b1011100 << 1U ), /*!< I2C slave address byte, SDO/SA0 = GND */ 00190 LPS25HB_ADDRESS_1 = ( 0b1011101 << 1U ) /*!< I2C slave address byte, SDO/SA0 = VDD */ 00191 } LPS25HB_addresses_t; 00192 00193 00194 00195 /** 00196 * @brief REGISTERS 00197 */ 00198 typedef enum { 00199 LPS25HB_REF_P_XL = 0x08, /*!< Reference pressure registers */ 00200 LPS25HB_REF_P_L = 0x09, /*!< Reference pressure registers */ 00201 LPS25HB_REF_P_H = 0x0A, /*!< Reference pressure registers */ 00202 LPS25HB_WHO_AM_I = 0x0F, /*!< Who am I register */ 00203 LPS25HB_RES_CONF = 0x10, /*!< Resolution register */ 00204 LPS25HB_CTRL_REG1 = 0x20, /*!< Control registers */ 00205 LPS25HB_CTRL_REG2 = 0x21, /*!< Control registers */ 00206 LPS25HB_CTRL_REG3 = 0x22, /*!< Control registers */ 00207 LPS25HB_CTRL_REG4 = 0x23, /*!< Control registers */ 00208 LPS25HB_INTERRUPT_CFG = 0x24, /*!< Interrupt registers */ 00209 LPS25HB_INT_SOURCE = 0x25, /*!< Interrupt registers */ 00210 LPS25HB_STATUS_REG = 0x27, /*!< Status register */ 00211 LPS25HB_PRESS_OUT_XL = 0x28, /*!< Pressure output register */ 00212 LPS25HB_PRESS_OUT_L = 0x29, /*!< Pressure output register */ 00213 LPS25HB_PRESS_OUT_H = 0x2A, /*!< Pressure output register */ 00214 LPS25HB_TEMP_OUT_L = 0x2B, /*!< Temperature output registers */ 00215 LPS25HB_TEMP_OUT_H = 0x2C, /*!< Temperature output registers */ 00216 LPS25HB_FIFO_CTRL = 0x2E, /*!< FIFO configure registers */ 00217 LPS25HB_FIFO_STATUS = 0x2F, /*!< FIFO configure registers */ 00218 LPS25HB_THS_P_L = 0x30, /*!< Pressure threshold registers */ 00219 LPS25HB_THS_P_H = 0x31, /*!< Pressure threshold registers */ 00220 LPS25HB_RPDS_L = 0x39, /*!< Pressure offset registers */ 00221 LPS25HB_RPDS_H = 0x3A /*!< Pressure offset registers */ 00222 } LPS25HB_registers_t; 00223 00224 00225 00226 /** 00227 * @brief REF_P_XL REGISTER. Reference pressure (LSB data) ( Default: 0x00 ) 00228 */ 00229 typedef enum { 00230 REF_P_XL_MASK = 0xFF /*!< REF_P_XL mask */ 00231 } LPS25HB_rep_p_xl_t; 00232 00233 00234 /** 00235 * @brief REF_P_L REGISTER. Reference pressure (middle part) ( Default: 0x00 ) 00236 */ 00237 typedef enum { 00238 REF_P_L_MASK = 0xFF /*!< REF_P_L mask */ 00239 } LPS25HB_rep_p_l_t; 00240 00241 00242 /** 00243 * @brief REF_P_H REGISTER. Reference pressure (MSB data) ( Default: 0x00 ) 00244 */ 00245 typedef enum { 00246 REF_P_H_MASK = 0xFF /*!< REF_P_H mask */ 00247 } LPS25HB_rep_p_h_t; 00248 00249 00250 /** 00251 * @brief WHO_AM_I REGISTER. 00252 */ 00253 typedef enum { 00254 WHO_AM_I_MASK = 0xFF, /*!< WHO_AM_I mask */ 00255 WHO_AM_I_VALUE = 0xBD /*!< WHO_AM_I: 0xBD */ 00256 } LPS25HB_who_am_i_t; 00257 00258 00259 /** 00260 * @brief RES_CONF REGISTER. 00261 */ 00262 /* AVGT <3:2> 00263 * NOTE: Temperature internal average configuration. 00264 */ 00265 typedef enum { 00266 RES_CONF_AVGT_MASK = ( 0b11 << 2U ), /*!< AVGT mask */ 00267 RES_CONF_AVGT_8 = ( 0b00 << 2U ), /*!< AVGT Nr. internal average 8 */ 00268 RES_CONF_AVGT_16 = ( 0b01 << 2U ), /*!< AVGT Nr. internal average 16 */ 00269 RES_CONF_AVGT_32 = ( 0b10 << 2U ), /*!< AVGT Nr. internal average 32 */ 00270 RES_CONF_AVGT_64 = ( 0b11 << 2U ) /*!< AVGT Nr. internal average 64 [ Default ] */ 00271 } LPS25HB_res_conf_avgt_t; 00272 00273 00274 /* AVGP <1:0> 00275 * NOTE: Pressure internal average configuration. 00276 */ 00277 typedef enum { 00278 RES_CONF_AVGP_MASK = ( 0b11 << 0U ), /*!< AVGP mask */ 00279 RES_CONF_AVGP_8 = ( 0b00 << 0U ), /*!< AVGP Nr. internal average 8 */ 00280 RES_CONF_AVGP_32 = ( 0b01 << 0U ), /*!< AVGP Nr. internal average 32 */ 00281 RES_CONF_AVGP_128 = ( 0b10 << 0U ), /*!< AVGP Nr. internal average 128 */ 00282 RES_CONF_AVGP_512 = ( 0b11 << 0U ) /*!< AVGP Nr. internal average 512 [ Default ] */ 00283 } LPS25HB_res_conf_avgp_t ; 00284 00285 00286 /** 00287 * @brief CTRL_REG1 REGISTER. 00288 */ 00289 /* PD <7> 00290 * NOTE: Power-down control. 00291 */ 00292 typedef enum { 00293 CTRL_REG1_PD_MASK = ( 1U << 7U ), /*!< PD mask */ 00294 CTRL_REG1_PD_POWER_DOWN_MODE = ( 0U << 7U ), /*!< Power-down mode [ Default ] */ 00295 CTRL_REG1_PD_ACTIVE_MODE = ( 1U << 7U ) /*!< Active mode */ 00296 } LPS25HB_ctrl_reg1_pd_t; 00297 00298 00299 /* ODR <6:4> 00300 * NOTE: Output data rate selection. 00301 */ 00302 typedef enum { 00303 CTRL_REG1_ODR_MASK = ( 0b111 << 4U ), /*!< ODR mask */ 00304 CTRL_REG1_ODR_ONE_SHOT_MODE = ( 0b000 << 4U ), /*!< One- shot mode enabled [ Default ] */ 00305 CTRL_REG1_ODR_1_HZ = ( 0b001 << 4U ), /*!< ODR: 1 HZ */ 00306 CTRL_REG1_ODR_7_HZ = ( 0b010 << 4U ), /*!< ODR: 7 HZ */ 00307 CTRL_REG1_ODR_12_5_HZ = ( 0b011 << 4U ), /*!< ODR: 12.5 HZ */ 00308 CTRL_REG1_ODR_25_HZ = ( 0b100 << 4U ) /*!< ODR: 25 HZ */ 00309 } LPS25HB_ctrl_reg1_odr_t ; 00310 00311 00312 /* DIFF_EN <3> 00313 * NOTE: Interrupt generation enable. 00314 */ 00315 typedef enum { 00316 CTRL_REG1_DIFF_EN_MASK = ( 1U << 3U ), /*!< DIFF_EN mask */ 00317 CTRL_REG1_DIFF_EN_DISABLED = ( 0U << 3U ), /*!< Interrupt generation disabled [ Default ] */ 00318 CTRL_REG1_DIFF_EN_ENABLED = ( 1U << 3U ) /*!< Interrupt generation enabled */ 00319 } LPS25HB_ctrl_reg1_diff_en_t ; 00320 00321 00322 /* BDU <2> 00323 * NOTE: Block data update. 00324 */ 00325 typedef enum { 00326 CTRL_REG1_BDU_MASK = ( 1U << 2U ), /*!< BDU mask */ 00327 CTRL_REG1_BDU_0 = ( 0U << 2U ), /*!< Continuous update [ Default ] */ 00328 CTRL_REG1_BDU_1 = ( 1U << 2U ) /*!< Not updated until MSB and LSB have been read */ 00329 } LPS25HB_ctrl_reg1_bdu_t ; 00330 00331 00332 /* RESET_AZ <1> 00333 * NOTE: Reset Autozero function. 00334 */ 00335 typedef enum { 00336 CTRL_REG1_RESET_AZ_MASK = ( 1U << 1U ), /*!< RESET_AZ mask */ 00337 CTRL_REG1_RESET_AZ_NORMAL_MODE = ( 0U << 1U ), /*!< Normal mode [ Default ] */ 00338 CTRL_REG1_RESET_AZ_RESET_AUTOZERO_FUNCTION = ( 1U << 1U ) /*!< Reset Autozero function */ 00339 } LPS25HB_ctrl_reg1_reset_az_t ; 00340 00341 00342 /* SIM <0> 00343 * NOTE: SPI Serial Interface Mode selection. 00344 */ 00345 typedef enum { 00346 CTRL_REG1_SIM_MASK = ( 1U << 0U ), /*!< SIM mask */ 00347 CTRL_REG1_SIM_4_WIRE_INTERFACE = ( 0U << 0U ), /*!< 4-wire interface [ Default ] */ 00348 CTRL_REG1_SIM_3_WIRE_INTERFACE = ( 1U << 0U ) /*!< 3-wire interface */ 00349 } LPS25HB_ctrl_reg1_sim_t ; 00350 00351 00352 /** 00353 * @brief CTRL_REG2 REGISTER. 00354 */ 00355 /* BOOT <7> 00356 * NOTE: Reboot memory content. The bit is self-cleared when the BOOT is completed 00357 */ 00358 typedef enum { 00359 CTRL_REG2_BOOT_MASK = ( 1U << 7U ), /*!< BOOT mask */ 00360 CTRL_REG2_BOOT_NORMAL_MODE = ( 0U << 7U ), /*!< Normal mode [ Default ] */ 00361 CTRL_REG2_BOOT_REBOOT_MODE = ( 1U << 7U ) /*!< Reboot memory content */ 00362 } LPS25HB_ctrl_reg2_boot_t; 00363 00364 00365 /* FIFO_EN <6> 00366 * NOTE: FIFO enable 00367 */ 00368 typedef enum { 00369 CTRL_REG2_FIFO_EN_MASK = ( 1U << 6U ), /*!< FIFO_EN mask */ 00370 CTRL_REG2_FIFO_EN_DISABLED = ( 0U << 6U ), /*!< Disable [ Default ] */ 00371 CTRL_REG2_FIFO_EN_ENABLED = ( 1U << 6U ) /*!< Enabled */ 00372 } LPS25HB_ctrl_reg2_fifo_en_t ; 00373 00374 00375 /* STOP_ON_FTH <5> 00376 * NOTE: Enable the FTH_FIFO bit in FIFO_STATUS (2Fh) for monitoring of FIFO level. 00377 */ 00378 typedef enum { 00379 CTRL_REG2_STOP_ON_FTH_MASK = ( 1U << 5U ), /*!< STOP_ON_FTH mask */ 00380 CTRL_REG2_STOP_ON_FTH_DISABLED = ( 0U << 5U ), /*!< Disable [ Default ] */ 00381 CTRL_REG2_STOP_ON_FTH_ENABLED = ( 1U << 5U ) /*!< Enabled */ 00382 } LPS25HB_ctrl_reg2_stop_on_fth_t ; 00383 00384 00385 /* FIFO_MEAN_DEC <4> 00386 * NOTE: Enable to decimate the output pressure to 1Hz with FIFO Mean mode. 00387 */ 00388 typedef enum { 00389 CTRL_REG2_FIFO_MEAN_DEC_MASK = ( 1U << 4U ), /*!< FIFO_MEAN_DEC mask */ 00390 CTRL_REG2_FIFO_MEAN_DEC_DISABLED = ( 0U << 4U ), /*!< Disable [ Default ] */ 00391 CTRL_REG2_FIFO_MEAN_DEC_ENABLED = ( 1U << 4U ) /*!< Enabled */ 00392 } LPS25HB_ctrl_reg2_fifo_mean_dec_t ; 00393 00394 00395 /* I2C_DIS <3> 00396 * NOTE: I2C interface enabled 00397 */ 00398 typedef enum { 00399 CTRL_REG2_I2C_DIS_MASK = ( 1U << 3U ), /*!< I2C_DIS mask */ 00400 CTRL_REG2_I2C_DIS_ENABLED = ( 0U << 3U ), /*!< Enabled [ Default ] */ 00401 CTRL_REG2_I2C_DIS_DISABLED = ( 1U << 3U ) /*!< Disabled */ 00402 } LPS25HB_ctrl_reg2_i2c_dis_t ; 00403 00404 00405 /* SWRESET <2> 00406 * NOTE: Software reset. The bit is self-cleared when the reset is completed. 00407 */ 00408 typedef enum { 00409 CTRL_REG2_SWRESET_MASK = ( 1U << 2U ), /*!< SWRESET mask */ 00410 CTRL_REG2_SWRESET_NORMAL_MODE = ( 0U << 2U ), /*!< Normal mode [ Default ] */ 00411 CTRL_REG2_SWRESET_SW_RESET = ( 1U << 2U ) /*!< Software reset */ 00412 } LPS25HB_ctrl_reg2_swreset_t ; 00413 00414 00415 /* AUTOZERO <1> 00416 * NOTE: Autozero enable. 00417 */ 00418 typedef enum { 00419 CTRL_REG2_AUTOZERO_MASK = ( 1U << 1U ), /*!< AUTOZERO mask */ 00420 CTRL_REG2_AUTOZERO_NORMAL_MODE = ( 0U << 1U ), /*!< Normal mode [ Default ] */ 00421 CTRL_REG2_AUTOZERO_AUTOZERO_ENABLED = ( 1U << 1U ) /*!< Autozero enabled */ 00422 } LPS25HB_ctrl_reg2_autozero_t ; 00423 00424 00425 /* ONE_SHOT <0> 00426 * NOTE: One shot mode enable. 00427 */ 00428 typedef enum { 00429 CTRL_REG2_ONE_SHOT_MASK = ( 1U << 0U ), /*!< ONE_SHOT mask */ 00430 CTRL_REG2_ONE_SHOTL_IDLE_MODE = ( 0U << 0U ), /*!< Idle mode [ Default ] */ 00431 CTRL_REG2_ONE_SHOT_NEW_DATASET = ( 1U << 0U ) /*!< A new dataset is acquired */ 00432 } LPS25HB_ctrl_reg2_one_shot_t ; 00433 00434 00435 /** 00436 * @brief CTRL_REG3 REGISTER 00437 */ 00438 /* INT_H_L <7> 00439 * NOTE: Interrupt active high 00440 */ 00441 typedef enum { 00442 CTRL_REG3_INT_H_L_MASK = ( 1U << 7U ), /*!< INT_H_L mask */ 00443 CTRL_REG3_INT_H_L_ACTIVE_HIGH = ( 0U << 7U ), /*!< active high [ Default ] */ 00444 CTRL_REG3_INT_H_L_ACTIVE_LOW = ( 1U << 7U ) /*!< active low */ 00445 } LPS25HB_ctrl_reg3_int_h_l_t; 00446 00447 00448 /* PP_OD <6> 00449 * NOTE: Push-pull/open drain selection on interrupt pads. 00450 */ 00451 typedef enum { 00452 CTRL_REG3_PP_OD_MASK = ( 1U << 6U ), /*!< PP_OD mask */ 00453 CTRL_REG3_PP_OD_PUSH_PULL = ( 0U << 6U ), /*!< push-pull [ Default ] */ 00454 CTRL_REG3_PP_OD_OPEN_DRAIN = ( 1U << 6U ) /*!< open drain */ 00455 } LPS25HB_ctrl_reg3_pp_od_t ; 00456 00457 00458 /* INT_S2 <1:0> 00459 * NOTE: Data signal on INT_DRDY pin control bits. 00460 */ 00461 typedef enum { 00462 CTRL_REG3_INT_S2_MASK = ( 0b11 << 0U ), /*!< INT_S2 mask */ 00463 CTRL_REG3_INT_S2_DATA_SIGNAL = ( 0b00 << 0U ), /*!< Data signal [ Default ] */ 00464 CTRL_REG3_INT_S2_PRESSURE_HIGH = ( 0b01 << 0U ), /*!< Pressure high (P_high) */ 00465 CTRL_REG3_INT_S2_PRESSURE_LOW = ( 0b10 << 0U ), /*!< Pressure low (P_low) */ 00466 CTRL_REG3_INT_S2_PRESSURE_LOW_OR_HIGH = ( 0b11 << 0U ) /*!< Pressure low OR high */ 00467 } LPS25HB_ctrl_reg3_int_s2_t ; 00468 00469 00470 /** 00471 * @brief CTRL_REG4 REGISTER 00472 */ 00473 /* F_EMPTY <3> 00474 * NOTE: FIFO empty flag on INT_DRDY pin 00475 */ 00476 typedef enum { 00477 CTRL_REG4_F_EMPTY_MASK = ( 1U << 3U ), /*!< F_EMPTY mask */ 00478 CTRL_REG4_F_EMPTY_DISABLED = ( 0U << 3U ), /*!< Disabled [ Default ] */ 00479 CTRL_REG4_F_EMPTY_ENABLED = ( 1U << 3U ) /*!< Enabled */ 00480 } LPS25HB_ctrl_reg4_f_empty_t; 00481 00482 00483 /* F_FTH <2> 00484 * NOTE: FIFO threshold (watermark) status on INT_DRDY pin to indicate that FIFO is filled up to the threshold level 00485 */ 00486 typedef enum { 00487 CTRL_REG4_F_FTH_MASK = ( 1U << 2U ), /*!< F_FTH mask */ 00488 CTRL_REG4_F_FTH_DISABLED = ( 0U << 2U ), /*!< Disabled [ Default ] */ 00489 CTRL_REG4_F_FTH_ENABLED = ( 1U << 2U ) /*!< Enabled */ 00490 } LPS25HB_ctrl_reg4_f_fth_t ; 00491 00492 00493 /* F_OVR <1> 00494 * NOTE: FIFO overrun interrupt on INT_DRDY pin to indicate that FIFO is full in FIFO mode or that an overrun occurred in Stream mode 00495 */ 00496 typedef enum { 00497 CTRL_REG4_F_OVR_MASK = ( 1U << 1U ), /*!< F_OVR mask */ 00498 CTRL_REG4_F_OVR_DISABLED = ( 0U << 1U ), /*!< Disabled [ Default ] */ 00499 CTRL_REG4_F_OVR_ENABLED = ( 1U << 1U ) /*!< Enabled */ 00500 } LPS25HB_ctrl_reg4_f_ovr_t ; 00501 00502 00503 /* DRDY <0> 00504 * NOTE: Data-ready signal on INT_DRDY pin 00505 */ 00506 typedef enum { 00507 CTRL_REG4_DRDY_MASK = ( 1U << 0U ), /*!< DRDY mask */ 00508 CTRL_REG4_DRDY_DISABLED = ( 0U << 0U ), /*!< Disabled [ Default ] */ 00509 CTRL_REG4_DRDY_ENABLED = ( 1U << 0U ) /*!< Enabled */ 00510 } LPS25HB_ctrl_reg4_drdy_t ; 00511 00512 00513 /** 00514 * @brief INTERRUPT_CFG REGISTER 00515 */ 00516 /* LIR <2> 00517 * NOTE: Latch interrupt request to the INT_SOURCE (25h) register 00518 */ 00519 typedef enum { 00520 INTERRUPT_CFG_LIR_MASK = ( 1U << 2U ), /*!< LIR mask */ 00521 INTERRUPT_CFG_LIR_NOT_LATCHED = ( 0U << 2U ), /*!< Interrupt request not latched [ Default ] */ 00522 INTERRUPT_CFG_LIR_LATCHED = ( 1U << 2U ) /*!< Interrupt request latched */ 00523 } LPS25HB_interrupt_cfg_lir_t; 00524 00525 00526 /* PL_E <1> 00527 * NOTE: Enable interrupt generation on differential pressure low event 00528 */ 00529 typedef enum { 00530 INTERRUPT_CFG_PL_E_MASK = ( 1U << 1U ), /*!< PL_E mask */ 00531 INTERRUPT_CFG_PL_E_DISABLED = ( 0U << 1U ), /*!< Disable interrupt request [ Default ] */ 00532 INTERRUPT_CFG_PL_E_ENABLED = ( 1U << 1U ) /*!< Enable interrupt request on measured differential pressure value lower than preset threshold */ 00533 } LPS25HB_interrupt_cfg_pl_e_t ; 00534 00535 00536 /* PH_E <0> 00537 * NOTE: Enable interrupt generation on differential pressure high event 00538 */ 00539 typedef enum { 00540 INTERRUPT_CFG_PH_E_MASK = ( 1U << 0U ), /*!< PH_E mask */ 00541 INTERRUPT_CFG_PH_E_DISABLED = ( 0U << 0U ), /*!< Disable interrupt request [ Default ] */ 00542 INTERRUPT_CFG_PH_E_ENABLED = ( 1U << 0U ) /*!< enable interrupt request on measured differential pressure value higher than preset threshold */ 00543 } LPS25HB_interrupt_cfg_ph_e_t ; 00544 00545 00546 /** 00547 * @brief INT_SOURCE REGISTER ( INT_SOURCE register is cleared by reading it ) 00548 */ 00549 /* IA <2> 00550 * NOTE: Interrupt active 00551 */ 00552 typedef enum { 00553 INT_SOURCE_IA_MASK = ( 1U << 2U ), /*!< IA mask */ 00554 INT_SOURCE_IA_NO_INTERRUPT_GENERATED = ( 0U << 2U ), /*!< No interrupt has been generated */ 00555 INT_SOURCE_IA_INTERRUPT_GENERATED = ( 1U << 2U ) /*!< One/more interrupt events have been generated */ 00556 } LPS25HB_int_source_ia_t; 00557 00558 00559 /* PL <1> 00560 * NOTE: Differential pressure Low 00561 */ 00562 typedef enum { 00563 INT_SOURCE_PL_MASK = ( 1U << 1U ), /*!< PL mask */ 00564 INT_SOURCE_PL_NO_INTERRUPT_GENERATED = ( 0U << 1U ), /*!< No interrupt has been generated */ 00565 INT_SOURCE_PL_EVENT_OCCURRED = ( 1U << 1U ) /*!< Low differential pressure event has occurred */ 00566 } LPS25HB_int_source_pl_t ; 00567 00568 00569 /* PH <0> 00570 * NOTE: Differential pressure High 00571 */ 00572 typedef enum { 00573 INT_SOURCE_PH_MASK = ( 1U << 0U ), /*!< PH mask */ 00574 INT_SOURCE_PH_NO_INTERRUPT_GENERATED = ( 0U << 0U ), /*!< No interrupt has been generated */ 00575 INT_SOURCE_PH_EVENT_OCCURRED = ( 1U << 0U ) /*!< High differential pressure event has occurred */ 00576 } LPS25HB_int_source_ph_t ; 00577 00578 00579 /** 00580 * @brief STATUS_REG REGISTER 00581 */ 00582 /* P_OR <5> 00583 * NOTE: Pressure data overrun 00584 */ 00585 typedef enum { 00586 STATUS_REG_P_OR_MASK = ( 1U << 5U ), /*!< P_OR mask */ 00587 STATUS_REG_P_OR_NO_DATA = ( 0U << 5U ), /*!< no overrun has occurred */ 00588 STATUS_REG_P_OR_NEW_DATA = ( 1U << 5U ) /*!< new data for pressure has overwritten the previous one */ 00589 } LPS25HB_status_reg_p_or_t; 00590 00591 00592 /* T_OR <4> 00593 * NOTE: Temperature data overrun 00594 */ 00595 typedef enum { 00596 STATUS_REG_T_OR_MASK = ( 1U << 4U ), /*!< T_OR mask */ 00597 STATUS_REG_T_OR_NO_DATA = ( 0U << 4U ), /*!< no overrun has occurred */ 00598 STATUS_REG_T_OR_NEW_DATA = ( 1U << 4U ) /*!< new data for temperature has overwritten the previous one */ 00599 } LPS25HB_status_reg_t_or_t ; 00600 00601 00602 /* P_DA <1> 00603 * NOTE: Pressure data available 00604 */ 00605 typedef enum { 00606 STATUS_REG_P_DA_MASK = ( 1U << 1U ), /*!< P_DA mask */ 00607 STATUS_REG_P_DA_NO_AVAILABLE = ( 0U << 1U ), /*!< new data for pressure is not yet available */ 00608 STATUS_REG_P_DA_NEW_DATA = ( 1U << 1U ) /*!< new data for pressure is available */ 00609 } LPS25HB_status_reg_p_da_t ; 00610 00611 00612 /* T_DA <0> 00613 * NOTE: Temperature data available 00614 */ 00615 typedef enum { 00616 STATUS_REG_T_DA_MASK = ( 1U << 0U ), /*!< T_DA mask */ 00617 STATUS_REG_T_DA_NO_AVAILABLE = ( 0U << 0U ), /*!< new data for temperature is not yet available */ 00618 STATUS_REG_T_DA_NEW_DATA = ( 1U << 0U ) /*!< new data for temperature is available */ 00619 } LPS25HB_status_reg_t_da_t ; 00620 00621 00622 /** 00623 * @brief FIFO_CTRL REGISTER 00624 */ 00625 /* F_MODE <7:5> 00626 * NOTE: FIFO mode selection 00627 */ 00628 typedef enum { 00629 FIFO_CTRL_F_MODE_MASK = ( 0b111 << 5U ), /*!< F_MODE mask */ 00630 FIFO_CTRL_F_MODE_BYPASS_MODE = ( 0b000 << 5U ), /*!< Bypass mode [ Default ] */ 00631 FIFO_CTRL_F_MODE_FIFO_MODE = ( 0b001 << 5U ), /*!< FIDO mode */ 00632 FIFO_CTRL_F_MODE_STREAM_MOD = ( 0b010 << 5U ), /*!< Stream mode */ 00633 FIFO_CTRL_F_MODE_STREAM_TO_FIFO_MODE = ( 0b011 << 5U ), /*!< Stream-to-FIDO mode */ 00634 FIFO_CTRL_F_MODE_BYPASS_TO_STREAM_MODE = ( 0b100 << 5U ), /*!< Bypass-to-Stream mode */ 00635 FIFO_CTRL_F_MODE_FIFO_MEAN_MODE = ( 0b110 << 5U ), /*!< FIDO mean mode */ 00636 FIFO_CTRL_F_MODE_BYPASS_TO_FIFO_MODE = ( 0b111 << 5U ) /*!< Bypass-to-FIDO mode */ 00637 } LPS25HB_fifo_ctrl_f_mode_t; 00638 00639 00640 /* WTM_POINT <4:0> 00641 * NOTE: FIFO threshold (watermark) level selection 00642 */ 00643 typedef enum { 00644 FIFO_CTRL_WTM_POINT_MASK = ( 0b11111 << 0U ), /*!< WTM_POINT mask */ 00645 FIFO_CTRL_WTM_POINT_2_SAMPLE_MOV_AVG = ( 0b00001 << 0U ), /*!< 2-sample moving average [ Default ] */ 00646 FIFO_CTRL_WTM_POINT_4_SAMPLE_MOV_AVG = ( 0b00011 << 0U ), /*!< 4-sample moving average */ 00647 FIFO_CTRL_WTM_POINT_8_SAMPLE_MOV_AVG = ( 0b00111 << 0U ), /*!< 8-sample moving average */ 00648 FIFO_CTRL_WTM_POINT_16_SAMPLE_MOV_AVG = ( 0b01111 << 0U ), /*!< 16-sample moving average */ 00649 FIFO_CTRL_WTM_POINT_32_SAMPLE_MOV_AVG = ( 0b11111 << 0U ) /*!< 32-sample moving average */ 00650 } LPS25HB_fifo_ctrl_wtm_point_t ; 00651 00652 00653 /** 00654 * @brief FIFO_STATUS REGISTER 00655 */ 00656 /* FTH_FIFO <7> 00657 * NOTE: FIFO threshold status 00658 */ 00659 typedef enum { 00660 FIFO_STATUS_FTH_FIFO_MASK = ( 1U << 7U ), /*!< FTH_FIFO mask */ 00661 FIFO_STATUS_FTH_FIFO_0 = ( 0U << 7U ), /*!< FIFO filling is lower than FTH level */ 00662 FIFO_STATUS_FTH_FIFO_1 = ( 1U << 7U ) /*!< FIFO filling is equal or higher than FTH level */ 00663 } LPS25HB_fifo_status_fth_fifo_t; 00664 00665 00666 /* OVR <6> 00667 * NOTE: Overrun bit status 00668 */ 00669 typedef enum { 00670 FIFO_STATUS_OVR_MASK = ( 1U << 6U ), /*!< OVR mask */ 00671 FIFO_STATUS_OVR_FIFO_NOT_FULL = ( 0U << 6U ), /*!< FIFO not full */ 00672 FIFO_STATUS_OVR_FIFO_FULL = ( 1U << 6U ) /*!< FIFO is full and at least one sample in the FIFO has been overwritten */ 00673 } LPS25HB_fifo_status_ovr_t ; 00674 00675 00676 /* EMPTY_FIFO <5> 00677 * NOTE: Empty FIFO bit status 00678 */ 00679 typedef enum { 00680 FIFO_STATUS_EMPTY_FIFO_MASK = ( 1U << 5U ), /*!< EMPTY_FIFO mask */ 00681 FIFO_STATUS_EMPTY_FIFO_NOT_EMPTY = ( 0U << 5U ), /*!< FIFO not empty */ 00682 FIFO_STATUS_EMPTY_FIFO_EMPTY = ( 1U << 5U ) /*!< FIFO empty */ 00683 } LPS25HB_fifo_status_empty_fifo_t ; 00684 00685 00686 /* FSS <4:0> 00687 * NOTE: FIFO stored data level 00688 */ 00689 typedef enum { 00690 FIFO_STATUS_FSS_MASK = ( 0b11111 << 0U ) /*!< FSS mask */ 00691 } LPS25HB_fifo_status_fss_t ; 00692 00693 00694 00695 00696 #ifndef LPS25HB_VECTOR_STRUCT_H 00697 #define LPS25HB_VECTOR_STRUCT_H 00698 typedef struct { 00699 /* Output registers */ 00700 int32_t rawReferencePressure; /*!< Raw reference pressure */ 00701 int32_t rawPressure; /*!< Raw pressure */ 00702 int16_t rawTemperature; /*!< Raw temperature */ 00703 00704 float pressure; /*!< Pressure in mbar */ 00705 float temperature; /*!< Temperature in Celsius degree */ 00706 00707 /* Resolution */ 00708 LPS25HB_res_conf_avgt_t avgt; /*!< Temperature resolution */ 00709 LPS25HB_res_conf_avgp_t avgp; /*!< Pressure resolution */ 00710 00711 /* Configuration */ 00712 LPS25HB_ctrl_reg1_odr_t odr; /*!< Output data rate selection */ 00713 LPS25HB_ctrl_reg1_reset_az_t reset_az; /*!< Reset autozero function */ 00714 LPS25HB_ctrl_reg2_boot_t boot; /*!< Reboot memory content */ 00715 LPS25HB_ctrl_reg2_fifo_en_t fifo_en; /*!< FIFO enable */ 00716 LPS25HB_ctrl_reg2_swreset_t swreset; /*!< Software reset */ 00717 LPS25HB_ctrl_reg2_autozero_t autozero; /*!< Autozero enable */ 00718 LPS25HB_ctrl_reg2_one_shot_t one_shot; /*!< One-shot */ 00719 00720 /* INT_DRDY behaviour */ 00721 LPS25HB_ctrl_reg4_f_empty_t f_empty; /*!< FIFO empty flag on INT_DRDY pin */ 00722 LPS25HB_ctrl_reg4_f_fth_t f_fth; /*!< FIFO threshold (watermark) status on INT_DRDY pin */ 00723 LPS25HB_ctrl_reg4_f_ovr_t f_ovr; /*!< FIFO overrun interrupt on INT_DRDY pin */ 00724 LPS25HB_ctrl_reg4_drdy_t drdy; /*!< Data-ready signal on INT_DRDY pin */ 00725 00726 /* Interrupt configuration */ 00727 LPS25HB_interrupt_cfg_lir_t lir; /*!< Latch interrupt request */ 00728 LPS25HB_interrupt_cfg_pl_e_t pl_e; /*!< Enable interrupt generation on differential pressure low event */ 00729 LPS25HB_interrupt_cfg_ph_e_t ph_e; /*!< Enable interrupt generation on differential pressure high event */ 00730 00731 /* Interrupt source */ 00732 uint8_t int_source; /*!< Interrupt source */ 00733 00734 /* Status register */ 00735 uint8_t status_reg; /*!< Status register */ 00736 00737 /* FIFO control */ 00738 LPS25HB_fifo_ctrl_f_mode_t f_mode; /*!< FIFO mode selection */ 00739 LPS25HB_fifo_ctrl_wtm_point_t wtm_point; /*!< FIFO threshold (watermark) level selection */ 00740 00741 /* FIFO status */ 00742 uint8_t FIFOstatus; /*!< FIFO status register */ 00743 00744 /* Pressure threshold */ 00745 uint16_t ths_p; /*!< Threshold value for pressure interrupt generation */ 00746 00747 /* Pressure offset */ 00748 uint16_t rpds; /*!< Pressure offset */ 00749 00750 /* Device identification */ 00751 uint8_t deviceID; /*!< Device ID */ 00752 } LPS25HB_data_t; 00753 #endif 00754 00755 00756 /** 00757 * @brief INTERNAL CONSTANTS 00758 */ 00759 typedef enum { 00760 LPS25HB_SUCCESS = 0U, 00761 LPS25HB_FAILURE = 1U, 00762 I2C_SUCCESS = 0U /*!< I2C communication was fine */ 00763 } LPS25HB_status_t; 00764 00765 00766 00767 00768 /** Create an LPS25HB object connected to the specified I2C pins. 00769 * 00770 * @param sda I2C data pin 00771 * @param scl I2C clock pin 00772 * @param addr I2C slave address 00773 * @param freq I2C frequency 00774 */ 00775 LPS25HB ( PinName sda, PinName scl, uint32_t addr, uint32_t freq ); 00776 00777 /** Delete LPS25HB object. 00778 */ 00779 ~LPS25HB(); 00780 00781 /** It gets raw reference pressure. 00782 */ 00783 LPS25HB_status_t LPS25HB_GetReferencePressure ( LPS25HB_data_t* myREFL ); 00784 00785 /** It sets raw reference pressure. 00786 */ 00787 LPS25HB_status_t LPS25HB_SetReferencePressure ( LPS25HB_data_t myREFL ); 00788 00789 /** It gets the device ID. 00790 */ 00791 LPS25HB_status_t LPS25HB_GetDeviceID ( LPS25HB_data_t* myID ); 00792 00793 /** It sets temperature resolution. 00794 */ 00795 LPS25HB_status_t LPS25HB_SetTemperatureResolution ( LPS25HB_data_t myAVGT ); 00796 00797 /** It gets temperature resolution. 00798 */ 00799 LPS25HB_status_t LPS25HB_GetTemperatureResolution ( LPS25HB_data_t* myAVGT ); 00800 00801 /** It sets pressure resolution. 00802 */ 00803 LPS25HB_status_t LPS25HB_SetPressureResolution ( LPS25HB_data_t myAVGP ); 00804 00805 /** It gets pressure resolution. 00806 */ 00807 LPS25HB_status_t LPS25HB_GetPressureResolution ( LPS25HB_data_t* myAVGP ); 00808 00809 /** It sets the power mode. 00810 */ 00811 LPS25HB_status_t LPS25HB_SetPowerMode ( LPS25HB_ctrl_reg1_pd_t myPD ); 00812 00813 /** It sets the output data rate. 00814 */ 00815 LPS25HB_status_t LPS25HB_SetOutputDataRate ( LPS25HB_data_t myODR ); 00816 00817 /** It gets the output data rate. 00818 */ 00819 LPS25HB_status_t LPS25HB_GetOutputDataRate ( LPS25HB_data_t* myODR ); 00820 00821 /** It sets the interrupt generation enable. 00822 */ 00823 LPS25HB_status_t LPS25HB_SetInterruptGeneration ( LPS25HB_ctrl_reg1_diff_en_t myDIFF_EN ); 00824 00825 /** It sets the block data update. 00826 */ 00827 LPS25HB_status_t LPS25HB_SetBlockDataUpdate ( LPS25HB_ctrl_reg1_bdu_t myBDU ); 00828 00829 /** It sets the reset autozero function. 00830 */ 00831 LPS25HB_status_t LPS25HB_SetResetAutozero ( void ); 00832 00833 /** It gets the reset autozero function. 00834 */ 00835 LPS25HB_status_t LPS25HB_GetResetAutozero ( LPS25HB_data_t* myRESET_AZ ); 00836 00837 /** It sets the reboot memory content. 00838 */ 00839 LPS25HB_status_t LPS25HB_SetRebootMemoryContent ( void ); 00840 00841 /** It gets the reboot memory content. 00842 */ 00843 LPS25HB_status_t LPS25HB_GetRebootMemoryContent ( LPS25HB_data_t* myBOOT ); 00844 00845 /** It sets the FIFO enable/disable. 00846 */ 00847 LPS25HB_status_t LPS25HB_SetFIFOEnable ( LPS25HB_data_t myFIFO_EN ); 00848 00849 /** It gets the FIFO enable/disable. 00850 */ 00851 LPS25HB_status_t LPS25HB_GetFIFOEnable ( LPS25HB_data_t* myFIFO_EN ); 00852 00853 /** It enables/disables the decimate the output pressure to 1Hz with FIFO Mean mode. 00854 */ 00855 LPS25HB_status_t LPS25HB_SetFIFOMeanDec ( LPS25HB_ctrl_reg2_fifo_mean_dec_t myFIFO_MEAN_DEC ); 00856 00857 /** It sets the software reset. 00858 */ 00859 LPS25HB_status_t LPS25HB_SetSoftwareReset ( void ); 00860 00861 /** It gets the software reset flag value. 00862 */ 00863 LPS25HB_status_t LPS25HB_GetSoftwareReset ( LPS25HB_data_t* mySWRESET ); 00864 00865 /** It sets the autozero enable. 00866 */ 00867 LPS25HB_status_t LPS25HB_SetAutozero ( LPS25HB_data_t myAUTOZERO ); 00868 00869 /** It gets the autozero enable value. 00870 */ 00871 LPS25HB_status_t LPS25HB_GetAutozero ( LPS25HB_data_t* myAUTOZERO ); 00872 00873 /** It sets the one-shot mode. 00874 */ 00875 LPS25HB_status_t LPS25HB_SetOneShot ( void ); 00876 00877 /** It gets the one-shot mode flag. 00878 */ 00879 LPS25HB_status_t LPS25HB_GetOneShot ( LPS25HB_data_t* myONE_SHOT ); 00880 00881 /** It sets the interrupt active mode. 00882 */ 00883 LPS25HB_status_t LPS25HB_SetInterruptActiveMode ( LPS25HB_ctrl_reg3_int_h_l_t myINT_H_L ); 00884 00885 /** It sets the Push-pull/open drain selection on interrupt pads. 00886 */ 00887 LPS25HB_status_t LPS25HB_SetDrainSelectionMode ( LPS25HB_ctrl_reg3_pp_od_t myPP_OD ); 00888 00889 /** It sets the Data signal on INT_DRDY pin control bits. 00890 */ 00891 LPS25HB_status_t LPS25HB_SetDataSignalOnPin ( LPS25HB_ctrl_reg3_int_s2_t myINT_S ); 00892 00893 /** It sets the INT_DRDY behaviour. 00894 */ 00895 LPS25HB_status_t LPS25HB_SetINT_DRDY_Behaviour ( LPS25HB_data_t myIntConfig ); 00896 00897 /** It gets the INT_DRDY behaviour. 00898 */ 00899 LPS25HB_status_t LPS25HB_GetINT_DRDY_Behaviour ( LPS25HB_data_t* myIntConfig ); 00900 00901 /** It sets the interrupt configuration register. 00902 */ 00903 LPS25HB_status_t LPS25HB_SetInterruptConfiguration ( LPS25HB_data_t myIntConfig ); 00904 00905 /** It gets the interrupt configuration register. 00906 */ 00907 LPS25HB_status_t LPS25HB_GetInterruptConfiguration ( LPS25HB_data_t* myIntConfig ); 00908 00909 /** It reads the interrupt source register. 00910 */ 00911 LPS25HB_status_t LPS25HB_GetInterruptSource ( LPS25HB_data_t* myIntSource ); 00912 00913 /** It reads the status register. 00914 */ 00915 LPS25HB_status_t LPS25HB_GetStatusRegister ( LPS25HB_data_t* myStatusRegister ); 00916 00917 /** It gets the raw pressure value. 00918 */ 00919 LPS25HB_status_t LPS25HB_GetRawPressure ( LPS25HB_data_t* myRawPressure ); 00920 00921 /** It gets the raw temperature value. 00922 */ 00923 LPS25HB_status_t LPS25HB_GetRawTemperature ( LPS25HB_data_t* myRawTemperature ); 00924 00925 /** It gets the FIFO mode selection. 00926 */ 00927 LPS25HB_status_t LPS25HB_GetFIFO_Mode ( LPS25HB_data_t* myFIFOmode ); 00928 00929 /** It sets the FIFO mode selection. 00930 */ 00931 LPS25HB_status_t LPS25HB_SetFIFO_Mode ( LPS25HB_data_t myFIFOmode ); 00932 00933 /** It gets the FIFO threshold (watermark) level selection. 00934 */ 00935 LPS25HB_status_t LPS25HB_GetFIFO_Threshold ( LPS25HB_data_t* myFIFOthreshold ); 00936 00937 /** It sets the FIFO threshold (watermark) level selection. 00938 */ 00939 LPS25HB_status_t LPS25HB_SetFIFO_Threshold ( LPS25HB_data_t myFIFOthreshold ); 00940 00941 /** It reads the FIFO status register. 00942 */ 00943 LPS25HB_status_t LPS25HB_GetFIFO_Status ( LPS25HB_data_t* myFIFOstatus ); 00944 00945 /** It sets the FIFO threshold value. 00946 */ 00947 LPS25HB_status_t LPS25HB_SetFIFO_ThresholdValue ( LPS25HB_data_t myFIFOthresholdValue ); 00948 00949 /** It gets the FIFO threshold value. 00950 */ 00951 LPS25HB_status_t LPS25HB_GetFIFO_ThresholdValue ( LPS25HB_data_t* myFIFOthresholdValue ); 00952 00953 /** It sets the Pressure offset value. 00954 */ 00955 LPS25HB_status_t LPS25HB_SetPressureOffset ( LPS25HB_data_t myPressureOffset ); 00956 00957 /** It gets the Pressure offset value. 00958 */ 00959 LPS25HB_status_t LPS25HB_GetPressureOffset ( LPS25HB_data_t* myPressureOffset ); 00960 00961 /** It gets the current pressure in mbar. 00962 */ 00963 LPS25HB_status_t LPS25HB_GetPressure ( LPS25HB_data_t* myPressure ); 00964 00965 /** It gets the current temperature in Celsius degrees. 00966 */ 00967 LPS25HB_status_t LPS25HB_GetTemperature ( LPS25HB_data_t* myTemperature ); 00968 00969 00970 00971 private: 00972 I2C _i2c; 00973 uint32_t _LPS25HB_Addr; 00974 }; 00975 00976 #endif
Generated on Thu Jul 14 2022 05:31:07 by
1.7.2