Lines Matching +full:accel +full:- +full:pm

1 /* ST Microelectronics LIS2DUX12 3-axis accelerometer driver
5 * SPDX-License-Identifier: Apache-2.0
52 const struct lis2dux12_config *cfg = dev->config; in lis2dux12_freq_to_odr_val()
55 size_t i = (cfg->pm != LIS2DUX12_OPER_MODE_LOW_POWER) ? LIS2DUX12_DT_ODR_6Hz in lis2dux12_freq_to_odr_val()
57 size_t len = (cfg->pm != LIS2DUX12_OPER_MODE_LOW_POWER) ? LIS2DUX12_DT_ODR_END in lis2dux12_freq_to_odr_val()
67 return -EINVAL; in lis2dux12_freq_to_odr_val()
74 const struct lis2dux12_config *const cfg = dev->config; in lis2dux12_set_fs()
75 const struct lis2dux12_chip_api *chip_api = cfg->chip_api; in lis2dux12_set_fs()
92 return -EINVAL; in lis2dux12_set_fs()
95 ret = chip_api->set_range(dev, range); in lis2dux12_set_fs()
97 LOG_ERR("%s: range init error %d", dev->name, range); in lis2dux12_set_fs()
101 LOG_DBG("%s: set fs to %d g", dev->name, fs); in lis2dux12_set_fs()
109 const struct lis2dux12_config *const cfg = dev->config; in lis2dux12_accel_config()
110 const struct lis2dux12_chip_api *chip_api = cfg->chip_api; in lis2dux12_accel_config()
116 odr_val = lis2dux12_freq_to_odr_val(dev, val->val1); in lis2dux12_accel_config()
118 LOG_ERR("%d Hz not supported or wrong operating mode.", val->val1); in lis2dux12_accel_config()
122 LOG_DBG("%s: set odr to %d Hz", dev->name, val->val1); in lis2dux12_accel_config()
124 return chip_api->set_odr_raw(dev, odr_val); in lis2dux12_accel_config()
126 LOG_ERR("Accel attribute not supported."); in lis2dux12_accel_config()
127 return -ENOTSUP; in lis2dux12_accel_config()
141 return -ENOTSUP; in lis2dux12_attr_set()
149 const struct lis2dux12_config *const cfg = dev->config; in lis2dux12_sample_fetch()
150 const struct lis2dux12_chip_api *chip_api = cfg->chip_api; in lis2dux12_sample_fetch()
155 ret = chip_api->sample_fetch_accel(dev); in lis2dux12_sample_fetch()
159 ret = chip_api->sample_fetch_temp(dev); in lis2dux12_sample_fetch()
163 ret = chip_api->sample_fetch_accel(dev); in lis2dux12_sample_fetch()
167 ret = chip_api->sample_fetch_temp(dev); in lis2dux12_sample_fetch()
171 return -ENOTSUP; in lis2dux12_sample_fetch()
184 val->val1 = dval / 1000000LL; in lis2dux12_convert()
185 val->val2 = dval % 1000000LL; in lis2dux12_convert()
193 lis2dux12_convert(val, data->sample_x, gain); in lis2dux12_get_channel()
196 lis2dux12_convert(val, data->sample_y, gain); in lis2dux12_get_channel()
199 lis2dux12_convert(val, data->sample_z, gain); in lis2dux12_get_channel()
202 lis2dux12_convert(val, data->sample_x, gain); in lis2dux12_get_channel()
203 lis2dux12_convert(val + 1, data->sample_y, gain); in lis2dux12_get_channel()
204 lis2dux12_convert(val + 2, data->sample_z, gain); in lis2dux12_get_channel()
208 sensor_value_from_float(val, data->sample_temp); in lis2dux12_get_channel()
212 return -ENOTSUP; in lis2dux12_get_channel()
221 struct lis2dux12_data *data = dev->data; in lis2dux12_channel_get()
223 return lis2dux12_get_channel(chan, val, data, data->gain); in lis2dux12_channel_get()
257 .pm = DT_INST_PROP(inst, power_mode), \
292 * bus-specific macro at preprocessor time.