Lines Matching +full:milli +full:- +full:ohms

4  * SPDX-License-Identifier: Apache-2.0
26 const struct current_sense_amplifier_dt_spec *config = dev->config; in fetch()
27 struct current_sense_amplifier_data *data = dev->data; in fetch()
31 return -ENOTSUP; in fetch()
34 ret = adc_read_dt(&config->port, &data->sequence); in fetch()
44 const struct current_sense_amplifier_dt_spec *config = dev->config; in get()
45 struct current_sense_amplifier_data *data = dev->data; in get()
46 int32_t raw_val = data->raw; in get()
53 return -ENOTSUP; in get()
56 ret = adc_raw_to_millivolts_dt(&config->port, &raw_val); in get()
65 LOG_DBG("%d/%d, %dmV, current:%dmA", data->raw, in get()
66 (1 << data->sequence.resolution) - 1, raw_val, i_ma); in get()
68 val->val1 = i_ma / 1000; in get()
69 val->val2 = (i_ma % 1000) * 1000; in get()
82 const struct current_sense_amplifier_dt_spec *config = dev->config; in pm_action()
85 if (config->power_gpio.port == NULL) { in pm_action()
87 return -ENOTSUP; in pm_action()
92 ret = gpio_pin_set_dt(&config->power_gpio, 1); in pm_action()
99 ret = gpio_pin_set_dt(&config->power_gpio, 0); in pm_action()
106 return -ENOTSUP; in pm_action()
115 const struct current_sense_amplifier_dt_spec *config = dev->config; in current_init()
116 struct current_sense_amplifier_data *data = dev->data; in current_init()
119 __ASSERT(config->sense_milli_ohms != 0, "Milli-ohms must not be 0"); in current_init()
121 if (!adc_is_ready_dt(&config->port)) { in current_init()
123 return -ENODEV; in current_init()
127 if (config->power_gpio.port != NULL) { in current_init()
128 if (!gpio_is_ready_dt(&config->power_gpio)) { in current_init()
130 return -ENODEV; in current_init()
133 ret = gpio_pin_configure_dt(&config->power_gpio, GPIO_OUTPUT_ACTIVE); in current_init()
141 ret = adc_channel_setup_dt(&config->port); in current_init()
147 ret = adc_sequence_init_dt(&config->port, &data->sequence); in current_init()
153 data->sequence.buffer = &data->raw; in current_init()
154 data->sequence.buffer_size = sizeof(data->raw); in current_init()
155 data->sequence.calibrate = true; in current_init()