Lines Matching +full:decimation +full:- +full:rate
2 * SPDX-License-Identifier: Apache-2.0
33 return -EINVAL; in mc3419_get_odr_value()
39 return i2c_reg_write_byte_dt(&cfg->i2c, MC3419_REG_OP_MODE, mode); in mc3419_set_op_mode()
46 const struct mc3419_config *cfg = dev->config; in mc3419_sample_fetch()
47 struct mc3419_driver_data *data = dev->data; in mc3419_sample_fetch()
49 k_sem_take(&data->sem, K_FOREVER); in mc3419_sample_fetch()
50 ret = i2c_burst_read_dt(&cfg->i2c, MC3419_REG_XOUT_L, in mc3419_sample_fetch()
51 (uint8_t *)data->samples, in mc3419_sample_fetch()
53 k_sem_give(&data->sem); in mc3419_sample_fetch()
72 struct mc3419_driver_data *data = dev->data; in mc3419_channel_get()
74 k_sem_take(&data->sem, K_FOREVER); in mc3419_channel_get()
77 ret = mc3419_to_sensor_value(data->sensitivity, &data->samples[0], val); in mc3419_channel_get()
80 ret = mc3419_to_sensor_value(data->sensitivity, &data->samples[1], val); in mc3419_channel_get()
83 ret = mc3419_to_sensor_value(data->sensitivity, &data->samples[2], val); in mc3419_channel_get()
86 ret = mc3419_to_sensor_value(data->sensitivity, &data->samples[0], &val[0]); in mc3419_channel_get()
87 ret |= mc3419_to_sensor_value(data->sensitivity, &data->samples[1], &val[1]); in mc3419_channel_get()
88 ret |= mc3419_to_sensor_value(data->sensitivity, &data->samples[2], &val[2]); in mc3419_channel_get()
92 ret = -ENOTSUP; in mc3419_channel_get()
95 k_sem_give(&data->sem); in mc3419_channel_get()
102 const struct mc3419_config *cfg = dev->config; in mc3419_set_accel_range()
103 struct mc3419_driver_data *data = dev->data; in mc3419_set_accel_range()
107 return -EINVAL; in mc3419_set_accel_range()
110 ret = i2c_reg_update_byte_dt(&cfg->i2c, MC3419_REG_RANGE_SELECT_CTRL, in mc3419_set_accel_range()
117 data->sensitivity = (double)(mc3419_accel_sense_map[range] * in mc3419_set_accel_range()
128 const struct mc3419_config *cfg = dev->config; in mc3419_set_odr()
130 ret = mc3419_get_odr_value(val->val1, val->val2); in mc3419_set_odr()
138 ret = i2c_reg_write_byte_dt(&cfg->i2c, MC3419_REG_SAMPLE_RATE, in mc3419_set_odr()
145 LOG_DBG("Set ODR Rate to 0x%x", data_rate); in mc3419_set_odr()
146 ret = i2c_reg_write_byte_dt(&cfg->i2c, MC3419_REG_SAMPLE_RATE_2, cfg->decimation_rate); in mc3419_set_odr()
148 LOG_ERR("Failed to set decimation rate (%d)", ret); in mc3419_set_odr()
160 const struct mc3419_config *cfg = dev->config; in mc3419_set_anymotion_threshold()
163 if (val->val1 > MC3419_ANY_MOTION_THRESH_MAX) { in mc3419_set_anymotion_threshold()
164 return -EINVAL; in mc3419_set_anymotion_threshold()
168 sys_put_le16((uint16_t)val->val1, &buf[1]); in mc3419_set_anymotion_threshold()
170 ret = i2c_write_dt(&cfg->i2c, buf, sizeof(buf)); in mc3419_set_anymotion_threshold()
184 const struct mc3419_config *cfg = dev->config; in mc3419_trigger_set()
185 struct mc3419_driver_data *data = dev->data; in mc3419_trigger_set()
187 k_sem_take(&data->sem, K_FOREVER); in mc3419_trigger_set()
201 k_sem_give(&data->sem); in mc3419_trigger_set()
212 struct mc3419_driver_data *data = dev->data; in mc3419_attr_set()
219 return -ENOTSUP; in mc3419_attr_set()
222 k_sem_take(&data->sem, K_FOREVER); in mc3419_attr_set()
223 ret = mc3419_set_op_mode(dev->config, MC3419_MODE_STANDBY); in mc3419_attr_set()
230 ret = mc3419_set_accel_range(dev, val->val1); in mc3419_attr_set()
242 ret = -EINVAL; in mc3419_attr_set()
246 mc3419_set_op_mode(dev->config, MC3419_MODE_WAKE); in mc3419_attr_set()
248 k_sem_give(&data->sem); in mc3419_attr_set()
255 struct mc3419_driver_data *data = dev->data; in mc3419_init()
256 const struct mc3419_config *cfg = dev->config; in mc3419_init()
258 if (!(i2c_is_ready_dt(&cfg->i2c))) { in mc3419_init()
260 return -ENODEV; in mc3419_init()
263 k_sem_init(&data->sem, 1, 1); in mc3419_init()
273 ret = i2c_reg_update_byte_dt(&cfg->i2c, MC3419_REG_RANGE_SELECT_CTRL, MC3419_LPF_MASK, in mc3419_init()
274 cfg->lpf_fc_sel); in mc3419_init()