Lines Matching +full:measurement +full:- +full:mode

4  * SPDX-License-Identifier: Apache-2.0
53 const struct bh1750_dev_config *cfg = dev->config; in bh1750_opcode_read()
56 rc = i2c_burst_read_dt(&cfg->bus, opcode, (uint8_t *)val, 2); in bh1750_opcode_read()
67 const struct bh1750_dev_config *cfg = dev->config; in bh1750_opcode_write()
69 return i2c_write_dt(&cfg->bus, &opcode, 1); in bh1750_opcode_write()
81 dev->name); in bh1750_mtreg_write()
88 dev->name); in bh1750_mtreg_write()
97 const struct bh1750_dev_config *cfg = dev->config; in bh1750_get_mode_from_dts_device()
99 if (cfg->resolution == BH1750_HIGH_RES_2_DTS_ENUM) { in bh1750_get_mode_from_dts_device()
101 } else if (cfg->resolution == BH1750_HIGH_RES_DTS_ENUM) { in bh1750_get_mode_from_dts_device()
110 const struct bh1750_dev_config *cfg = dev->config; in bh1750_get_wait_time_from_dts_device()
112 if (cfg->resolution == BH1750_HIGH_RES_2_DTS_ENUM) { in bh1750_get_wait_time_from_dts_device()
114 } else if (cfg->resolution == BH1750_HIGH_RES_DTS_ENUM) { in bh1750_get_wait_time_from_dts_device()
124 const struct bh1750_dev_config *cfg = dev->config; in bh1750_sample_fetch()
125 struct bh1750_data *drv_data = dev->data; in bh1750_sample_fetch()
127 const uint8_t mode = bh1750_get_mode_from_dts_device(dev); in bh1750_sample_fetch() local
133 return -ENOTSUP; in bh1750_sample_fetch()
136 /* Start the measurement */ in bh1750_sample_fetch()
137 rc = bh1750_opcode_write(dev, mode); in bh1750_sample_fetch()
139 LOG_ERR("%s, Failed to start measurement!", in bh1750_sample_fetch()
140 dev->name); in bh1750_sample_fetch()
144 /* Calculate measurement time */ in bh1750_sample_fetch()
145 wait_time = (max_wait * (cfg->mtreg * 10000 / BH1750_DEFAULT_MTREG)) / 10000; in bh1750_sample_fetch()
147 /* Wait for the measurement to be stored in the sensor memory */ in bh1750_sample_fetch()
151 rc = bh1750_opcode_read(dev, mode, &drv_data->sample); in bh1750_sample_fetch()
153 LOG_ERR("%s: Failed to read measurement result!", in bh1750_sample_fetch()
154 dev->name); in bh1750_sample_fetch()
165 const struct bh1750_dev_config *cfg = dev->config; in bh1750_channel_get()
166 struct bh1750_data *drv_data = dev->data; in bh1750_channel_get()
171 return -ENOTSUP; in bh1750_channel_get()
175 * https://www.mouser.com/datasheet/2/348/Rohm_11162017_ROHMS34826-1-1279292.pdf in bh1750_channel_get()
178 tmp = (drv_data->sample * 1000 / 12) * (BH1750_DEFAULT_MTREG * 100 / cfg->mtreg); in bh1750_channel_get()
180 if (cfg->resolution == BH1750_HIGH_RES_2_DTS_ENUM) { in bh1750_channel_get()
184 val->val1 = tmp / 10000; in bh1750_channel_get()
185 val->val2 = (tmp % 10000) * 100; in bh1750_channel_get()
197 const struct bh1750_dev_config *cfg = dev->config; in bh1750_init()
199 if (!device_is_ready(cfg->bus.bus)) { in bh1750_init()
200 LOG_ERR("I2C dev %s not ready", cfg->bus.bus->name); in bh1750_init()
201 return -ENODEV; in bh1750_init()
204 if (cfg->mtreg != BH1750_DEFAULT_MTREG) { in bh1750_init()
205 bh1750_mtreg_write(dev, cfg->mtreg); in bh1750_init()