According to lps22hb datasheet, the pressure data are stored in 3 registers, so the last line *buff *= 256; of below API should be removed. I had confirmed this issue in lps22hb, and checked other lps2x series sensors, looks like they had the same issue.
int32_t lps22hb_pressure_raw_get(const stmdev_ctx_t *ctx, uint32_t *buff)
{
uint8_t reg[3];
int32_t ret;
ret = lps22hb_read_reg(ctx, LPS22HB_PRESS_OUT_XL, reg, 3);
*buff = reg[2];
*buff = (*buff * 256) + reg[1];
*buff = (*buff * 256) + reg[0];
*buff *= 256; /* this line should be removed */
return ret;
}
According to lps22hb datasheet, the pressure data are stored in 3 registers, so the last line
*buff *= 256;
of below API should be removed. I had confirmed this issue in lps22hb, and checked other lps2x series sensors, looks like they had the same issue.