| Nordic Thingy:52 v2.0.0

Data Structures | Macros | Enumerations | Functions
LPS22HB pressure sensor
Drivers » Pressure sensor

LPS22HB pressure sensor API. More...

## Data Structures

struct | drv_lps22hb_cfg_t
| Configuration struct for the LPS22HB pressure sensor. More...
struct | drv_lps22hb_twi_cfg_t
| Initialization struct for the LPS22HB pressure sensor driver. More...

## Macros

#define | CTRL_REG1 0x10
| Control register 1.
#define | CTRL_REG1_BDU_Pos 1
| Bitmasks for BDU.
#define | CTRL_REG1_EN_LPFP_Pos 3
| Bitmasks for EN_LPFP.
#define | CTRL_REG1_LPFP_CFG_Pos 2
| Bitmasks for LPFP_CFG.
#define | CTRL_REG1_ODR_Pos 4
| Bitmasks for ODR.
#define | CTRL_REG1_SIM_Pos 0
| Bitmasks for SIM.
#define | CTRL_REG2 0x11
| Control register 2.
#define | CTRL_REG2_BOOT_Pos 7
| Bitmasks for BOOT.
#define | CTRL_REG2_FIFO_EN_Pos 6
| Bitmasks for FIFO_EN.
#define | CTRL_REG2_I2C_DIS_Pos 3
| Bitmasks for I2C_DIS.
#define | CTRL_REG2_IF_ADD_INC_Pos 4
| Bitmasks for IF_ADD_INC.
#define | CTRL_REG2_ONE_SHOT_Pos 0
| Bitmasks for ONE_SHOT.
#define | CTRL_REG2_STOP_ON_FTH_Pos 5
| Bitmasks for STOP_ON_FTH.
#define | CTRL_REG2_SWRESET_Pos 2
| Bitmasks for SWRESET.
#define | CTRL_REG3 0x12
| Control register 3 - INT_DRDY pin control register.
#define | CTRL_REG3_DRDY_Pos 2
| Bitmasks for DRDY.
#define | CTRL_REG3_F_FSS5_Pos 5
| Bitmasks for F_FSS5.
#define | CTRL_REG3_F_FTH_Pos 4
| Bitmasks for F_FTH.
#define | CTRL_REG3_F_OVR_Pos 3
| Bitmasks for F_OVR.
#define | CTRL_REG3_INT_H_L_Pos 7
| Bitmasks for INT_H_L.
#define | CTRL_REG3_INT_S_Pos 0
| Bitmasks for INT_S.
#define | CTRL_REG3_PP_OD_Pos 6
| Bitmasks for PP_OD.
#define | FIFO_CTRL_REG 0x14
| FIFO control register.
#define | FIFO_CTRL_REG_F_MODE_Pos 5
| Bitmasks for F_MODE.
#define | FIFO_STATUS_REG 0x26
| FIFO status.
#define | INT_SOURCE_REG 0x25
| Interrupt source.
#define | INTERRUPT_CFG_REG 0x0B
| Interrupt mode for pressure acquisition configuration register.
#define | INTERRUPT_CFG_REG_AUTORIFP_Pos 7
| Bitmasks for AUTORIFP.
#define | INTERRUPT_CFG_REG_AUTOZERO_Pos 5
| Bitmasks for AUTOZERO.
#define | INTERRUPT_CFG_REG_DIFF_EN_Pos 3
| Bitmasks for DIFF_EN.
#define | INTERRUPT_CFG_REG_LIR_Pos 2
| Bitmasks for LIR.
#define | INTERRUPT_CFG_REG_PHE_Pos 0
| Bitmasks for PHE.
#define | INTERRUPT_CFG_REG_PLE_Pos 1
| Bitmasks for PLE.
#define | INTERRUPT_CFG_REG_RESET_ARP_Pos 6
| Bitmasks for RESET_ARP.
#define | INTERRUPT_CFG_REG_RESET_AZ_Pos 4
| Bitmasks for RESET_AZ.
#define | LPFP_RES_REG 0x33
| Low-pass filter reset register.
#define | PRESS_OUT_H_REG 0x2A
| Pressure output value (MSB).
#define | PRESS_OUT_L_REG 0x29
| Pressure output value (mid part).
#define | PRESS_OUT_XL_REG 0x28
| Pressure output value (LSB).
#define | REF_P_H_REG 0x17
| Reference pressure (MSB part).
#define | REF_P_L_REG 0x16
| Reference pressure (middle part).
#define | REF_P_XL_REG 0x15
| Reference pressure (LSB data).
#define | RES_CONF_REG 0x1A
| Low-power mode configuration.
#define | RES_CONF_REG_LC_EN_Pos 0
| Bitmasks for DRDY.
#define | RPDS_H_REG 0x19
| Pressure offset (MSB data).
#define | RPDS_L_REG 0x18
| Pressure offset (LSB data).
#define | STATUS_REG 0x27
| Status register.
#define | STATUS_REG_P_DA_Pos 0
| Bitmasks for P_DA.
#define | STATUS_REG_P_OR_Pos 4
| Bitmasks for P_OR.
#define | STATUS_REG_T_DA_Pos 1
| Bitmasks for T_DA.
#define | STATUS_REG_T_OR_Pos 5
| Bitmasks for T_OR.
#define | TEMP_OUT_H_REG 0x2C
| Temperature output value (MSB).
#define | TEMP_OUT_L_REG 0x2B
| Temperature output value (LSB).
#define | THS_P_H_REG 0x0D
| User-defined threshold value for pressure interrupt event (Most significant bits).
#define | THS_P_L_REG 0x0C
| User-defined threshold value for pressure interrupt event (Least significant bits).
#define | WHO_AM_I_REG 0x0F
| Device WHO_AM_I register.

## Enumerations

enum | drv_lps22hb_odr_t
| Available data rates.

## Functions

uint32_t | drv_lps22hb_cfg_get (drv_lps22hb_cfg_t *p_cfg)
| Function for reading the configuration of the LPS22HB sensor. More...
uint32_t | drv_lps22hb_cfg_set (drv_lps22hb_cfg_t const *const p_cfg)
| Function for configuring the LPS22HB sensor according to the specified configuration. More...
uint32_t | drv_lps22hb_close (void)
| Function for closing the LPS22HB driver. More...
uint32_t | drv_lps22hb_fifo_status_get (uint8_t *p_status)
| Function for getting the FIFO status. More...
uint32_t | drv_lps22hb_init (void)
| Function for initializing the LPS22HB driver. More...
uint32_t | drv_lps22hb_int_source_get (uint8_t *p_source)
| Function for getting the interrupt source register. More...
uint32_t | drv_lps22hb_low_pass_reset (void)
| Function for resetting low-pass filter of the LPS22HB. More...
uint32_t | drv_lps22hb_odr_set (drv_lps22hb_odr_t odr)
| Function for outputting data rate of the LPS22HB. More...
uint32_t | drv_lps22hb_one_shot (void)
| Function for starting a one-shot conversion of the LPS22HB sensor data. More...
uint32_t | drv_lps22hb_open (drv_lps22hb_twi_cfg_t const *const p_twi_cfg)
| Function for opening the LPS22HB driver according to the specified configuration. More...
uint32_t | drv_lps22hb_pressure_get (uint32_t *p_pressure)
| Function for getting the pressure data. To calculate p(hPa) = *p_pressure(LSB) / 4096(LSB/hPa). More...
uint32_t | drv_lps22hb_pressure_offset_get (uint16_t *p_offset)
| Function for getting pressure offset. More...
uint32_t | drv_lps22hb_pressure_offset_set (uint16_t offset)
| Function for setting pressure offset. More...
uint32_t | drv_lps22hb_reboot (void)
| Function for rebooting the LPS22HB memory content. More...
uint32_t | drv_lps22hb_ref_pressure_get (uint32_t *p_ref_press)
| Function for getting reference pressure. More...
uint32_t | drv_lps22hb_ref_pressure_set (uint32_t ref_press)
| Function for setting reference pressure. More...
uint32_t | drv_lps22hb_status_get (uint8_t *p_status)
| Function for getting the status. More...
uint32_t | drv_lps22hb_sw_reset (void)
| Function for performing a software reset of the LPS22HB. More...
uint32_t | drv_lps22hb_temperature_get (uint16_t *p_temperature)
| Function for getting the temperature data. More...
uint32_t | drv_lps22hb_verify (uint8_t *who_am_i)
| Function for reading and checking the WHO_AM_I register of the LPS22HB sensor. More...

## Detailed Description

LPS22HB pressure sensor API.

## Function Documentation

## ◆ drv_lps22hb_cfg_get()

uint32_t drv_lps22hb_cfg_get | ( | drv_lps22hb_cfg_t * | p_cfg | ) |

Function for reading the configuration of the LPS22HB sensor.

Parameters

  [out] | p_cfg | Pointer to the driver configuration for the session to be opened.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_cfg_set()

uint32_t drv_lps22hb_cfg_set | ( | drv_lps22hb_cfg_t const *const | p_cfg | ) |

Function for configuring the LPS22HB sensor according to the specified configuration.

Parameters

  [in] | p_cfg | Pointer to the sensor configuration.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_close()

uint32_t drv_lps22hb_close | ( | void |  | ) |

Function for closing the LPS22HB driver.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_fifo_status_get()

uint32_t drv_lps22hb_fifo_status_get | ( | uint8_t * | p_status | ) |

Function for getting the FIFO status.

Parameters

  [out] | p_status | Content of FIFO status register.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_init()

uint32_t drv_lps22hb_init | ( | void |  | ) |

Function for initializing the LPS22HB driver.

Returns
  NRF_SUCCESS Only possible return value.

## ◆ drv_lps22hb_int_source_get()

uint32_t drv_lps22hb_int_source_get | ( | uint8_t * | p_source | ) |

Function for getting the interrupt source register.

Parameters

  [out] | p_source | Content of source register.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_low_pass_reset()

uint32_t drv_lps22hb_low_pass_reset | ( | void |  | ) |

Function for resetting low-pass filter of the LPS22HB.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_odr_set()

uint32_t drv_lps22hb_odr_set | ( | drv_lps22hb_odr_t | odr | ) |

Function for outputting data rate of the LPS22HB.

Parameters

  [in] | odr | Output Data Rate fequency.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_one_shot()

uint32_t drv_lps22hb_one_shot | ( | void |  | ) |

Function for starting a one-shot conversion of the LPS22HB sensor data.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_open()

uint32_t drv_lps22hb_open | ( | drv_lps22hb_twi_cfg_t const *const | p_twi_cfg | ) |

Function for opening the LPS22HB driver according to the specified configuration.

Parameters

  [in] | p_twi_cfg | Pointer to the driver configuration for the session to be opened.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_pressure_get()

uint32_t drv_lps22hb_pressure_get | ( | uint32_t * | p_pressure | ) |

Function for getting the pressure data. To calculate p(hPa) = *p_pressure(LSB) / 4096(LSB/hPa).

Parameters

  [out] | p_pressure | Content of pressure registers.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_pressure_offset_get()

uint32_t drv_lps22hb_pressure_offset_get | ( | uint16_t * | p_offset | ) |

Function for getting pressure offset.

Parameters

  [out] | p_offset | Pressure offset.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_pressure_offset_set()

uint32_t drv_lps22hb_pressure_offset_set | ( | uint16_t | offset | ) |

Function for setting pressure offset.

Parameters

  [in] | offset | Pressure offset.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_reboot()

uint32_t drv_lps22hb_reboot | ( | void |  | ) |

Function for rebooting the LPS22HB memory content.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_ref_pressure_get()

uint32_t drv_lps22hb_ref_pressure_get | ( | uint32_t * | p_ref_press | ) |

Function for getting reference pressure.

Parameters

  [in] | p_ref_press | Reference pressure(register format).

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_ref_pressure_set()

uint32_t drv_lps22hb_ref_pressure_set | ( | uint32_t | ref_press | ) |

Function for setting reference pressure.

Parameters

  [in] | ref_press | Reference pressure (register format).

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_status_get()

uint32_t drv_lps22hb_status_get | ( | uint8_t * | p_status | ) |

Function for getting the status.

Parameters

  [out] | p_status | Content of status register.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_sw_reset()

uint32_t drv_lps22hb_sw_reset | ( | void |  | ) |

Function for performing a software reset of the LPS22HB.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_temperature_get()

uint32_t drv_lps22hb_temperature_get | ( | uint16_t * | p_temperature | ) |

Function for getting the temperature data.

Parameters

  [out] | p_temperature | Content of temperature registers.

Returns
  NRF_SUCCESS If the call was successful.

## ◆ drv_lps22hb_verify()

uint32_t drv_lps22hb_verify | ( | uint8_t * | who_am_i | ) |

Function for reading and checking the WHO_AM_I register of the LPS22HB sensor.

Parameters

  [in] | who_am_i | Pointer to store the data.

Returns
  NRF_SUCCESS If the call was successful.