Lines Matching refs:val

27 static void icm42605_convert_accel(struct sensor_value *val,  in icm42605_convert_accel()  argument
34 val->val1 = conv_val / 1000000; in icm42605_convert_accel()
35 val->val2 = conv_val % 1000000; in icm42605_convert_accel()
39 static void icm42605_convert_gyro(struct sensor_value *val, in icm42605_convert_gyro() argument
47 val->val1 = conv_val / 1000000; in icm42605_convert_gyro()
48 val->val2 = conv_val % 1000000; in icm42605_convert_gyro()
52 static inline void icm42605_convert_temp(struct sensor_value *val, in icm42605_convert_temp() argument
55 val->val1 = (((int64_t)raw_val * 100) / 207) + 25; in icm42605_convert_temp()
56 val->val2 = ((((int64_t)raw_val * 100) % 207) * 1000000) / 207; in icm42605_convert_temp()
58 if (val->val2 < 0) { in icm42605_convert_temp()
59 val->val1--; in icm42605_convert_temp()
60 val->val2 += 1000000; in icm42605_convert_temp()
61 } else if (val->val2 >= 1000000) { in icm42605_convert_temp()
62 val->val1++; in icm42605_convert_temp()
63 val->val2 -= 1000000; in icm42605_convert_temp()
69 struct sensor_value *val) in icm42605_channel_get() argument
75 icm42605_convert_accel(val, drv_data->accel_x, in icm42605_channel_get()
77 icm42605_convert_accel(val + 1, drv_data->accel_y, in icm42605_channel_get()
79 icm42605_convert_accel(val + 2, drv_data->accel_z, in icm42605_channel_get()
83 icm42605_convert_accel(val, drv_data->accel_x, in icm42605_channel_get()
87 icm42605_convert_accel(val, drv_data->accel_y, in icm42605_channel_get()
91 icm42605_convert_accel(val, drv_data->accel_z, in icm42605_channel_get()
95 icm42605_convert_gyro(val, drv_data->gyro_x, in icm42605_channel_get()
97 icm42605_convert_gyro(val + 1, drv_data->gyro_y, in icm42605_channel_get()
99 icm42605_convert_gyro(val + 2, drv_data->gyro_z, in icm42605_channel_get()
103 icm42605_convert_gyro(val, drv_data->gyro_x, in icm42605_channel_get()
107 icm42605_convert_gyro(val, drv_data->gyro_y, in icm42605_channel_get()
111 icm42605_convert_gyro(val, drv_data->gyro_z, in icm42605_channel_get()
115 icm42605_convert_temp(val, drv_data->temp); in icm42605_channel_get()
254 const struct sensor_value *val) in icm42605_attr_set() argument
258 __ASSERT_NO_MSG(val != NULL); in icm42605_attr_set()
266 if (val->val1 > 8000 || val->val1 < 1) { in icm42605_attr_set()
270 drv_data->accel_hz = val->val1; in icm42605_attr_set()
273 if (val->val1 < ACCEL_FS_16G || in icm42605_attr_set()
274 val->val1 > ACCEL_FS_2G) { in icm42605_attr_set()
278 drv_data->accel_sf = val->val1; in icm42605_attr_set()
291 if (val->val1 > 8000 || val->val1 < 12) { in icm42605_attr_set()
295 drv_data->gyro_hz = val->val1; in icm42605_attr_set()
298 if (val->val1 < GYRO_FS_2000DPS || in icm42605_attr_set()
299 val->val1 > GYRO_FS_15DPS) { in icm42605_attr_set()
303 drv_data->gyro_sf = val->val1; in icm42605_attr_set()
321 struct sensor_value *val) in icm42605_attr_get() argument
325 __ASSERT_NO_MSG(val != NULL); in icm42605_attr_get()
333 val->val1 = drv_data->accel_hz; in icm42605_attr_get()
335 val->val1 = drv_data->accel_sf; in icm42605_attr_get()
347 val->val1 = drv_data->gyro_hz; in icm42605_attr_get()
349 val->val1 = drv_data->gyro_sf; in icm42605_attr_get()