Lines Matching +full:divider +full:- +full:val

6  * SPDX-License-Identifier: Apache-2.0
43 const struct lps2xdf_config *const cfg = dev->config; in lps2xdf_odr_set()
44 const struct lps2xdf_chip_api *chip_api = cfg->chip_api; in lps2xdf_odr_set()
54 return -EINVAL; in lps2xdf_odr_set()
57 if (chip_api->mode_set_odr_raw(dev, odr)) { in lps2xdf_odr_set()
59 return -EIO; in lps2xdf_odr_set()
66 enum sensor_attribute attr, const struct sensor_value *val) in lps2xdf_attr_set() argument
70 return -ENOTSUP; in lps2xdf_attr_set()
75 return lps2xdf_odr_set(dev, val->val1); in lps2xdf_attr_set()
78 return -ENOTSUP; in lps2xdf_attr_set()
85 struct sensor_value *val, in lps2xdf_press_convert() argument
88 const struct lps2xdf_config *const cfg = dev->config; in lps2xdf_press_convert()
90 int divider; in lps2xdf_press_convert() local
93 * - 4096 LSB/hPa for Full-Scale of 260 - 1260 hPa: in lps2xdf_press_convert()
94 * - 2048 LSB/hPa for Full-Scale of 260 - 4060 hPa: in lps2xdf_press_convert()
97 if (cfg->fs == 0) { in lps2xdf_press_convert()
98 divider = 40960; in lps2xdf_press_convert()
100 divider = 20480; in lps2xdf_press_convert()
102 val->val1 = press_tmp / divider; in lps2xdf_press_convert()
107 val->val2 = (press_tmp % divider) * 3125 / 128; in lps2xdf_press_convert()
111 static inline void lps2xdf_temp_convert(struct sensor_value *val, int16_t raw_val) in lps2xdf_temp_convert() argument
114 val->val1 = raw_val / 100; in lps2xdf_temp_convert()
115 val->val2 = ((int32_t)raw_val % 100) * 10000; in lps2xdf_temp_convert()
119 struct sensor_value *val) in lps2xdf_channel_get() argument
121 struct lps2xdf_data *data = dev->data; in lps2xdf_channel_get()
124 lps2xdf_press_convert(dev, val, data->sample_press); in lps2xdf_channel_get()
126 lps2xdf_temp_convert(val, data->sample_temp); in lps2xdf_channel_get()
128 return -ENOTSUP; in lps2xdf_channel_get()
136 const struct lps2xdf_config *const cfg = dev->config; in lps2xdf_sample_fetch()
137 const struct lps2xdf_chip_api *chip_api = cfg->chip_api; in lps2xdf_sample_fetch()
141 return chip_api->sample_fetch(dev, chan); in lps2xdf_sample_fetch()