Lines Matching +full:proximity +full:- +full:trigger

4  * SPDX-License-Identifier: Apache-2.0
69 const struct vcnl36825t_config *config = dev->config; in vcnl36825t_pm_action()
70 struct vcnl36825t_data *data = dev->data; in vcnl36825t_pm_action()
76 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF1, VCNL36825T_PS_ON_MSK, in vcnl36825t_pm_action()
82 if (config->low_power) { in vcnl36825t_pm_action()
83 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF4, in vcnl36825t_pm_action()
90 if (config->operation_mode == VCNL36825T_OPERATION_MODE_AUTO) { in vcnl36825t_pm_action()
91 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF3, in vcnl36825t_pm_action()
100 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF2, VCNL36825T_PS_ST_MSK, in vcnl36825t_pm_action()
106 data->meas_timeout_us = data->meas_timeout_wakeup_us; in vcnl36825t_pm_action()
110 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF2, VCNL36825T_PS_ST_MSK, in vcnl36825t_pm_action()
116 if (config->operation_mode == VCNL36825T_OPERATION_MODE_AUTO) { in vcnl36825t_pm_action()
117 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF3, in vcnl36825t_pm_action()
124 /* unset LPEN-bit if active, otherwise high current draw can be observed */ in vcnl36825t_pm_action()
125 if (config->low_power) { in vcnl36825t_pm_action()
126 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF4, in vcnl36825t_pm_action()
133 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF1, VCNL36825T_PS_ON_MSK, in vcnl36825t_pm_action()
141 return -ENOTSUP; in vcnl36825t_pm_action()
151 const struct vcnl36825t_config *config = dev->config; in vcnl36825t_sample_fetch()
152 struct vcnl36825t_data *data = dev->data; in vcnl36825t_sample_fetch()
160 return -EBUSY; in vcnl36825t_sample_fetch()
167 if (config->operation_mode == VCNL36825T_OPERATION_MODE_FORCE) { in vcnl36825t_sample_fetch()
168 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF3, in vcnl36825t_sample_fetch()
171 LOG_ERR("could not trigger proximity measurement %d", rc); in vcnl36825t_sample_fetch()
175 k_usleep(data->meas_timeout_us); in vcnl36825t_sample_fetch()
178 data->meas_timeout_us = data->meas_timeout_running_us; in vcnl36825t_sample_fetch()
182 rc = vcnl36825t_read(&config->i2c, VCNL36825T_REG_PS_DATA, &data->proximity); in vcnl36825t_sample_fetch()
184 LOG_ERR("could not fetch proximity measurement %d", rc); in vcnl36825t_sample_fetch()
191 return -EINVAL; in vcnl36825t_sample_fetch()
200 struct vcnl36825t_data *data = dev->data; in vcnl36825t_channel_get()
205 val->val1 = data->proximity & VCNL36825T_OS_DATA_MSK; in vcnl36825t_channel_get()
206 val->val2 = 0; in vcnl36825t_channel_get()
209 return -ENOTSUP; in vcnl36825t_channel_get()
220 return -EINVAL; in vcnl36825t_attr_set()
225 return -EINVAL; in vcnl36825t_attr_set()
238 return -ENOTSUP; in vcnl36825t_attr_set()
268 const struct vcnl36825t_config *config = dev->config; in vcnl36825t_init_registers()
269 struct vcnl36825t_data *data = dev->data; in vcnl36825t_init_registers()
288 vcnl36825t_write(&config->i2c, resetValues[i][0], resetValues[i][1]); in vcnl36825t_init_registers()
295 rc = vcnl36825t_write(&config->i2c, VCNL36825T_REG_PS_CONF1, reg_value); in vcnl36825t_init_registers()
298 return -EIO; in vcnl36825t_init_registers()
304 rc = vcnl36825t_write(&config->i2c, VCNL36825T_REG_PS_CONF1, reg_value); in vcnl36825t_init_registers()
314 switch (config->period) { in vcnl36825t_init_registers()
334 switch (config->proximity_it) { in vcnl36825t_init_registers()
355 switch (config->multi_pulse) { in vcnl36825t_init_registers()
372 switch (config->proximity_itb) { in vcnl36825t_init_registers()
385 if (config->high_gain) { in vcnl36825t_init_registers()
389 rc = vcnl36825t_write(&config->i2c, VCNL36825T_REG_PS_CONF2, reg_value); in vcnl36825t_init_registers()
392 return -EIO; in vcnl36825t_init_registers()
398 if (config->operation_mode == VCNL36825T_OPERATION_MODE_FORCE) { in vcnl36825t_init_registers()
402 switch (config->laser_current) { in vcnl36825t_init_registers()
425 if (config->high_dynamic_output) { in vcnl36825t_init_registers()
429 if (config->sunlight_cancellation) { in vcnl36825t_init_registers()
433 rc = vcnl36825t_write(&config->i2c, VCNL36825T_REG_PS_CONF3, reg_value); in vcnl36825t_init_registers()
436 return -EIO; in vcnl36825t_init_registers()
442 if (config->low_power) { in vcnl36825t_init_registers()
446 switch (config->period) { in vcnl36825t_init_registers()
463 rc = vcnl36825t_write(&config->i2c, VCNL36825T_REG_PS_CONF4, reg_value); in vcnl36825t_init_registers()
466 return -EIO; in vcnl36825t_init_registers()
469 data->meas_timeout_us = in vcnl36825t_init_registers()
473 data->meas_timeout_running_us = data->meas_timeout_us; in vcnl36825t_init_registers()
474 data->meas_timeout_wakeup_us = vcn36825t_measurement_timeout_us( in vcnl36825t_init_registers()
480 if (data->meas_timeout_wakeup_us > VCNL36825T_FORCED_WAKEUP_DELAY_MAX_US) { in vcnl36825t_init_registers()
481 data->meas_timeout_wakeup_us = in vcnl36825t_init_registers()
482 MAX(data->meas_timeout_running_us, VCNL36825T_FORCED_WAKEUP_DELAY_MAX_US); in vcnl36825t_init_registers()
491 const struct vcnl36825t_config *config = dev->config; in vcnl36825t_init()
496 if (!i2c_is_ready_dt(&config->i2c)) { in vcnl36825t_init()
498 return -ENODEV; in vcnl36825t_init()
501 rc = vcnl36825t_read(&config->i2c, VCNL36825T_REG_DEV_ID, &reg_value); in vcnl36825t_init()
509 return -EIO; in vcnl36825t_init()
526 rc = vcnl36825t_update(&config->i2c, VCNL36825T_REG_PS_CONF2, VCNL36825T_PS_ST_MSK, in vcnl36825t_init()
530 return -EIO; in vcnl36825t_init()
548 "measurement-period must be greater/equal 40 ms in low-power mode"); \
552 "measurement-period must be less/equal 80 ms with deactivated low-power mode"); \
555 "operation-mode \"force\" only available if low-power mode deactivated"); \