7#ifndef ZEPHYR_INCLUDE_DRIVERS_ADC_CURRENT_SENSE_AMPLIFIER_H_
8#define ZEPHYR_INCLUDE_DRIVERS_ADC_CURRENT_SENSE_AMPLIFIER_H_
35#define CURRENT_SENSE_AMPLIFIER_DT_SPEC_GET(node_id) \
37 .port = ADC_DT_SPEC_GET(node_id), \
38 .power_gpio = GPIO_DT_SPEC_GET_OR(node_id, power_gpios, {0}), \
39 .sense_milli_ohms = DT_PROP(node_id, sense_resistor_milli_ohms), \
40 .sense_gain_mult = DT_PROP(node_id, sense_gain_mult), \
41 .sense_gain_div = DT_PROP(node_id, sense_gain_div), \
42 .noise_threshold = DT_PROP(node_id, zephyr_noise_threshold), \
43 .zero_current_voltage_mv = DT_PROP(node_id, zero_current_voltage_mv), \
44 .gain_extended_range = DT_STRING_TOKEN_OR(node_id, gain_extended_range, 0xFF), \
45 .enable_calibration = DT_PROP_OR(node_id, enable_calibration, false), \
static int32_t current_sense_amplifier_scale_ua_dt(const struct current_sense_amplifier_dt_spec *spec, int32_t microvolts)
Calculates the actual amperage from the measured voltage.
Definition current_sense_amplifier.h:80
static void current_sense_amplifier_scale_dt(const struct current_sense_amplifier_dt_spec *spec, int32_t *v_to_i)
Calculates the actual amperage from the measured voltage.
Definition current_sense_amplifier.h:56
Main header file for ADC (Analog-to-Digital Converter) driver API.
Main header file for GPIO driver API.
adc_gain
ADC channel gain factors.
Definition adc.h:35
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__INT32_TYPE__ int32_t
Definition stdint.h:74
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT64_TYPE__ int64_t
Definition stdint.h:75
__INT16_TYPE__ int16_t
Definition stdint.h:73
Container for ADC channel information specified in devicetree.
Definition adc.h:284
Definition current_sense_amplifier.h:13
uint16_t noise_threshold
Definition current_sense_amplifier.h:19
bool enable_calibration
Definition current_sense_amplifier.h:22
uint16_t sense_gain_div
Definition current_sense_amplifier.h:18
int16_t zero_current_voltage_mv
Definition current_sense_amplifier.h:20
uint16_t sense_gain_mult
Definition current_sense_amplifier.h:17
enum adc_gain gain_extended_range
Definition current_sense_amplifier.h:21
uint32_t sense_milli_ohms
Definition current_sense_amplifier.h:16
struct adc_dt_spec port
Definition current_sense_amplifier.h:14
struct gpio_dt_spec power_gpio
Definition current_sense_amplifier.h:15
Container for GPIO pin information specified in devicetree.
Definition gpio.h:296