Skip to content

Commit b223f6a

Browse files
explora26Anas Nashif
authored andcommitted
sensor: lps22hb: fix the pressure sensor fractional value
Signed-off-by: Harry Jiang <[email protected]>
1 parent 11a3675 commit b223f6a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/sensor/lps22hb/lps22hb.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ static inline void lps22hb_press_convert(struct sensor_value *val,
5656
/* Pressure sensitivity is 4096 LSB/hPa */
5757
/* Convert raw_val to val in kPa */
5858
val->val1 = (raw_val >> 12) / 10;
59-
val->val2 = ((s32_t)((raw_val) & 0x0FFF) * 1000L) >> 12;
59+
val->val2 = (raw_val >> 12) % 10 * 100000 +
60+
(((s32_t)((raw_val) & 0x0FFF) * 100000L) >> 12);
6061
}
6162

6263
static inline void lps22hb_temp_convert(struct sensor_value *val,

0 commit comments

Comments
 (0)