Lines Matching +full:i2c +full:- +full:command

1 /* sensor_isl29035.c - driver for ISL29035 light sensor */
6 * SPDX-License-Identifier: Apache-2.0
13 #include <zephyr/drivers/i2c.h>
25 struct isl29035_driver_data *drv_data = dev->data; in isl29035_sample_fetch()
26 const struct isl29035_config *config = dev->config; in isl29035_sample_fetch()
31 if (i2c_reg_read_byte_dt(&config->i2c, in isl29035_sample_fetch()
33 return -EIO; in isl29035_sample_fetch()
36 if (i2c_reg_read_byte_dt(&config->i2c, ISL29035_DATA_LSB_REG, in isl29035_sample_fetch()
38 return -EIO; in isl29035_sample_fetch()
41 drv_data->data_sample = (msb << 8) + lsb; in isl29035_sample_fetch()
50 struct isl29035_driver_data *drv_data = dev->data; in isl29035_channel_get()
55 tmp = (uint64_t)drv_data->data_sample * ISL29035_LUX_RANGE; in isl29035_channel_get()
56 val->val1 = tmp >> ISL29035_ADC_DATA_BITS; in isl29035_channel_get()
58 val->val2 = tmp >> ISL29035_ADC_DATA_BITS; in isl29035_channel_get()
61 val->val1 = drv_data->data_sample; in isl29035_channel_get()
62 val->val2 = 0; in isl29035_channel_get()
79 struct isl29035_driver_data *drv_data = dev->data; in isl29035_init()
80 const struct isl29035_config *config = dev->config; in isl29035_init()
82 if (!device_is_ready(config->i2c.bus)) { in isl29035_init()
83 LOG_ERR("I2C bus device not ready"); in isl29035_init()
84 return -ENODEV; in isl29035_init()
87 drv_data->data_sample = 0U; in isl29035_init()
90 if (i2c_reg_update_byte_dt(&config->i2c, ISL29035_ID_REG, in isl29035_init()
93 return -EIO; in isl29035_init()
96 /* set command registers to set default attributes */ in isl29035_init()
97 if (i2c_reg_write_byte_dt(&config->i2c, in isl29035_init()
99 LOG_DBG("Failed to clear COMMAND-I."); in isl29035_init()
100 return -EIO; in isl29035_init()
103 if (i2c_reg_write_byte_dt(&config->i2c, in isl29035_init()
105 LOG_DBG("Failed to clear COMMAND-II."); in isl29035_init()
106 return -EIO; in isl29035_init()
110 if (i2c_reg_update_byte_dt(&config->i2c, in isl29035_init()
115 return -EIO; in isl29035_init()
119 if (i2c_reg_update_byte_dt(&config->i2c, in isl29035_init()
124 return -EIO; in isl29035_init()
128 if (i2c_reg_update_byte_dt(&config->i2c, in isl29035_init()
133 return -EIO; in isl29035_init()
137 if (config->int_gpio.port) { in isl29035_init()
140 return -EIO; in isl29035_init()
152 .i2c = I2C_DT_SPEC_INST_GET(inst), \